Skip to main content
TokenAtlas

The OpenAI API Cost Guide

Everything that affects your OpenAI bill — and how to forecast it before you ship.

Pricing by model family

GPT-4o family ($2.50/$10), GPT-4.1 family ($2/$8), GPT-4o-mini ($0.15/$0.60), GPT-3.5-turbo ($0.50/$1.50), fine-tuned variants priced at a premium. Per 1M tokens.

Discounts that actually move the bill

Prompt caching: 50% off cached input. Batch API: 50% off everything, 24h SLA. Scale Tier: predictable throughput at slight discount. Stack them where applicable.

Forecasting your bill

Build three scenarios: today's volume, 3-month projection, year-end. Multiply by token rate. Add 15% buffer for retries, errors, and prompt drift.

Common cost mistakes

Not caching long system prompts. Streaming when batch would work. Using GPT-4o for tasks Haiku handles. Logging full payloads into a model. Each is a 20–80% cost leak.

Worked example: routing a support bot

Assume 100K calls/month, 4K input + 600 output tokens each, 70/30 blended split roughly matches this ratio. On GPT-4o ($2.50/$10 per 1M): input = 100K*4K=400M tokens * $2.50/1M = $1,000; output = 100K*600=60M tokens * $10/1M = $600. Total ≈ $1,600/month. Swap to GPT-4o mini ($0.15/$0.60): input $60, output $36, total ≈ $96/month — a 16.7x gap driven entirely by model choice, not volume.

How context re-billing inflates a chat thread

Chat-style APIs are stateless: every turn re-sends the full prior transcript as input tokens. A 10-turn conversation with a 500-token running history costs roughly 10x the single-turn input, not 1x, because each call re-bills everything before it. This is separate from output cost and is the most commonly underestimated line item in a forecast.

Decision checklist before picking a model tier

— Does the task tolerate 24h latency? If yes, Batch API halves cost. — Is the system prompt reused across calls? If yes, caching is worth wiring. — Can a smaller model hit the same task accuracy? Test GPT-4o mini first. — What is the output token ceiling — is max_tokens capped? — Have you modelled retries and error rates as a separate cost line?

Sanity-checking your invoice against a model

Take your actual monthly invoice total and divide by your logged call count and known input/output split to back out an implied blended rate per 1M tokens. Compare that to the published $2.50/$10 (GPT-4o) or $0.15/$0.60 (mini) rates weighted 70/30. A gap of more than 10-15% usually means your assumed model or cache-hit rate is wrong, not that the provider misbilled you.

Frequently asked questions

How often does OpenAI change prices?
Roughly 2-3 times per year, almost always downward.
Is the Batch API safe for production?
Yes for non-realtime workloads. 24h max latency, identical quality.
How do I monitor cost?
OpenAI's dashboard is delayed; use TokenAtlas for per-user/per-feature attribution.

Related