Skip to content

Text to Image

Generating high-quality images from natural language descriptions is easy with Siraya AI. Our unified API allows you to access various state-of-the-art image generation models using a single interface.

How to Generate Images

To generate images, send a POST request to our image generation endpoint with your prompt and desired parameters.

Documentation & Examples

curl https://image.siraya.pro/v1/images/generations \
  -H "Content-Type: application/json" \
  -H "Authorization: <API_KEY>" \
  -d '{
    "model": "gpt-image-1",
    "prompt": "A cute baby sea otter",
    "n": 1,
    "output_format": "url"
  }'
from openai import OpenAI

client = OpenAI(
    api_key="<API_KEY>",
    base_url="https://image.siraya.pro/v1"
)

prompt = "A cute baby sea otter."

result = client.images.generate(
    model="gpt-image-1",
    prompt=prompt,
    n=1,
    extra_body={"output_format": "url"}
)

print(result.data[0].url)

Request Parameters

Parameter Type Default Description
model string - The ID of the model to use (e.g., gpt-image-1).
prompt string - A text description of the desired image.
n integer 1 The number of images to generate.
output_format string url The format of the generated images (url or b64_json).

Example Response

{
    "data": [
        {
            "url": "https://resource.siraya.pro/image/generated%2Fsiraya_a146ee8a-1fe2-43ce-803a-fb1e7f3f6949.png",
            "b64_json": "",
            "revised_prompt": ""
        }
    ],
    "created": 1760177063
}
{
    "error": {
        "message": "Invalid prompt detected.",
        "type": "content_policy_violation",
        "param": "",
        "code": 422
    }
}

For a list of all available image models and their capabilities, please visit the Models Directory.