Skip to content

Image

This quickstart walks you through generating your first image with Siraya Model Router.

Image generation

curl https://llm.siraya.ai/v1/images/generations \
    -H "Content-Type: application/json" \
    -H "Authorization: <API_KEY>" \
    -d '{
    "model": "imagen-4.0-generate-001",
    "prompt": "A cute baby sea otter",
  }'

from openai import OpenAI
import base64
import os

client = OpenAI(
    api_key="<API_KEY>", # Replace with your Key "sk-***"
    base_url="https://llm.siraya.ai/v1"
)

prompt = """A cute baby sea otter."""

result = client.images.generate(
    model="imagen-4",
    prompt=prompt,
)

print(result)
  • https://llm.siraya.ai/v1/images/generations is the base URL
  • <API_KEY> is your API Key generated in API page.
  • model is the model name, such as gpt-image-1, available model list can be access in Model page.
  • prompt is the prompt.
  • n is the number of images to generate, default value is 1.
  • b64_json
  • url

Example response

{
    "created": 1774716098,
    "data": [
        {
            "b64_json": "iVBORw0KGgoAAAANSUhEUgAABAAAAAQACAIAAADwf7zUAAAAg3..."
        }
    ]
}