OpenAI Cost Calculator
AI & MLEnter your token counts and model pricing to get an instant cost breakdown. Works with GPT-4o, o1, GPT-3.5, and any per-token LLM provider.
Last updated: April 2026
This calculator is designed for real-world usage based on typical engineering scenarios and publicly available documentation.
OpenAI bills API usage per token — separately for input (your prompt) and output (the model's response). Input and output rates differ per model, and costs compound fast at production scale. This calculator gives you the exact dollar amount for a single call or a projected batch. Use it to compare model costs before committing, budget a high-volume workflow, or sanity-check a surprisingly large bill. The formula works for any provider using per-million-token billing — Anthropic Claude, Google Gemini, Cohere, Mistral — just plug in that model's rates.
How to Calculate OpenAI API Cost
1. Find your model's input and output price per 1M tokens on the OpenAI pricing page. 2. Count your prompt tokens — system message + user message combined. Use tiktoken or the API's usage field. 3. Count your output tokens — the length of the model's response. 4. Plug both counts and both prices into the calculator above. 5. Multiply out: (input tokens ÷ 1,000,000) × input price + (output tokens ÷ 1,000,000) × output price.
Formula
Total Cost = (Input Tokens ÷ 1,000,000) × Input Price
+ (Output Tokens ÷ 1,000,000) × Output Price
Input Tokens — tokens in your prompt (system + user message)
Output Tokens — tokens in the model's response
Input Price — cost per 1M input tokens (e.g. $2.50 for GPT-4o)
Output Price — cost per 1M output tokens (e.g. $10.00 for GPT-4o) Example Cost Calculations
Example 1 — GPT-4o chat call
Input: 2,000 tokens × $2.50 / 1M = $0.005000
Output: 800 tokens × $10.00 / 1M = $0.008000
─────────────
Total per call: $0.013000 → $13.00 per 1,000 calls Example 2 — GPT-4o mini at scale (high-volume classification)
Input: 1,500 tokens × $0.15 / 1M = $0.000225
Output: 500 tokens × $0.60 / 1M = $0.000300
─────────────
Total per call: $0.000525 → $0.525 per 1,000 calls → ~$15.75 / month at 30k calls/day Example 3 — o1 reasoning task (use sparingly)
Input: 5,000 tokens × $15.00 / 1M = $0.075000
Output: 3,000 tokens × $60.00 / 1M = $0.180000
─────────────
Total per call: $0.255000 → $255.00 per 1,000 calls OpenAI Pricing by Model
| Model | Input / 1M tokens | Output / 1M tokens |
|---|---|---|
| GPT-4o | $2.50 | $10.00 |
| GPT-4o mini | $0.15 | $0.60 |
| o1 | $15.00 | $60.00 |
| o1 mini | $3.00 | $12.00 |
| o3 mini | $1.10 | $4.40 |
| GPT-4 Turbo | $10.00 | $30.00 |
| GPT-3.5 Turbo | $0.50 | $1.50 |
Prices are approximate. Verify on your provider's pricing page before budgeting.
Tips to Reduce OpenAI API Cost
- › Use GPT-4o mini for classification, extraction, and summarisation tasks — it costs 17× less than GPT-4o with comparable accuracy on structured outputs.
- › Cache your system prompt. Prompt caching (available on GPT-4o and o1) charges cached input at a 50% discount after the first call.
- › Trim your prompts. Every unnecessary sentence in a system message multiplies across every call. Audit and cut regularly.
- › Batch non-urgent requests with the Batch API — OpenAI charges 50% less for async batch jobs with a 24-hour turnaround.
- › Stream responses and stop early. If you only need the first part of a long generation, streaming lets you cancel before the full output token count runs up.
- › Log and monitor token usage via the API response's usage field. Set up alerts when daily spend exceeds a threshold in the OpenAI usage dashboard.
Notes
- › Results are estimates and may vary based on actual usage.
- › Always validate against your production environment.