How to Generate Images at Scale with the GPT Image 1 API
Once you move past a browser demo, the real question is cost per usable image. GPT Image 1 has an API, and the way you configure it changes the bill by an order of magnitude.
Direct answer: Call the images endpoint with a size and quality parameter, run a small concurrency pool, and default to low quality for drafts and high quality only for finals.
How Do You Make a Basic API Call?
from openai import OpenAI
client = OpenAI()
r = client.images.generate(
model="gpt-image-1",
prompt="flat icon of a paper plane, blue, white background",
size="1024x1024",
quality="low",
n=1)
print(r.data[0].b64_json[:40])
The response returns base64 image data, not a URL, so decode and write it to disk yourself. There is no hosted link to hotlink.
Which Parameters Actually Change the Bill?
| Parameter | Options | Cost impact |
|---|---|---|
| quality | low / medium / high | Largest driver; low is a fraction of high |
| size | 1024×1024, 1024×1536, 1536×1024 | Scales with pixel count |
| n | 1-10 | Linear per image |
Quality dominates. Drafting at low and re-rendering only approved concepts at high is the single biggest saving, and in practice only a small fraction of drafts survive review.
How Do You Run a Batch Without Getting Rate Limited?
Fire requests through a small thread pool rather than one at a time. Four to six concurrent requests is a safe starting point; too many and you hit 429 errors that waste more time than the extra parallelism saves.
from concurrent.futures import ThreadPoolExecutor
def one(p): return client.images.generate(
model="gpt-image-1", prompt=p,
size="1024x1024", quality="low")
with ThreadPoolExecutor(max_workers=5) as ex:
for out in ex.map(one, prompts):
save(out)
Add retry with exponential backoff on 429 and 500 responses. Without it, a burst at the end of a batch silently drops items.
How Do You Keep Prompts Consistent Across Hundreds of Images?
Fix everything that should not vary and template only what should. Build a prompt from a constant style block — “flat vector style, white background, centered subject, no text” — plus a per-item variable. Changing style words halfway through a batch produces images that look like they came from different tools.
Seed control is limited with this model, so “same style” comes from repeated style text, not from a seed number.
What Goes Wrong at Scale?
Three recurring issues. Base64 payloads are large, so naive scripts hold everything in memory and crash on a batch of a few hundred. Content policy rejections surface as errors mid-run — log the prompt and move on rather than crashing the whole job. And retries without backoff amplify rate limits instead of relieving them.
Who Should Use the API — and Who Should Not
Worth it for teams producing asset libraries, ad variants, or catalog imagery. For a handful of images a week, the browser interface is cheaper in time and worry. This is a volume tool; at low volume the engineering overhead beats the savings.
Quick Summary
- Call the images endpoint with
model="gpt-image-1"; responses are base64, not URLs. - Quality is the biggest cost lever — draft low, final high.
- Use a 4-6 worker pool with backoff to avoid 429 errors.
- Template a constant style block for batch consistency.
- The API pays off at volume, not for occasional single images.
