Routes to OpenAI's image generation models. Bills per token and supports streaming partial images and image-to-image with mask editing.
Basic generation
curl -X POST https://ai.win10030.com/image/v1/generations \
-H 'Authorization: Bearer sk-xxxxxxxx' \
-H 'Content-Type: application/json' \
-d '{
"model": "gpt-image-1",
"prompt": "isometric pixel-art spaceship launching",
"size": "1024x1024",
"upstream_options": { "quality": "high", "output_format": "png", "background": "auto" }
}'
Billing
GPT Image bills per token. Usage structure:
{
"usage": {
"input_tokens": { "image_tokens": 0, "text_tokens": 32 },
"output_tokens": { "image_tokens": 4096, "text_tokens": 0 },
"total_tokens": 4128
}
}
Image-to-image + mask editing
curl -X POST https://ai.win10030.com/image/v1/generations \
-H 'Authorization: Bearer sk-xxxxxxxx' \
-H 'Content-Type: application/json' \
-d '{
"model": "gpt-image-1",
"prompt": "remove the background",
"image": { "image_url": "https://example.com/source.png" },
"size": "1024x1024",
"upstream_options": { "operation": "edit", "quality": "high", "background": "transparent", "output_format": "png", "input_fidelity": "high", "mask": { "image_url": "https://example.com/mask.png" } }
}'
Edit mode still calls Router Brain's /image/v1/generations; the gateway converts it to the upstream edit request when operation: "edit" is set. image must use a { "image_url": "..." } or { "file_id": "..." } reference; the optional mask uses the same format. Edit mode does not support streaming.
Streaming (partial images)
curl -N -X POST https://ai.win10030.com/image/v1/generations \
-H 'Authorization: Bearer sk-xxxxxxxx' \
-H 'Content-Type: application/json' \
-d '{
"model": "gpt-image-1",
"prompt": "watercolor cathedral at golden hour",
"size": "1024x1024",
"stream": true,
"upstream_options": { "partial_images": 3, "output_format": "png" }
}'
Common upstream_options
| Parameter | Description |
|---|---|
operation | generate (default) or edit; image editing must explicitly set edit |
quality | Quality: low / medium / high |
output_format | png / webp / jpeg |
background | Background color / transparent |
n | Number of images |
mask | Edit-mask reference using image_url or file_id |
partial_images | Number of partial frames in streaming |
input_fidelity | Reference image fidelity |