CalcEngine All Calculators

OpenAI Cost Calculator

AI & ML

Enter 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

OpenAI Cost — how it works diagram

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

Notes

Frequently Asked Questions

How many tokens is 1,000 words? +
Approximately 1,300–1,500 tokens. OpenAI estimates roughly 750 words per 1,000 tokens for English prose. Code and structured JSON typically tokenise more efficiently. Use the tiktoken library or js-tiktoken for an exact count before making API calls.
Why is output more expensive than input? +
Generating tokens requires significantly more GPU compute than reading them. Most models charge 3–5× more for output. GPT-4o is $2.50/1M input vs $10.00/1M output. Design prompts that produce concise, structured responses to keep output costs down.
Does this calculator work for Claude, Gemini, or other LLMs? +
Yes — any provider using per-million-token billing works with this formula. Enter that model's input and output price and the result is accurate. Anthropic Claude 3.5 Sonnet, Google Gemini 1.5 Pro, and Mistral all use the same billing structure. If you're hitting provider rate limits alongside cost concerns, use the API Rate Limit Calculator to model your throughput.
What is the cheapest OpenAI model for production use? +
GPT-4o mini is the most cost-effective option for most production workloads — classification, extraction, summarisation, and structured output generation. It runs at $0.15/1M input and $0.60/1M output, roughly 17× cheaper than GPT-4o.
How do I count tokens before making an API call? +
Use OpenAI's tiktoken Python library or the js-tiktoken npm package. Both let you tokenise a prompt string locally and get an exact count before sending the request. You can also check the usage field in the API response after each call to audit actual consumption. To estimate how large your JSON request payload will be in bytes before sending, try the JSON Size Calculator.
How much does OpenAI charge per 1,000 tokens? +
GPT-4o costs $0.0025 per 1,000 input tokens and $0.01 per 1,000 output tokens. GPT-4o mini costs $0.00015 per 1,000 input tokens and $0.0006 per 1,000 output tokens. To get the per-thousand rate for any model, divide the per-million price by 1,000 — the pricing table above lists all current models.