AI Image Generation API Pricing: OpenAI, FLUX and More (2026)
If you are building an app that generates images, provider pricing is difficult to compare. Some APIs charge by tokens, some by image, some by megapixel, and others by compute time or credits.
The range is staggering: from $0.002 per image (self-hosted Stable Diffusion) to $0.20+ per image (Midjourney API). That is a 100x difference for outputs that are increasingly similar in quality.
This guide compares selected developer options and explains how to build a defensible estimate. It is research-based, not a controlled hands-on benchmark of every provider; verify the live vendor calculator for your resolution and quality settings before budgeting.
ChatGPT Images 2.5 and the API: what changed
OpenAI released ChatGPT Images 2.5 on September 8, 2026 across ChatGPT, ChatGPT Work, and Codex. The developer release is related but uses two explicit API models rather than a generic chatgpt-images-2.5 identifier:
| API model | Best fit | Published token pricing |
|---|---|---|
gpt-image-2.5-flare | Default for fast, high-quality generation and editing | $5/M text input, $1.25/M cached text input, $8/M image input, $2/M cached image input, $30/M image output |
gpt-image-2.5-sunburst | Premium workflows where editing precision matters more than latency | Same published token rates as Flare |
Both accept text and image inputs and produce image output through the Images API or the Responses API image-generation tool. OpenAI also publishes dated snapshots ending in -2026-09-08. The API free tier is not supported; account-tier rate limits apply.
The product and API changes should not be conflated. ChatGPT adds Sketch, templates, image comments, and prompt sharing. The API models add the underlying generation and editing improvements, but those ChatGPT interface features are not separate API endpoints.
OpenAI reports up to 50% lower generation latency for Flare versus GPT-Image-2, along with improved reference-image fidelity, targeted edits, multi-turn consistency, transparent backgrounds, lighting, textures, and complex layouts. That is a vendor claim rather than a guarantee for every prompt, so test your own representative assets before migrating production traffic.
Migration implications
There is no announced forced migration from GPT-Image-2. Existing applications can evaluate Flare for lower-latency general workloads and Sunburst for precision editing, then pin the dated model snapshot when reproducibility matters. Do not estimate image cost by applying GPT-Image-2’s calculator: OpenAI states that the token rates match, but token consumption for the 2.5 models is not estimated by that calculator.
Official references: OpenAI’s Images 2.5 announcement, Flare model documentation, and Sunburst model documentation.
Selected pricing examples (September 2026)
| Provider | Model | Pricing basis | Important caveat |
|---|---|---|---|
| Self-hosted | SDXL/FLUX variants | Infrastructure and electricity | Cost depends on hardware, utilization and operations |
| fal.ai | FLUX variants | Model-specific image or compute pricing | Check the exact endpoint and image settings |
| Replicate | FLUX and other models | Model-specific compute/output pricing | Runtime and version affect cost |
| OpenAI | GPT-Image-2.5 Flare / Sunburst | Text and image tokens | Actual image cost varies with token consumption |
| xAI | Grok Imagine Image 2.0 | Check current API documentation | Consumer availability does not prove API availability |
| Ideogram | Current image models | Plan/API-specific | Verify model, resolution and tier |
Note: DALL-E 3 was deprecated in May 2026. If you are still using it, migrate to GPT-Image-1 immediately.
Note on Grok Imagine Image 2.0: as of this update, Image 2.0 is live in Quality Mode on grok.com/imagine and the Grok iOS/Android apps, but xAI has not yet published standalone per-image API pricing for developer access, xAI says API access is “coming soon.” We’re listing it here for completeness, not as a current developer option. See the dedicated section below.
Tier 1: Self-Hosted ($0.002 to $0.005 per image)
If you have GPU infrastructure, self-hosting is 10 to 50x cheaper than any API. The math is simple:
Cost calculation for self-hosted SDXL on an RTX 4090:
- GPU server rental: ~$0.50/hour (or amortized cost of your own hardware)
- Images per hour: 200+ (SDXL Turbo at 4 steps)
- Cost per image: $0.50 / 200 = $0.0025
When self-hosting makes sense:
- You generate 1000+ images per day
- You need custom models or LoRAs
- Latency requirements under 2 seconds
- Data cannot leave your infrastructure
- You already have GPU infrastructure
When it does not make sense:
- Generating fewer than 100 images per day (API is simpler)
- You do not have DevOps capacity to maintain GPU servers
- You need multiple model architectures (APIs let you switch instantly)
For a complete guide on running image generation locally, check my how to run FLUX locally guide. Understanding VRAM requirements is essential before committing to self-hosting.
Tier 2: Budget APIs ($0.004 to $0.01 per image)
ModelsLab: $0.0047/image
The cheapest hosted option I found that actually works reliably. ModelsLab offers SDXL and FLUX models through a standard REST API.
Pros: Cheapest hosted option, decent quality, simple API Cons: Higher latency (3 to 8 seconds), occasional queue times during peak hours, fewer model options
Stability AI: $0.006/image
Stability’s own API is surprisingly affordable. Their Stable Image Ultra model produces good results for the price.
Pros: Official Stability models, consistent quality, good documentation Cons: Limited to Stability’s model family, no FLUX access
Tier 3: Best Quality/Price ($0.01 to $0.05 per image)
This is the sweet spot for most developers. You get near-frontier quality without breaking the bank.
fal.ai + FLUX: $0.01 to $0.04/image (my top recommendation)
fal.ai is the API I recommend for most developers. Here is why:
- Runs FLUX.2 [dev] and FLUX.2 [schnell] (the best open models)
- Pay-per-use pricing with no minimum spend
- Fast inference (3 to 7 seconds per image)
- Excellent developer experience with SDKs for Python, TypeScript, and Go
- Supports img2img, inpainting, ControlNet, and LoRAs
Code example (TypeScript):
import { fal } from "@fal-ai/client";
fal.config({ credentials: process.env.FAL_KEY });
const result = await fal.subscribe("fal-ai/flux-pro/v1.1", {
input: {
prompt: "A developer workspace with multiple monitors showing code, photorealistic, soft lighting",
image_size: "landscape_16_9",
num_inference_steps: 28,
guidance_scale: 3.5,
},
});
console.log(result.data.images[0].url);
// Cost: ~$0.03 for this generation
Replicate + FLUX: $0.02 to $0.05/image
Replicate charges by compute time rather than per image. A typical FLUX.2 generation takes 5 to 12 seconds on their hardware at $0.003/second.
Code example (Python):
import replicate
output = replicate.run(
"black-forest-labs/flux-dev",
input={
"prompt": "A developer workspace with multiple monitors showing code, photorealistic, soft lighting",
"width": 1024,
"height": 1024,
"num_inference_steps": 28,
"guidance_scale": 3.5
}
)
print(output[0])
# Cost: ~$0.03 for this generation
OpenAI GPT-Image-2.5: token-priced generation and editing
Flare and Sunburst use token pricing rather than one universal per-image amount. Resolution, quality, input images, and the model’s actual token consumption affect cost. Flare is the sensible first evaluation for general product workflows; Sunburst targets jobs where editing precision justifies longer generation time.
Tier 4: Premium ($0.05 to $0.20 per image)
Midjourney API: ~$0.08/image
Midjourney’s API access is still limited (requires enterprise tier or partner access). When available, it produces arguably the highest aesthetic quality. But at $0.08/image and limited availability, it is hard to recommend for most production use cases.
Ideogram v3: $0.05/image
Ideogram specializes in text rendering in images. If you need generated images with accurate text (logos, posters, UI mockups), Ideogram is the best option regardless of price.
Grok Imagine Image 2.0: no developer pricing yet
xAI shipped Grok Imagine Image 2.0 on August 7, 2026, as the new “Quality Mode” inside Grok Imagine on the web and mobile apps. It’s worth tracking even though it’s not yet a viable API option for most developers.
What xAI has confirmed directly (via x.ai’s own announcement):
- Instruction following: xAI says the model follows detailed instructions closely, including small details, and “plans typography and layout the way a designer would” for dense, multi-part compositions
- Text rendering: Small text in generated images is a specific focus area
- Content preservation: The model preserves user-supplied elements across multiple generations and edits, useful for iterative design work
- Editing tools: A magic wand tool for targeted region edits, segmentation for precise area selection, and background removal with transparency export
- Ranking: xAI cites an independent Arena leaderboard placing Image 2.0 at #2 on public text-to-image and image-editing rankings, behind OpenAI’s GPT-Image-2. This is a third-party ranking xAI is citing, not a self-reported benchmark, but it’s still worth verifying against the live leaderboard yourself since these rankings shift.
What’s not yet available: xAI states API access for Image 2.0 is “coming soon” but has not published per-image or per-token developer pricing as of this writing. Today, Image 2.0 is a consumer feature (grok.com/imagine, Grok iOS/Android) rather than a developer API you can integrate. If you’re budgeting for an image API today, it’s not yet a comparable line item to the providers in the pricing table above, check back once xAI publishes API pricing.
Cost Comparison for Real Workloads
Let me put these numbers in context with realistic usage scenarios:
Blog with AI-generated cover images (30 images/month):
| Provider | Monthly Cost |
|---|---|
| Self-hosted | $0.06 to $0.15 |
| ModelsLab | $0.14 |
| fal.ai FLUX | $0.30 to $1.20 |
| OpenAI GPT-Image-1 | $1.20 |
| Midjourney | $2.40 |
E-commerce product mockups (1000 images/month):
| Provider | Monthly Cost |
|---|---|
| Self-hosted | $2 to $5 |
| ModelsLab | $4.70 |
| fal.ai FLUX | $10 to $40 |
| OpenAI GPT-Image-1 | $40 |
| Midjourney | $80 |
AI app with user-generated images (10,000 images/month):
| Provider | Monthly Cost |
|---|---|
| Self-hosted | $20 to $50 |
| ModelsLab | $47 |
| fal.ai FLUX | $100 to $400 |
| OpenAI GPT-Image-1 | $400 |
| Midjourney | $800 |
At 10,000+ images per month, self-hosting becomes overwhelmingly economical. The breakeven point where self-hosting beats fal.ai is around 3000 to 5000 images per month, depending on your GPU costs.
Choosing the Right API
Choose fal.ai if: You want the best quality-to-price ratio with minimal setup. FLUX.2 models produce excellent results and fal.ai’s pricing is competitive. Best for startups and indie developers.
Choose self-hosted if: You generate 5000+ images per month, need sub-2-second latency, or have data privacy requirements. Requires GPU infrastructure knowledge.
Choose OpenAI if: You are already in the OpenAI ecosystem and want one API for everything (text, code, images). Convenient but 2 to 4x more expensive than fal.ai for comparable quality.
Choose Replicate if: You want access to many different models (not just FLUX) and do not mind slightly higher prices for the flexibility.
Choose Stability AI if: Budget is your primary concern for hosted APIs and SDXL quality is acceptable.
Integration Tips for Developers
1. Always implement retry logic
Image generation APIs have higher failure rates than text APIs. Implement exponential backoff:
async function generateWithRetry(prompt: string, maxRetries = 3) {
for (let i = 0; i < maxRetries; i++) {
try {
return await generateImage(prompt);
} catch (error) {
if (i === maxRetries - 1) throw error;
await new Promise(r => setTimeout(r, 1000 * Math.pow(2, i)));
}
}
}
2. Cache aggressively
If the same prompt might be submitted twice, cache the result. Image generation is expensive enough that even a 10% cache hit rate saves meaningful money.
3. Use webhooks for production
Most APIs support webhook callbacks for when generation completes. Do not poll. Polling wastes your server resources and can hit rate limits.
4. Optimize prompt length
Longer prompts do not always produce better images but they do cost more on per-token APIs. Keep prompts under 200 words for best results.
Migration Guide: DALL-E 3 to GPT-Image-1
Since DALL-E 3 was deprecated in May 2026, here is the quick migration path:
// Old DALL-E 3 call
const response = await openai.images.generate({
model: "dall-e-3",
prompt: "A cat sitting on a laptop",
size: "1024x1024"
});
// New GPT-Image-1 call (nearly identical)
const response = await openai.images.generate({
model: "gpt-image-1",
prompt: "A cat sitting on a laptop",
size: "1024x1024"
});
The API interface is almost identical. The main differences: GPT-Image-1 supports transparent backgrounds, has better prompt adherence, and costs the same as DALL-E 3 did.
How This Relates to Your AI Dev Workflow
If you are already using AI coding tools like those covered in the best AI coding tools guide, image generation APIs fit naturally into your development workflow for:
- Generating placeholder images during development
- Creating blog post cover images (like this site does)
- Building AI-powered features for end users
- Prototyping UI designs with AI-generated mockups
For developers using OpenRouter for LLM access, note that OpenRouter does not currently route image generation requests. You will need a separate image API account. Similarly, if you are running Ollama for local LLM inference, you can complement it with local image generation via ComfyUI for a fully local AI development pipeline. The how to reduce LLM API costs guide principles apply to image APIs too: route to the cheapest option that meets your quality bar.
FAQ
Which API has the best image quality in 2026?
For photorealistic images, Midjourney v7 and FLUX.2 [dev] are neck and neck. For prompt adherence and text in images, GPT-Image-1 and Ideogram lead. For artistic styles, Midjourney still has an edge. There is no single “best” since it depends entirely on your use case.
Is it worth self-hosting for a small project?
No. If you generate fewer than 1000 images per month, the operational overhead of maintaining GPU infrastructure outweighs the savings. Use fal.ai or Replicate and switch to self-hosted when volumes justify it. The how much VRAM for AI guide covers what hardware you would need.
Can I use these APIs for commercial projects?
Yes, all APIs listed here grant you commercial rights to generated images. Self-hosted FLUX.2 [dev] requires attribution. FLUX.2 [klein] (Apache 2.0) and [schnell] have no restrictions. Always check the specific model license for self-hosted options.
How do I handle NSFW filtering in production?
Most APIs (OpenAI, fal.ai, Stability) have built-in NSFW filters. Self-hosted gives you full control. If building a consumer product, implement your own content moderation layer regardless of what the API filters. Do not rely solely on provider-side filtering.
What about video generation pricing?
Video generation is significantly more expensive, ranging from $0.09 to $4.20 per second of generated video. Check the AI video generation API pricing guide for the full breakdown. The cost structure is fundamentally different from images and requires separate budgeting.
Is Grok Imagine Image 2.0 available as a developer API?
Not yet as of this update. xAI says API access is “coming soon” but has not published per-image pricing. Today it’s a consumer feature inside the Grok apps and grok.com/imagine, not a comparable line item to the APIs in the pricing table above. We’ll update this guide once xAI ships developer pricing.