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

ParameterDescription
operationgenerate (default) or edit; image editing must explicitly set edit
qualityQuality: low / medium / high
output_formatpng / webp / jpeg
backgroundBackground color / transparent
nNumber of images
maskEdit-mask reference using image_url or file_id
partial_imagesNumber of partial frames in streaming
input_fidelityReference image fidelity

See also

Seedream · Qianfan