Skip to content

GPT Image 2

OpenAI's latest image generation and editing model.

POST https://llm.siraya.ai/v1/images/generations
Authorization string Required
Your API Key (e.g., `Bearer `).

Body

model string Required
The ID of the model to use (e.g. gpt-image-2).
prompt string Required
A text description of the desired image.
n integer Default: 1
The number of images to generate (1-10).
size string
The dimensions of the generated image (e.g. 1024x1024, 1792x1024, 1024x1792).
quality string
The quality of the generated image. Possible values: low, medium, high.
background string
The background type for the generated image. Possible values: transparent, opaque, auto.
output_compression integer
The compression level for the output image (0-100). Applicable to jpeg and webp formats.
moderation string
The content moderation level. Possible values: low, auto.
response_format string
The format in which the generated image is returned. Possible values: b64_json.
user string
A unique identifier representing your end-user.
extra_body object
Additional model-specific parameters passed directly to the provider. Unknown top-level fields are also automatically captured into this object.
curl https://llm.siraya.ai/v1/images/generations \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer <API_KEY>" \
  -d '{
    "model": "gpt-image-2",
    "n": 1,
    "prompt": "A child plays the guitar."
  }'
import requests

url = "https://llm.siraya.ai/v1/images/generations"
headers = {
    "Content-Type": "application/json",
    "Authorization": "Bearer <API_KEY>"
}
data = {
    "model": "gpt-image-2",
    "n": 1,
    "prompt": "A child plays the guitar."
}

response = requests.post(url, headers=headers, json=data)
print(response.json())