Images
Use POST /v1/images/generations for OpenAI-style image generation.
text
POST https://api.rout.my/v1/images/generationsRequest
bash
curl https://api.rout.my/v1/images/generations \
-H "Authorization: Bearer $ROUTMY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "provider/image-model-id",
"prompt": "A clean product photo of a translucent blue cube on a white table",
"n": 1,
"image_config": {
"aspect_ratio": "1:1",
"image_size": "1K"
}
}'Request fields
| Field | Type | Required | Notes |
|---|---|---|---|
model | string | Yes | Exact image model ID from /v1/models. |
prompt | string | Yes | Text description of the image. |
n | integer | No | Number of images requested. Defaults to provider behavior when omitted. |
size | string | No | OpenAI-style size value, when supported by the model. |
quality | string | No | Quality hint, when supported by the model. |
style | string | No | Style hint, when supported by the model. |
user | string | No | Client-side user identifier. |
image_config | object | No | Provider-neutral image settings. |
image_config
| Field | Type | Notes |
|---|---|---|
aspect_ratio | string | Common values include 1:1, 16:9, 9:16, 4:3, 3:4, 4:5, 5:4, and 21:9. |
image_size | string | Common values include 1K, 2K, and 4K. Values are forwarded to the provider when supported. |
Response
The response follows an OpenAI-style image generation shape. Depending on the upstream provider, each image can contain a URL or base64 payload.
json
{
"created": 1744000000,
"data": [
{
"url": "https://example.com/generated-image.png",
"revised_prompt": "A clean product photo of a translucent blue cube..."
}
]
}or:
json
{
"created": 1744000000,
"data": [
{
"b64_json": "iVBORw0KGgo..."
}
]
}Client code should handle both url and b64_json.
Quota accounting
Image generation deducts per generated image, multiplied by the model's token_multiplier:
| Requested size | Base quota units per image |
|---|---|
empty, 1K, 2K, or other non-4K values | 5,000 |
4K | 12,500 |
Provider-reported usage can also be used internally when available. The public response does not expose billing metadata.
Chat image generation
Some image-capable chat models use /v1/chat/completions with modalities: ["image", "text"]. See Chat Completions for that request shape.