If you only want to build a demo, almost any image generation API works. If you are running a live app with real users, the question changes. It stops being "which one makes the prettiest picture?" and becomes "which one will still work, at a price I can afford, when thousands of people use it?"
This guide is written for that second question. It is aimed at founders, product people and developers who are picking an image API for something customers will rely on. For a broader look at the models themselves, see our general image API comparison.
The short answer#
- Best default for most apps: OpenAI's current GPT Image models. Strong at following detailed instructions and putting readable text inside images.
- Best for cost control and Google-based stacks: Google's Gemini image models, which have clear per-image prices and half-price batch mode.
- Best for photorealism and regional data control: FLUX from Black Forest Labs, which has separate EU and US endpoints.
- Best for teams that want to tune the model: Stability AI, which is credit-based and negotiates enterprise terms.
- Best strategy overall: one main provider plus a backup, behind a thin layer of your own code so you can switch.
Quality is subjective and changes with every release, so treat that list as a starting point and test your own prompts before you decide. We explain how in the checklist below.
Why production is different from a demo#
In a demo, if an image fails, you click again. In production, a failure is a customer staring at a spinner. These are the things that start to matter:
- Will the model still exist next month? Models get retired.
- What does it cost at 100,000 images a month? Small differences add up fast.
- How many can I make at once? Rate limits and concurrency caps.
- What happens when it fails? Retries and fallbacks.
- Where is the image stored? Many providers delete their copy quickly.
- Can I use it commercially, and is my data safe?
- How do I keep users from generating things I don't want? Moderation.
We take these one at a time.
1. Models get shut down, so plan for it#
This is the biggest surprise for new teams, and it is happening right now.
According to OpenAI's own deprecations page:
| Model | Shutdown date | What OpenAI suggests instead |
|---|---|---|
dall-e-2 | 12 May 2026 (already gone) | GPT Image models |
dall-e-3 | 12 May 2026 (already gone) | GPT Image models |
gpt-image-1 | 23 October 2026 | gpt-image-2.5-sunburst or gpt-image-2.5-flare |
gpt-image-1.5 | 1 December 2026 | gpt-image-2.5-sunburst or gpt-image-2.5-flare |
Google is doing the same thing. Its Gemini pricing page says gemini-2.5-flash-image was scheduled to shut down on 2 October 2026 and points developers to the Gemini 3.1 image models.
What this means for you:
- If your app still calls
dall-e-3, it is already failing. - If it calls
gpt-image-1, you have days, not months. - Never hard-code a model name deep in your code. Keep it in one setting (an environment variable) so a shutdown is a one-line change.
- Subscribe to each provider's changelog or deprecation page, and check it once a month.
2. What it really costs at scale#
Image APIs are priced in confusing ways. Some charge per image, some charge per megapixel (a measure of image size), and some charge per token (the unit AI models use to meter their work). Here is what the providers say themselves, checked on 15 October 2026.
OpenAI (GPT Image)#
OpenAI charges by tokens, not a flat price per image. Its pricing page lists, per 1 million tokens:
| Model | Image output price | Batch price |
|---|---|---|
gpt-image-2 | $30.00 | $15.00 |
gpt-image-2.5-sunburst / -flare | $30.00 | $15.00 |
gpt-image-1-mini | $8.00 | $4.00 |
What that works out to per image depends on the size and quality you ask for. Third-party guides report roughly under one cent for low quality and around 20 cents for high quality at 1024×1024, but those are estimates, so use OpenAI's calculator for your exact case. The takeaway: quality setting is your biggest cost lever. Using "low" for thumbnails and "high" only for hero images can cut a bill dramatically.
OpenAI's Batch option halves the price if your images don't need to arrive instantly. Regional data-residency endpoints for newer models add 10%.
Google (Gemini image models)#
Google publishes clear per-image prices on its Gemini pricing page:
| Model | Standard price per image | Batch price per image |
|---|---|---|
| Gemini 3.1 Flash Lite Image | $0.0336 (1K) | $0.0168 (1K) |
| Gemini Nano Banana 2.1 | $0.0336 (1K), $0.0504 (2K), $0.113 (4K) | about half |
| Gemini 3.1 Flash Image | $0.067 (1K), $0.101 (2K), $0.151 (4K) | about half |
| Gemini 3 Pro Image | $0.134 (1K/2K), $0.24 (4K) | $0.067 (1K/2K) |
For predictable budgeting, this is the easiest pricing to reason about: you can multiply the number of images by the price.
FLUX (Black Forest Labs)#
FLUX uses credits where 1 credit equals $0.01, and the API and playground cost the same. Newer FLUX.2 models are priced by output size in megapixels, while FLUX 3 Image is priced per image by resolution tier (from small squares up to 4K). Third-party guides put smaller FLUX models at around a cent or two per image and premium models at several cents, but the live numbers sit on Black Forest Labs' pricing page, so check there.
Stability AI#
Stability AI sells API usage in credits. Third-party price guides report about one cent per credit, with the Core model at around 3 credits and Ultra at around 8 credits per image. We could not confirm this on Stability's own page, so treat it as a rough guide and confirm on the Stability developer platform. Enterprise contracts are negotiated with their sales team.
How to estimate your monthly bill#
Use this simple formula before you commit:
monthly cost = images per month × price per image × (1 + retry rate)Add 10–20% for retries and regenerations, because users often click "try again." Then decide which images can run in cheaper batch mode, such as catalogue images generated overnight.
3. Rate limits and concurrency#
A rate limit is how many requests you may send in a given time. A concurrency limit is how many can be running at the same moment. Both cause the dreaded 429 Too Many Requests error.
- Black Forest Labs documents 24 concurrent requests on most endpoints, and 6 for
flux-kontext-max, and recommends exponential backoff on 429 errors (wait a little, then a little longer, then longer again). - OpenAI and Google set limits by account tier, which rise as your spend grows. Look in your own dashboard for your numbers rather than trusting a blog.
What to do about it:
- Put image jobs in a queue instead of calling the API straight from a button click.
- Show users a progress state, because image generation takes seconds, not milliseconds.
- Retry only on errors that are worth retrying (429, 500, 503), never on a rejected prompt.
4. Reliability: retries, timeouts and a backup provider#
Every provider has bad days. The cure is not to find a perfect provider, it is to expect failure and handle it.
Here is a simple pattern in JavaScript. It tries your main provider, retries once on a temporary error, and then falls back to a second provider:
// Each provider function takes a prompt and returns image bytes.
const providers = [generateWithOpenAI, generateWithGemini];
async function generateImage(prompt) {
let lastError;
for (const generate of providers) {
for (let attempt = 1; attempt <= 2; attempt++) {
try {
// Never wait forever: give up after 60 seconds.
return await withTimeout(generate(prompt), 60_000);
} catch (error) {
lastError = error;
// Don't retry if the prompt itself was rejected.
if (error.status === 400) break;
// Wait 1s, then 2s before trying again.
await sleep(1000 * attempt);
}
}
}
throw lastError; // Both providers failed: show the user a friendly message.
}Two important details:
- Use the same wrapper for every provider, so the rest of your app never knows which one made the image.
- Log which provider and model made each image. When quality drops or a bill jumps, you will want to know why.
If you are new to how these calls work under the hood, our guides on what a REST API is and API request methods explain the basics. Generating an image is a POST request, and that method is not safe to blindly repeat, so avoid firing duplicate requests when a user double-clicks.
5. Store the image yourself#
This is the mistake that catches the most teams. Many providers do not keep your image for long.
Black Forest Labs, for example, says in its integration guide that result links expire after 10 minutes, that you should not serve them directly to end users, and that browsers can't load them from another site (no CORS). The advice is to download the image immediately and serve it from your own storage.
Do that for every provider:
- Receive the image (a link or raw data).
- Save it to your own storage (for example S3-compatible storage).
- Give your users your own link, usually through a CDN.
It also protects you if you switch providers later, because your old images are still yours.
6. Data location, privacy and commercial use#
For a business app, ask these questions before you pick a provider:
- Where is my data processed? Black Forest Labs offers separate EU (
api.eu.bfl.ai) and US (api.us.bfl.ai) endpoints, as well as a global one that fails over automatically. OpenAI offers regional processing for eligible newer models, at a 10% price uplift. - Are my prompts used to train models? Check each provider's data terms. Business and API terms are usually different from free consumer apps.
- Can I use the images commercially? Usually yes, but read the terms. Some open-weight models carry their own licences.
- Is there legal protection (indemnity)? If someone claims an output copies their work, who pays? Do not assume you are covered. Some published terms run the other way and make the customer responsible. If this matters to your business, get it in writing from the provider's sales team.
We are not lawyers, and this is not legal advice. For anything high-stakes, have a lawyer read the actual contract.
7. Safety and moderation#
If users can type anything, someone will type something you don't want to display. Plan for it:
- Check the prompt before sending it (a simple text moderation step catches a lot).
- Check the image after you receive it, especially if it is shown publicly.
- Handle rejections kindly. Providers refuse some prompts, and your app should explain that in plain words rather than showing an error.
- Keep a report button and a way to remove an image quickly.
Side-by-side comparison#
| OpenAI GPT Image | Google Gemini image | FLUX | Stability AI | |
|---|---|---|---|---|
| Best for | Following detailed prompts, text in images | Predictable cost, batch jobs | Photorealism, regional endpoints | Custom tuning, enterprise deals |
| Pricing style | Per token (varies by quality) | Clear price per image | Credits, per size | Credits |
| Half-price batch | Yes | Yes | Not confirmed | Not confirmed |
| Documented concurrency limit | By account tier | By account tier | 24 (6 on one model) | By account tier |
| EU/US regional option | Yes, +10% | Check Google Cloud options | Yes, EU and US endpoints | Ask sales |
| Model churn risk | High: older models retire in months | High: older models retire in months | Medium | Medium |
Pricing and limits checked against the providers' own pages on 15 October 2026. They change often, so confirm before you budget.
How to choose in one afternoon#
Don't pick from a blog post, including this one. Run a short test:
- Write 20 real prompts from your product. Include the hard ones: text in the image, people, product shots, odd aspect ratios.
- Generate each one on 2–3 providers at the size and quality you plan to use.
- Score them blind. Ask a few teammates which they prefer without telling them which provider made which.
- Record speed and cost for each image.
- Pick a main provider and a backup, then build the fallback wrapper from section 4.
This takes a few hours and saves months of regret.
A production checklist#
Before launch, make sure you can tick every one of these:
- The model name lives in one setting, not scattered through the code
- You are not using any model on a deprecation list
- Requests go through a queue with timeouts and retries
- A second provider is wired in as a fallback
- Every image is saved to your own storage straight away
- You log provider, model, cost and time for each image
- Prompts and images are checked for safety
- You have set a monthly spending limit with each provider
- You have read the commercial-use and data terms
- You check provider changelogs monthly
Summary#
- Image models are retired quickly. DALL-E 3 is already gone and
gpt-image-1shuts down on 23 October 2026. Keep the model name in one setting. - Compare cost at your exact size and quality. Quality is the biggest lever, and batch mode can halve the price.
- Expect failures. Use a queue, timeouts, retries and a backup provider.
- Save every image yourself. Provider links can expire in minutes.
- Check data location, commercial terms and indemnity before you launch, not after.
- Test with your own prompts. The "best" API is the one that works for your images, budget and users.
Using gpt-image-1 today? Follow our step-by-step migration guide before it shuts down on 23 October 2026.
Want to keep exploring? See our general comparison of image generation APIs and our guide to using the OpenAI API, for video, see Runway Gen-4.5 vs Veo 3.1 vs Seedance. Or browse all AI & ML APIs.