The customer’s question: why does the API cap at 32K when ChatGPT does not?
The exchange, anonymised:Customer: Your prompt length is different from ChatGPT’s. Looks like it is capped at 32K. Us: There is a limit. Who has an image job with a 32K prompt? Customer: Plenty. Ad creatives, packaging dimensions… I will just call codex cli myself. Us: To confirm, a 32,000-token prompt? Customer: Yes. 32,000 in English is not long at all.Three different concepts are tangled here. Separate them first:
Where the 32K limit comes from
The official OpenAI Images API limit on theprompt field (same for /v1/images/generations and /v1/images/edits):
developers.openai.com/api/reference/resources/images/methods/generate.
usage.input_tokens_details.text_tokens reports the text tokens actually consumed per call. The same 32,000 characters is about 8K tokens in English and noticeably more in Chinese, where each character maps to more tokens and also carries more information. So “32K English is short” and “32K Chinese is long” can both be true.
Why the ChatGPT web app looks unlimited
Same point as How to Get Satisfying Images and Safety Rejections: the web app is an agent, the API is a single atomic call.- Paste a long document into ChatGPT and the reader is the chat model, not the image model. Having read it, the chat model writes its own short image prompt and calls the image tool with that. The image model never sees the original material. Pastes over 10,000 characters are even turned into attachments automatically (OpenAI Help Center,
help.openai.com), which makes it plain that the text is for the chat model. - Through the API you talk to the image model directly. Nobody reads the material and makes choices for you in between. The limit belongs to the image model layer, and the web app never exposes the image model to it.
- The customer’s parting line, “I will just call codex cli myself”, is the right instinct: have a text model read the material and produce the image prompt. That is exactly what the web app does behind the scenes, and the two-stage pipeline below makes it runnable.
The two costs of a long prompt
Money first, then results. Money: text input on the gpt-image family is billed per token ($5.00 per million tokens ongpt-image-2.5, see the overview pricing table). A 32,000-character English prompt is about 8K tokens, roughly $0.04 per call; Chinese costs more. Small on its own, but multiply by the number of images, and every retry pays it again. When 90% of the prompt is raw material rather than scene description, most of that spend buys nothing.
Results: more detail does not mean better adherence. Put hundreds of requirements in front of an image model at once and they compete; the hard constraints that actually matter (logo not distorted, packaging text exact, number of people) are the ones that get buried. OpenAI’s own guidance for image prompts is to start with one to three clear sentences and then add the necessary composition, lighting and hard constraints (openai.com/academy/image-generation). What the image model needs is information density with clear priorities, not word count.
So “professional ads have many requirements” is true, but detailed is not the same as long. The six elements in Advanced Image Generation and the “do not pad the prompt with adjectives” rule in the Image Prompt Doctor Skill say the same thing.
Two stages: material into a text model, prompt into the image model
When there really is 32K of material behind an image job, it is usually a brand book, packaging spec, ad brief or character bible. That material should go to a text model first, which distills it into one dense prompt for the image model:Hand the material to the text model as-is
Run the prompt through a length gate
len(prompt); if it exceeds 32,000, have the text model compress once more. A distilled prompt is normally one or two thousand characters, so this step is a safeguard.Store the prompt, then call the image model
When the material changes, re-run only stage one
When a long prompt is genuinely needed
A few cases do make prompts longer, but none of them get anywhere near 32K:- Multi-image editing: refer to reference images as “image 1 / image 2 / image 3” and say what to take from each. A few hundred characters.
- Text inside the image: signage, posters, packaging copy must be given verbatim rather than left to the model. Tens to hundreds of characters.
- A shared prefix for a series: the style, lighting and composition block common to a batch. Under a thousand characters.
Quick reference
- 32,000 characters is the official OpenAI Images API limit, counted in characters not tokens, identical for
/generationsand/edits; APIYI’s official relay does not tighten it. - Characters, tokens and context window are three different things: 32K English is about 8K tokens, Chinese is more; a text model’s context window has nothing to do with the image model’s prompt limit.
- “No limit” on the web app is an illusion: the chat model reads the material and writes its own short prompt for the image tool; the image model never faces the 32K.
- Detailed is not long: text input is billed per token and every retry pays again; hundreds of competing requirements bury the hard constraints.
- Two stages: distill the material with a text model into a 1K to 3K character structured prompt, hard constraints first, persist it, and replay only the prompt for generation.