GPT Image — Chat Format
/v1/chat/completionsUpdated
Download MarkdownCurrent models and endpoints
Checked against the model square on 2026-11-30. Examples use gpt-image-2.6-flare-c; gpt-image-2.6-sunburst-c is also available. Use the complete public model name.
- Use https://api.unifyllm.top without channel prefixes.
- Use generations for text-to-image and edits for reference editing; Chat fits existing chat clients.
- Check the model square and key access for gpt-image-2-c and gpt-image-2-4k-c.
Sizes, output, and references
- Images returns created, model, and data[].url, without b64_json or raw upstream usage. One output image per request.
- n=1, quality=high, and response_format=url are fixed; other controls such as mask are not guaranteed.
- Requested pixels do not prove native detail. The reference project tested 1024x1024 → 1254×1254 and 3840x2160 → 3840×2160 on 2026-11-30. Check actual public-route results.
| Item | Rule |
|---|---|
| size | auto or WIDTHxHEIGHT; multiples of 16, longest edge 3840, ratio up to 3:1 |
| Total pixels | 655,360–8,294,400 |
| References | Standard models: JSON or multipart, up to 10 references |
| Legacy 4K edit alias | gpt-image-2-4k-c edits require multipart file upload |
Chat and streaming
- Include the prompt and references in the current user message, including the previous result when editing it.
- stream=false puts Markdown image links in choices[0].message.content; stream=true emits content after success and ends with stop and [DONE].
- The compatibility layer adds parameter summaries and completion text; 100% is not live progress.
- GPT-image Chat usage is estimated by the compatibility layer, not the supplier’s actual image-token bill. Missing Images usage does not mean free generation.
Save images and troubleshoot
- Download the signed image URL without an API key, promptly and with the query string intact.
- A route may store the file before responding or cache it on the first full download. Save it promptly; storage is not permanent.
- For 400 check sizes, references, and model; 401 auth; 413 request size; 429 limit details. Keep request IDs for timeouts or 5xx.
- Do not automatically repeat uncertain paid generation requests. Retry the same URL first if download fails.
Request Body
application/jsonmodel:requiredstringExamples use gpt-image-2.6-flare-c; gpt-image-2.6-sunburst-c is also listed. Check the model square and key access for legacy aliases.
gpt-image-2.6-flare-cgpt-image-2.6-sunburst-cgpt-image-2.5-flare-cgpt-image-2.5-sunburst-cgpt-image-2-cgpt-image-2-4k-cgpt-image-2.6-flare-cmessages:requiredarrayReads text and image_url references from the last user message; previous images are not restored. Text is required.
messages[].content[].image_url:optionalobjectReference image as {"url":"public URL or image data URL"}.
size:optionalstringauto or WIDTHxHEIGHT. Both dimensions must be multiples of 16; longest edge ≤3840, aspect ratio ≤3:1, total pixels 655,360–8,294,400. Actual pixels depend on the upstream.
auto1024x10241536x10241024x15362048x11523840x21601024x1024stream:optionalbooleanDefaults to false. true emits SSE after successful generation and ends with data: [DONE]; no live waiting-period progress.
n / quality / response_format:optionalfixedFixed to one image, high quality, and URL output; requesting b64_json does not enable Base64. Other generation controls are not guaranteed to be forwarded.
Response
200stream=false returns JSON; stream=true returns text/event-stream through data: [DONE]. Select the JSON or SSE response example in the code panel.