NOTACAL logo

LLM API Cost Calculator

LLM API Cost Calculator

Give us your feedback! Was this useful?

Understanding LLM API Pricing

Every major AI provider charges by token, but the pricing structure goes deeper than a simple per-million-token rate. Costs depend on model tier, input vs output mix, caching, batch discounts, and — critically for modern applications — the number of agentic iterations your workflow performs.

The fundamental cost of a single API call is:

Ccall=Ni×Pi+No×PoC_{\text{call}} = N_i \times P_i + N_o \times P_o
[openai-pricing]

Where NiN_i is input tokens, NoN_o is output tokens, PiP_i is input price per token, and PoP_o is output price per token. Output tokens are 3-6x more expensive than input tokens across all providers because generation requires sequential autoregressive inference, while input encoding can be parallelized[anthropic-pricing].

For an agentic workflow with kk turns (tool calls, reasoning steps, revisions):

Cagent=i=1k(Ni,i×Pi+No,i×Po)C_{\text{agent}} = \sum_{i=1}^{k} \left(N_{i,i} \times P_i + N_{o,i} \times P_o\right)

A single agentic task with 4 tool calls costs approximately 4x a simple chat completion for the same final content — before accounting for the tool responses themselves, which add input tokens to each subsequent turn.

Model Pricing Breakdown

As of July 2026, the competitive landscape spans four major providers[deepseek-pricing]:

ModelInput ($/1M tokens)Output ($/1M tokens)200K+ SurchargeCached Input
GPT-5.6 Sol$5.00$30.00No$0.50
GPT-5.6 Terra$2.50$15.00No$0.25
GPT-5.6 Luna$0.20$1.20No$0.02
Claude Opus 5$5.00$25.00No$0.50
Claude Sonnet 5$2.00$10.00No$0.20
Claude Haiku 4.5$1.00$5.00No$0.10
Gemini 3.6 Flash$1.50$7.502x >200KN/A
Gemini 2.5 Pro$1.25$10.002x >200KN/A
DeepSeek V4 Pro$0.435$0.87NoN/A
DeepSeek V4 Flash$0.14$0.28NoN/A

Note that Gemini applies a 2x surcharge on prompts exceeding 200K tokens, making it more expensive than the base rate suggests for long-context tasks[google-pricing].

Output pricing per million tokens across 10 models. The spread from $0.28 (DeepSeek V4 Flash) to $30.00 (GPT-5.6 Sol) represents a 107x difference. Cached input pricing reduces effective costs by 90% on applicable models.

The price gap between frontier and budget models has widened dramatically. GPT-5.6 Sol output at $30/M is 107x more expensive than DeepSeek V4 Flash at $0.28/M. Yet for many tasks — classification, formatting, simple Q&A — users report indistinguishable quality between these tiers[openai-pricing]. The art of cost optimization lies in matching the right model to the right task.

Agentic AI Cost Multipliers

Agentic workflows are the dominant growth driver in LLM spending, and they multiply costs in ways traditional chat completions do not. Understanding the cost structure of agentic systems requires modeling three compounding factors.

First, tool call overhead. Each time an agent calls a tool, the tool's response becomes input tokens for the next model turn. A database query returning 50 KB of results consumes approximately 12,500 input tokens per call. With 10 tool calls per task, that is 125,000 input tokens just from tool responses. This is before any reasoning, planning, or output generation.

Second, reasoning chains. Agentic systems generate intermediate reasoning steps that are not visible to the end user but consume output tokens. These reasoning chains vary by model: deep reasoning models like GPT-5.6 Sol generate extensive chain-of-thought before responding, sometimes 2-4x the visible output[anthropic-pricing]. Budget models like DeepSeek V4 Flash generate minimal reasoning, which reduces output costs but may reduce accuracy on complex tasks.

Third, failure and retry cycles. Agentic tasks fail more often than chat completions because the agent depends on external tools that can time out, return errors, or produce unexpected results. Every retry doubles the token consumption for that turn.

The effective cost of an agentic task can be expressed as:

Ceffective=Cbase×k×(1+r)×freasoningC_{\text{effective}} = C_{\text{base}} \times k \times (1 + r) \times f_{\text{reasoning}}
[anthropic-cache]

Where kk is the number of agent turns, rr is the retry rate (typically 5-15%), and freasoningf_{\text{reasoning}} is the reasoning multiplier (1.5-4x depending on the model).

Tool and Environment Cost Comparison

The same model running in different environments produces vastly different cost profiles because each environment injects system prompts, manages conversation state, and handles tool integrations differently[anthropic-cache].

EnvironmentSystem Prompt OverheadAgent Loop OverheadMonthly Premium (5K tasks/day)
Raw OpenAI API0 tokens0 tokens$0 (base)
ChatGPT Plus~600 tokensNo tool calls$20 fixed
Claude Code~1,200 tokens2-4 tool calls/task~$150
OpenCode~1,800 tokens3-8 tool calls/task~$350
OpenClaw~1,500 tokens2-5 tool calls/task~$280
Cursor Agent~2,000 tokens5-15 tool calls/task~$450

Consider a concrete scenario: a developer performing 5,000 code review tasks per month using GPT-5.6 Terra. Each task processes 5,000 tokens of code and generates 1,500 tokens of review.

  • Raw API: (5,000 × $2.50/1M + 1,500 × $15.00/1M) × 5,000 = $62.50 + $112.50 = $175/month
  • Claude Code: Same token consumption + 1,200 system prompt overhead + 3 tool calls at ~800 tokens each = 8,600 tokens input + tool responses. Cost: (8,600 × $2.50/1M + 1,500 × $15.00/1M) × 5,000 = $107.50 + $112.50 = $220/month (26% premium)
  • Cursor Agent: 2,000 system prompt + 8 tool calls at ~1,000 tokens each = 15,000 tokens input. Cost: (15,000 × $2.50/1M + 1,500 × $15.00/1M) × 5,000 = $187.50 + $112.50 = $300/month (71% premium)

