🤖 OpenAI API Cost Calculator
API bills scale with tokens. Pick your model, enter token volumes, and see exactly what OpenAI will charge.
How OpenAI API Pricing Works
OpenAI charges per million tokens, split into cheaper input tokens (your prompt) and pricier output tokens (the completion). Roughly: 1 token ≈ ¾ of an English word, so 1,000 words ≈ 1,333 tokens.
The Formula
Output tokens cost 2–4× input tokens because generation is compute-heavy. The mini models are 10–30× cheaper than flagships — most apps should prototype on the flagship, then downgrade per endpoint after quality testing. Prompt caching (50%+ off repeated prefixes) and batch API (50% off, slower) cut bills further. Prices change; verify on OpenAI's pricing page.
Worked Example
GPT-4o ($2.50 in / $10 out per 1M) with 2M input and 1M output tokens/month: input = 2 × $2.50 = $5.00, output = 1 × $10 = $10.00, total $15.00/month. Across 100,000 requests that is $0.00015/request — fifteen-hundredths of a cent. Switching to GPT-4o mini would cut it to about $0.90.
Cutting Your API Bill in Half
Four levers, in order of impact. Model routing: send simple tasks (classification, extraction, moderation) to mini models and reserve flagships for hard reasoning — most production workloads are 80%+ routable, cutting bills 5–10×. Prompt caching: stable system-prompt prefixes get 50%+ discounts automatically once cached; design prompts with static prefixes and dynamic suffixes. Batch API: non-urgent workloads (evals, bulk classification, data processing) cost 50% less with 24-hour turnaround. Token discipline: cap max_tokens, strip verbose system prompts, summarize conversation history instead of resending full transcripts. The professional workflow: prototype on the flagship, build evals, then downgrade per endpoint until quality drops — your bill is the sum of per-endpoint optima, not one model choice.
Budget guardrails: set per-key monthly spend limits in the OpenAI dashboard, add usage alerts at 50% and 80%, and log per-endpoint token consumption from day one. Most billing surprises come from one unmonitored endpoint (usually chat history growing unbounded) — visibility is cheaper than any optimization.
Frequently Asked Questions (FAQs)
How much does the GPT-4o API cost?
About $2.50 per million input tokens and $10 per million output tokens. A typical short chat request (500 in / 200 out) costs roughly $0.003.
What is the cheapest OpenAI model?
The mini models (GPT-4o mini, GPT-4.1 mini) at ~$0.15–$0.40 input per 1M tokens — roughly 15× cheaper than flagships, and sufficient for classification, extraction, and simple chat.
Do cached tokens cost less?
Yes — OpenAI's prompt caching discounts repeated prompt prefixes by 50%+ automatically once cached. Design prompts with stable prefixes to maximize cache hits.
Input vs output tokens — which costs more?
Output tokens, typically 2–4× the input price. Long generations (reports, code) dominate bills — constrain max_tokens where quality allows.
How do I reduce my OpenAI API bill?
Use mini models where quality suffices, enable prompt caching, use the Batch API for offline work (50% off), trim system prompts, and set max_tokens caps.
Last updated: September 2026