Skip to main content
Content updated: 2026-09-18
Need to return immediately after submitting and then poll for the image URL later? This model supports asynchronous image generation: for Gemini systems change the path suffix to :asyncGenerateContent, for OpenAI systems add the Prefer: respond-async header, and you don’t need to modify the request body at all.

GPT Image

gpt-image-2 can be called with a compatible path via the OpenAI Images API:
For image generation requests gpt-image-2, please primarily use the main relay line https://api.crazyrouter.com/v1. The full generation endpoint is https://api.crazyrouter.com/v1/images/generations. Account login, recharge, and console still use https://crazyrouter.com.

Generate Image

Request Parameters

For compatibility with legacy DALL-E / OpenAI Images clients, gpt-image-2 will also accept response_format=url, response_format=b64_json, quality=standard, and style=vivid/natural. Of these, response_format and style will not be forwarded to the upstream, quality=standard will be normalized to auto.
response_format is just a compatibility field reserved by Crazyrouter for old clients, not an upstream parameter of gpt-image-2. For new integrations, please use output_format="png", "jpeg", or "webp" to control the image file format and, by default, read the data[0].url in the response. If a legacy client sends response_format="b64_json", the server will try its best to retain the base64 response semantics.
Parameter combinations that will still be rejected include: input_fidelity, background=transparent, output_format=png combined with output_compression.

Request Example

Streaming Generation

gpt-image-2 supports stream=true. If partial_images is included in the request, you must also enable stream, and its value range is 0-3.
cURL
Synchronous requests with quality=high or the compatible format quality=hd may take a long time. For image generation business, please prioritize https://api.crazyrouter.com/v1. For high-quality requests, it is recommended to use stream=true, or ensure that your client timeout exceeds 180 seconds.

Response Example


Edit Image

Edit based on existing images, supporting masked area editing, and also supports submitting multiple reference images for fusion, style transfer, or local composition.

Request Parameters

Single Image Editing Example

Python

Multi-Image Reference Editing Example

Multi-image editing requests must use multipart/form-data. It is recommended to use multiple image[] fields to send reference images; the server is also compatible with repeating the image field.
gpt-image-2 multi-image reference supports up to 16 images. Multi-image requests will be preferentially routed to the official OpenAI carrying channel that supports multi-image references.