Image Generation, Edits & Variations API
GoRoute AI Gateway provides multi-provider image generation, inpainting/editing, and variation capabilities compatible with OpenAI's Images specification. Traffic can be directed to OpenAI DALL-E 2 / DALL-E 3 or Google Imagen using unified request parameters.
Endpoint Specifications
| Endpoint | Method | Format | Description |
|---|---|---|---|
/v1/images/generations | POST | application/json | Generates new images from text prompts (DALL-E 3, Imagen). |
/v1/images/edits | POST | multipart/form-data | Inpainting / editing existing images with prompt and optional alpha mask. |
/v1/images/variations | POST | multipart/form-data | Creates visual variations of an uploaded source image. |
- Authentication:
Bearer sk-gw-...(Virtual Key or Master Admin Key) - Max Image Upload Limit:
20 MB(enforced viahttp.MaxBytesReader) - Supported Formats: PNG (must contain standard PNG signature
\x89PNG\r\n\x1a\n)
Resolution Pricing Matrix & FinOps Accounting
Image models do not bill on input/output token counts; instead, they bill per generated image unit based on Resolution (1024x1024, 1024x1792, 1792x1024), Quality Tier (standard vs hd), and Quantity (n).
GoRoute evaluates image spend using the model catalog's ModalityPricingJSON and integer micro-dollar calculation:
Cost (µ$) = UnitRate(Quality, Size) * n
DALL-E 3 Pricing Matrix Reference
| Resolution | Quality Tier | Unit Cost (USD) | Micro-Dollars ($\mu$) |
|---|---|---|---|
1024x1024 | standard | $0.040 | 40,000 µ$ |
1024x1024 | hd | $0.080 | 80,000 µ$ |
1024x1792 / 1792x1024 | standard | $0.080 | 80,000 µ$ |
1024x1792 / 1792x1024 | hd | $0.120 | 120,000 µ$ |
[!NOTE] If a request specifies
quality: "hd"and the model catalog lacks an explicit resolution entry, GoRoute falls back safely toImageCostMicrosHD, ensuring continuous FinOps ledger tracking.
Generations API (POST /v1/images/generations)
Request Schema (CanonicalImageRequest)
{
"model": "dall-e-3",
"prompt": "A modern data center rendered with glowing fiber optic cables and neon illumination.",
"n": 1,
"size": "1024x1024",
"quality": "standard",
"response_format": "url",
"style": "vivid"
}
| Field | Type | Required | Description |
|---|---|---|---|
prompt | string | Yes | Text description of the desired image(s). |
model | string | No | Model identifier (dall-e-3, dall-e-2, imagen-3.0). Default: dall-e-3. |
n | integer | No | Number of images to generate (1 for DALL-E 3; 1–10 for DALL-E 2). Default: 1. |
quality | string | No | Image fidelity: standard or hd. Default: standard. |
size | string | No | Resolution: 1024x1024, 1024x1792, 1792x1024, 512x512, 256x256. |
response_format | string | No | Format of returned images: url or b64_json. Default: url. |
style | string | No | vivid (hyper-real/dramatic) or natural. Default: vivid. |
Response Schema (CanonicalImageResponse)
{
"created": 1740000000,
"model": "dall-e-3",
"provider": "openai",
"data": [
{
"url": "https://oaidalleapiprodscus.blob.core.windows.net/private/org-...",
"revised_prompt": "A sprawling server room bathed in electric blue and neon purple light..."
}
]
}
Image Edits & Variations
Inpainting / Edits (POST /v1/images/edits)
Image editing modifies an existing PNG image using a replacement prompt and an optional alpha transparency mask.
image: Original PNG file (under 20 MB).mask(optional): Transparent PNG where the transparent area denotes what should be repainted.prompt: Textual instruction for the edit.
Variations (POST /v1/images/variations)
Generates stylistic variants of an existing PNG image without prompt text.
image: Original source PNG file.n: Number of variations to create.