Skip to main content

1. Authentication

All API requests require an authentication token. Please ensure you have your SIRAY_API_TOKEN set as an environment variable or passed directly to the client library.
  • Token: SIRAY_API_TOKEN
  • Security: Pass the token via an environment variable to prevent hardcoding secrets in your source code.
Check account setting to get your key.API Port: https://api.siray.ai/

2. Unified API Overview

The core of the Siray platform is the “Unified API,” which allows you to interact with various models using a consistent run() method. The key components of an API call are:
  1. Model Identifier: E.g., "black-forest-labs/flux-kontext-i2i-pro".
  2. Input Payload: A dictionary/object containing parameters like prompt and the input image.

3. Integration Examples

Node.js
import Siray from "siray";
import fs from "node:fs";
const siray = new Siray({
  auth: process.env.SIRAY_API_TOKEN,
});
const model = "black-forest-labs/flux-kontext-i2i-pro"
const input = {
  prompt: "Put a pair of black sunglasses on Vincent van Gogh",
  image: siray.loadFromLocal("path/to/image.jpg")
};
const result = await siray.run(model, { input });
const output = result.outputs()[0].url();
console.log(output.url());
fs.writeFile("my-image.jpg", output);
Note: Always use the latest model identifiers from the Siray model catalog.