The premium is not wasted — it pays for features like MCP server integration, file system awareness, and autonomous debugging. But it must be budgeted for.

Cost Optimization Strategies

Model routing is the highest-leverage optimization. Instead of using one model for all tasks, route simple queries to budget models and complex queries to frontier models. A two-tier system where 80% of requests hit DeepSeek V4 Flash ($0.14/$0.28) and 20% hit GPT-5.6 Sol ($5.00/$30.00) costs roughly 3% of an all-Sol approach for the same task volume[deepseek-pricing].

Prompt caching reduces input costs by 90% on cached prefixes. If your application uses a system prompt that is identical across requests, configure the cache and reuse the same prefix. GPT-5.6 charges $0.50/M for cached input instead of $5.00/M for Sol, and Claude charges $0.50/M instead of $5.00/M for Opus 5[anthropic-cache].

Batch processing offers 50% discounts at OpenAI for non-real-time workloads. Submit a batch of requests and receive results within 24 hours at half the price[openai-batch]. For nightly data processing, report generation, or bulk content analysis, batch APIs cut costs dramatically.

Agent turn minimization is specific to agentic workloads. Each unnecessary tool call costs money. Profile your agent's behavior and remove redundant or low-value tool invocations. If an agent calls a web search tool before checking whether the answer is already in context, that is a wasted turn.

Monitor environmental overhead. If you use OpenCode or Cursor, measure the actual system prompt overhead by comparing token counts in the API dashboard vs your estimated content token count. Environmental overhead runs 500-3,000 tokens per conversation and is invisible to the user but visible on your bill.

Limitations

  • No multi-provider discounts: The calculator assumes list prices. Enterprise agreements, reserved capacity, and volume discounts are not included.
  • No batch pricing modeling: Batch API discounts of 50% at OpenAI are not reflected in the per-request estimates. Use batch for non-real-time workloads.
  • Reasoning multiplier is averaged: Deep reasoning models may produce 2-4x the output cost of their stated per-token rate due to internal chain-of-thought. The agentic multiplier is an approximation.
  • Tool overhead varies: MCP server response sizes vary dramatically by tool and provider. A file read returns 10 tokens; a database query returns 10,000. The model assumes average tool response sizes.
  • No caching benefit in base estimates: Prompt caching discounts of 90% apply only to cached prefixes. First-time requests pay full price. The calculator models full-price requests.
  • No self-hosting: Models like DeepSeek V4 are open-weight and can be self-hosted to eliminate per-token costs entirely. Capital expenditure and operational costs are not compared here.

Frequently Asked Questions

Which model is cheapest for high-volume classification tasks?
DeepSeek V4 Flash at $0.14/$0.28 per million tokens is the cheapest commercial option. For self-hosted scenarios, any open-weight model eliminates per-token costs entirely but incurs infrastructure expenses.
How does agentic loop overhead change cost estimates?
Each agent turn consumes tokens independently. A 5-turn agentic task costs roughly 5x a single chat completion plus tool response tokens. Plan for 3-10x multiplier when migrating from chat to agentic workflows.
Is prompt caching worth configuring?
Yes. If your system prompt is identical across requests, caching reduces input costs by 90% on applicable models. For a 500-token system prompt across 10K daily requests on GPT-5.6 Sol, caching saves $22.50/day in input costs.
Should I use the same model in raw API vs an agent environment?
Only if you isolate the model costs from environmental overhead. Claude Code injects ~1,200 tokens of system prompt. OpenCode injects ~1,800. These overheads are billed at the same per-token rate and must be included in budget calculations.
How do batch APIs affect cost?
OpenAI's Batch API offers 50% discount with 24-hour turnaround. For non-real-time workloads like nightly data processing, batch can halve your costs. Other providers offer similar discounts at lower percentages.
What is the most overlooked cost factor?
Reasoning chain output. Frontier models generate extensive chain-of-thought before responding, sometimes 2-4x the visible output. This hidden output is billed at full output rates and is invisible to users.
How do I budget for agentic AI in production?
Start with chat completion costs for your expected token volume, then multiply by 3-5x for agent loop overhead. Add 15-20% for retries and failures. Monitor actual vs estimated and adjust monthly.
Does the calculator account for multi-turn MCP interactions?
No. MCP tool responses consume input tokens that vary by tool and dataset. A vector search returning 10 results consumes different tokens than a SQL query returning a full table. The calculator models a single request-response cycle.

References

  1. [1]OpenAI. (2026). API Pricing — GPT-5.6 Sol, Terra, Luna per-million-token rates.
  2. [2]Anthropic. (2026). Claude API Pricing — Opus 5, Sonnet 5, Haiku 4.5.
  3. [3]Google. (2026). Gemini API Pricing — Flash 3.6 and 2.5 Pro rates.
  4. [4]DeepSeek. (2026). V4 Pro and V4 Flash API Pricing.
  5. [5]OpenAI. (2026). Batch API — 50% discount for asynchronous processing.
  6. [6]Anthropic. (2026). Prompt Caching Documentation.

Last updated: July 30, 2026

1b

UnByte — Independent Software Engineering

Every calculator references authoritative sources — Editorial policy