Skip to main content

JavaScript Client Library

We provide a simplified client library to help you integrate Ikomia SCALE deployments in your JavaScript application. This aims to simplify integration by:

  • Securely handling authentication with the Ikomia SCALE API
  • Providing a simple interface to configure and execute deployments
  • Handling the results of the deployment

Example

Let's say you want to integrate a deployment that generate pictures using a diffusion model like Stable Diffusion in a Node.js application. Here is an example of how you can do it:

import fs from "fs";
import {Client} from "@ikomia/ikclient";
import {ImageIO} from "@ikomia/ikclient/io";

const stableDiffusion = new Client({
url: "https://your.scale.endpoint.url", // Replace with your SCALE endpoint URL
token: "your-api-token", // Or use the environment variable IKOMIA_TOKEN
});

const results = await stableDiffusion.run({
parameters: {
prompt: "Photorealistic photo, side profile of a lion, extreme close-up, high-resolution",
}
});

const image = results.getOutput<ImageIO>(0);

fs.writeFile("output.png", image.buffer); // Save the image to a file

Documentation