Documentation Index
Fetch the complete documentation index at: https://docs.crazyrouter.com/llms.txt
Use this file to discover all available pages before exploring further.
GPT Image
gpt-image-2 uses the OpenAI-compatible Images API:
Generate Image
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Fixed as gpt-image-2 |
prompt | string | Yes | Image description prompt |
n | integer | No | Number of images, default 1, range 1-10 |
size | string | No | auto or WxH. Dimensions must be multiples of 16, each side must be at most 3840, total pixels must be 655360 to 8294400, and the long:short side ratio must not exceed 3:1. Common values: 1024x1024, 1536x1024, 1024x1536 |
quality | string | No | auto, low, medium, high. hd is accepted for compatibility and normalized to high; standard is rejected |
background | string | No | auto or opaque. transparent is not supported for gpt-image-2 |
output_format | string | No | png, jpeg, webp |
output_compression | integer | No | 0-100, only with output_format=jpeg or output_format=webp |
moderation | string | No | auto or low |
stream | boolean | No | Return an SSE stream |
partial_images | integer | No | 0-3, only when stream=true |
user | string | No | End-user identifier |
gpt-image-2: response_format, style, input_fidelity, background=transparent, quality=standard, and output_format=png with output_compression.
Request Examples
Streaming
gpt-image-2 supports stream=true. If you send partial_images, you must also set stream=true, and the value must be 0-3.
cURL
Synchronous
quality=high requests, including the compatibility value quality=hd, can take a long time. For image workloads, use https://cn.crazyrouter.com/v1; for high-quality jobs, prefer stream=true or set your client timeout above 180 seconds.Response Example
Edit Image
Request Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
model | string | Yes | Fixed as gpt-image-2 |
image / image[] | file or file[] | Yes | Original image or reference image file(s), sent as multipart; gpt-image-2 supports up to 16 reference images |
prompt | string | Yes | Edit description |
mask | file | No | Mask image; transparent areas indicate regions to edit |
n | integer | No | Number of images, default 1, range 1-10 |
size | string | No | Same rules as generation |
quality | string | No | auto, low, medium, high; hd is normalized to high |
background | string | No | auto or opaque |
output_format | string | No | png, jpeg, webp |
output_compression | integer | No | 0-100, only with output_format=jpeg or output_format=webp |
stream | boolean | No | Return an SSE stream |
partial_images | integer | No | 0-3, only when stream=true |
Single-Image Edit Example
Python
Multi-Reference Edit Example
Multi-image editing requests must usemultipart/form-data. Prefer multiple image[] fields for reference images; repeated image fields are also accepted.
gpt-image-2 supports up to 16 reference images. Multi-image requests are routed to carriers that support multi-reference image editing.