Skip to main content
# install using pip
# pip install siray

from siray import Siray

client = Siray()

# load a local file and get a ready-to-use data URI
local_image = client.load_from_local("path/to/image.jpg")

status = client.image.run(
    model="black-forest-labs/flux-1.1-pro-ultra-i2i",
    prompt="A futuristic city skyline at dusk",
    image=local_image,
    poll_interval=2.0,  # optional, defaults to 2 seconds
)

print(f"Final status: {status.status}")
if status.is_completed():
    print(status.outputs)

// install using npm
// npm install siray

import { Siray } from 'siray';

const client = new Siray({
  apiKey: 'your-api-key-here',
});

// turn a local file into a base64 data URL you can pass as the `image` field
const initImage = await client.loadFromLocal('path/to/image.jpg');
const status = await client.image.run(
  {
    model: 'black-forest-labs/flux-kontext-i2i-pro',
    prompt: 'A cinematic portrait photo of a cyberpunk samurai',
    image: initImage,
  },
  {
    pollIntervalMs: 3000,
    timeoutMs: 3 * 60 * 1000,
  }
);

if (status.isCompleted()) {
  console.log('Generated image:', status.result);
} else if (status.isFailed()) {
  console.log('Error:', status.fail_reason);
} else {
  console.log('Final status:', status.status);
}
# Submit Task
BASE64_DATA=$(base64 image.jpg | tr -d '\n')
DATA_URL="data:image/jpeg;base64,$BASE64_DATA"

curl -X POST https://api.siray.ai/v1/images/generations/async \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer ${SIRAY_API_TOKEN}" \
  -d "{\"prompt\": \"<prompt>\", \"image\": \"$DATA_URL\", \"model\": \"black-forest-labs/flux-kontext-i2i-pro\"}"


# Query Result
curl -X GET "https://api.siray.ai/v1/images/generations/async/${task_id}" \
  -H "Authorization: Bearer ${SIRAY_API_TOKEN}"