OpenAI API Cost Calculator
Calculate exact OpenAI API costs for GPT-4o, GPT-4, o1, o3 and other models.
OpenAI API pricing model
OpenAI charges per token processed β both the text you send (input/prompt tokens) and the text the model generates (output/completion tokens). Prices vary by model, with newer and more capable models commanding higher rates. Output tokens are typically priced 2β4Γ higher than input tokens, reflecting the additional compute cost of generation.
Cost = (Input tokens Γ Input rate) + (Output tokens Γ Output rate)
Example with GPT-4o ($2.50/1M input, $10/1M output):
Prompt: 800 tokens + Response: 400 tokens
= (800 Γ $2.50/1,000,000) + (400 Γ $10/1,000,000)
= $0.002 + $0.004 = $0.006 per call
At 10,000 calls/day: $60/day = ~$1,800/monthModel selection guide: capability vs. cost
| Use case | Recommended model | Reason |
|---|---|---|
| Customer support FAQ | GPT-3.5 Turbo / GPT-4o Mini | Simple Q&A needs no frontier model; save 10β20Γ cost |
| Code generation | GPT-4o | Strong reasoning and code completion performance |
| Document summarisation | GPT-4o Mini | Good performance at low cost; use for bulk processing |
| Complex reasoning | o1 / o3-mini | Reasoning models for math, science, and logic tasks |
| Real-time chat | GPT-4o | Best latency and quality balance for conversational UX |
| Image understanding | GPT-4o (vision) | Only multimodal model in standard OpenAI lineup |
Cost optimisation strategies
- Use structured outputs. Requesting JSON with a defined schema typically produces shorter, more predictable outputs than prose. Fewer output tokens = lower cost.
- Truncate conversation history. In multi-turn conversations, older messages are charged as input on every request. Summarise or drop early context once it is no longer relevant.
- Use streaming for perceived performance. Streaming does not reduce cost but improves user experience by showing output progressively, reducing perceived latency for high-value use cases.
- Monitor usage with the API dashboard. Set spending limits and alerts to prevent unexpected bills. OpenAI provides per-model usage breakdowns β use them to identify which endpoints account for the most spend.
Frequently asked questions
How is OpenAI API pricing calculated?
Cost is based on tokens for both input and output, at rates that vary by model. This tool multiplies your token counts by the relevant per-token prices.
How many tokens is my text?
On average about 1.3 tokens per English word, or roughly 4 characters per token. 1,000 tokens is about 750 words.
Why does the same task cost different amounts?
Longer prompts, longer responses and more capable models all increase cost. Reducing context and output length lowers the token count and the bill.
How do I estimate monthly API costs?
Multiply the average tokens per request by your expected number of requests, then apply the model's input and output rates. This tool does that math for a single request.
Cost = (Input tokens / 1000 Γ input rate) + (Output tokens / 1000 Γ output rate) Prices per 1K tokens (as of 2025). Always verify at platform.openai.com/pricing as prices change frequently.