Images
Use POST /v1/images/generations for OpenAI-style image generation and POST /v1/images/edits for OpenAI-style image editing.
POST https://api.rout.my/v1/images/generationsRequest
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 | Accepted for compatibility but stripped before upstream requests. |
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.
{
"created": 1744000000,
"data": [
{
"url": "https://example.com/generated-image.png",
"revised_prompt": "A clean product photo of a translucent blue cube..."
}
]
}or:
{
"created": 1744000000,
"data": [
{
"b64_json": "iVBORw0KGgo..."
}
]
}Client code should handle both url and b64_json.
Image edits
Use POST /v1/images/edits when the model should transform one or more input images.
POST https://api.rout.my/v1/images/editsJSON requests should use images as an array. Multipart requests can use OpenAI-style image file fields.
curl https://api.rout.my/v1/images/edits \
-H "Authorization: Bearer $ROUTMY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"model": "provider/image-edit-model-id",
"prompt": "Keep the product, replace the background with a clean studio gradient",
"images": [
{
"image_url": "https://example.com/input.png"
}
],
"n": 1,
"size": "1024x1024"
}'Common edit fields include model, prompt, images, image, mask, n, size, quality, background, input_fidelity, moderation, output_compression, output_format, partial_images, and stream. The user field is accepted for compatibility but stripped before upstream requests.
Quota accounting
Image generation and image edits deduct quota from the number of output images, 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.total_tokens can also be used internally when available, but it cannot reduce the billable base below the output-image floor. The effective base is:
max(provider_usage.total_tokens, output_images * base_quota_units_per_image)For /v1/images/edits, the default floor is 5,000 quota units per output image. The public response can include provider usage when the upstream returns it, but private billing metadata is not exposed.
Chat image generation
Some image-capable chat models use /v1/chat/completions with modalities: ["image", "text"]. See Chat Completions for that request shape.