Imagen 4
Imagen 4 is a family of high-quality text-to-image generation models, offering standard, fast, and ultra variants that trade off generation speed and output quality.
POST
https://llm.siraya.ai/v1/images/generations
Supported Models
| Model ID | Description |
|---|---|
imagen-4.0-generate-001 |
Imagen 4 standard image generation |
imagen-4-fast |
Imagen 4 Fast — optimized for faster generation |
imagen-4-ultra |
Imagen 4 Ultra — optimized for the highest quality output |
Header
Authorization
string
Required
Your API Key (e.g., `Bearer `).
Body
model
string
Required
The ID of the model to use (e.g.
imagen-4.0-generate-001).
prompt
string
Required
A text description of the desired image.
n
integer
Default: 1
The number of images to generate.
size
string
The dimensions of the generated image. Mapped to aspect ratio internally. Supported values:
1024x1024 (1:1), 1792x1024 (16:9), 1024x1792 (9:16), 1280x896 (4:3), 896x1280 (3:4). Defaults to 1:1.
negative_prompt
string
Negative prompt describing content to exclude from the generated image.
seed
integer
Random seed for reproducibility. The same seed produces the same image. When set, watermark is automatically disabled.
output_format
string
Default: url
Result format (`url` or `b64_json`).
async
boolean
Default: false
When
false, the request waits for generation to finish and returns the completed image. When true, it returns immediately with an image id while generation runs in the background. There is no status/poll endpoint for images — pass callbackUrl to receive the result. See Asynchronous generation.
callbackUrl
string
Only used when
async is true. A URL the router will POST to once generation completes (or fails). This is the only way to retrieve the result of an async image job.
extra_body
object
Additional Imagen-specific parameters merged into the request. Keys are converted from snake_case to camelCase automatically. Supported keys include:
person_generation, safety_setting, language, enhance_prompt (boolean), add_watermark (boolean), output_options (object with mimeType and compressionQuality), storage_uri.
import requests
url = "https://llm.siraya.ai/v1/images/generations"
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer <API_KEY>"
}
data = {
"model": "imagen-4.0-generate-001",
"n": 1,
"prompt": "A child plays the guitar."
}
response = requests.post(url, headers=headers, json=data)
print(response.json())