# What is inference cost? LLM pricing explained, with a calculator

URL: https://sdclabs.com/glossary/inference-cost/

> Inference cost is what each model answer costs. What drives LLM token bills, current list prices with dates, a cost calculator, and ways to cut spend.

# What is inference cost?

[Sergey Almyashev](https://sdclabs.com/author/almyashev/) 2026-11-28

Definition

Inference cost is what you pay each time a trained model produces an answer. For hosted LLMs it is billed per token: input, cached input and output tokens at different prices, plus fees for some tools. For self-hosted models it is GPU time divided by the tokens those GPUs actually serve.

## What makes up inference cost?

For a hosted model, the bill per request is a sum of token counts times unit prices, plus fees for some tools:

**cost = fresh input tokens x input price + cached input tokens x cache price + output tokens x output price + tool fees**

Each term has details that change the total more than the headline price does. All figures below come from the providers' pricing pages as we read them on 2026-11-19.

| Line item | What counts | Detail from the price pages |
|---|---|---|
| Input tokens | [System prompt](https://sdclabs.com/glossary/system-prompt/) , history, retrieved documents, tool definitions | Anthropic bills the tools parameter as input and adds a tool use system prompt, 286 tokens on Claude Sonnet 5.5 |
| Output tokens | Everything the model generates | Google's Gemini price table says output prices include thinking tokens |
| Cached input | A repeated prompt prefix read from cache | Anthropic charges 0.1x the input price on most models; a 5-minute cache write costs 1.25x and pays off after one read |
| Tool fees | Server-side tools such as search | Anthropic web search costs $10 per 1,000 searches; for Gemini 4 Argon, grounding with Google Search costs $14 per 1,000 requests after 5,000 free a month |
| Location | Where the request is processed | Anthropic applies 1.1x for US-only inference on Claude 4.6 and later; OpenAI adds 10% for regional processing on models released from March 5, 2026 |
| [Context length](https://sdclabs.com/glossary/context-window/) | Very long prompts | OpenAI lists separate, higher long-context rates; Anthropic bills the full 1M context of Claude 4.6 and later at standard rates, except Claude Haiku 5.5 |
| Processing mode | Batch or background jobs | Anthropic's and Gemini's Batch APIs both cut prices by 50% |

## What do models cost per token right now?

These are list prices in USD per million tokens, copied from [Anthropic](https://platform.claude.com/docs/en/about-claude/pricing) , [OpenAI](https://developers.openai.com/api/docs/pricing) and [Google](https://ai.google.dev/gemini-api/docs/pricing) on 2026-11-19. They change, sometimes on a date announced in advance, and negotiated or cloud marketplace prices differ.

| Model | Input | Cached input | Output | Note on the price page |
|---|---|---|---|---|
| Claude Sonnet 5.5 | $2.00 | $0.10 | $10.00 | Cache hits at 0.05x input |
| Claude Haiku 5.5 | $0.10 | $0.01 | $0.50 | Prompts up to 100,000 tokens; longer prompts cost $0.50 and $2.50 |
| gpt-6.2-sol | $2.00 | $0.10 | $10.00 | Short context; long context is $4.00 in and $15.00 out |
| Gemini 4 Argon | $2.00 | $0.10 | $10.00 | Through November 30, 2026 |
| Gemini 4 Argon | $4.00 | $0.20 | $20.00 | From December 1, 2026 |

Prices move in both directions. Gemini 4 Argon doubles on December 1, 2026. [Anthropic's page](https://platform.claude.com/docs/en/about-claude/pricing) records the opposite case: Claude Sonnet 5 launched at an introductory $2 and $10, a rise to $3 and $15 was scheduled for September 1, 2026, and Anthropic cancelled it, so the introductory price became standard.

For the long-run trend in what a given level of capability costs, see our [state of AI engineering in 2026](https://sdclabs.com/blog/state-of-ai-engineering-2026/) report.

## Why can't you compare models by price per token?

Because a token is not a fixed unit of text. [Anthropic's pricing page](https://platform.claude.com/docs/en/about-claude/pricing) says Claude 4.7 and later models use a newer tokenizer that produces about 30% more tokens for the same text. Two models with the same price per million tokens can cost different amounts for the same prompt.

Three habits avoid the trap:

1. **Count tokens with each provider's own counter** on a sample of your real prompts. Anthropic offers a token counting endpoint; OpenAI documents token counting in its API docs.
1. **Compare cost per completed task** , not per token. A cheaper model that needs two retries or extra agent steps can cost more.
1. **Include reasoning tokens.** Gemini's price table, for one, bills thinking tokens at the output rate, usually the most expensive line.

## Example: a cost calculator from cited prices

This Python script estimates a monthly bill for a support agent. Each task makes 5 model calls. Every call resends a 6,000-token prefix (system prompt, tool definitions, history), adds 1,500 new input tokens and writes 400 output tokens.

# Monthly inference cost of one agent workload. List prices in USD per million tokens, # copied from the providers' pricing pages on 2026-11-19. They change: re-check before you budget. PRICES = { # input, cached input (cache hit), output "claude-sonnet-5-5": (2.00, 0.10, 10.00), "gpt-6.2-sol (short context)": (2.00, 0.10, 10.00), "gemini-4-argon to 2026-11-30": (2.00, 0.10, 10.00), "gemini-4-argon from 2026-12-01": (4.00, 0.20, 20.00), } def cost_per_task(price, steps, fresh_in, cached_in, out): p_in, p_cache, p_out = price per_step = (fresh_in * p_in + cached_in * p_cache + out * p_out) / 1_000_000 return steps * per_step # One support task: 5 model calls. Each call resends a 6,000-token prefix (system prompt, # tool definitions, history) and adds 1,500 new input tokens; it writes 400 output tokens. TASKS_PER_MONTH = 30 * 2_000 for name, price in PRICES.items(): no_cache = cost_per_task(price, 5, 7_500, 0, 400) cached = cost_per_task(price, 5, 1_500, 6_000, 400) print(f"{name:<31} per task ${no_cache:.4f} -> ${cached:.4f} with cache hits | " f"month ${no_cache * TASKS_PER_MONTH:,.0f} -> ${cached * TASKS_PER_MONTH:,.0f}")
Output with Python 3.11.15 on 2026-11-19:

claude-sonnet-5-5 per task $0.0950 -> $0.0380 with cache hits | month $5,700 -> $2,280 gpt-6.2-sol (short context) per task $0.0950 -> $0.0380 with cache hits | month $5,700 -> $2,280 gemini-4-argon to 2026-11-30 per task $0.0950 -> $0.0380 with cache hits | month $5,700 -> $2,280 gemini-4-argon from 2026-12-01 per task $0.1900 -> $0.0760 with cache hits | month $11,400 -> $4,560
Three readings. Caching the prefix cuts this workload by 60%, more than any choice between the first three models. A scheduled list price change doubles the bill with no change to your code. And the identical first three rows are an artifact of the simplification: in practice each tokenizer turns the same text into a different token count.

The script assumes the prefix stays warm in the cache and ignores the one-off cache write charge. For Gemini 4 Argon, Google's price page lists implicit caching only; explicit caching is not supported. On a busy workload that is close; on sparse traffic the cache expires and you pay full input price more often.

## How do you estimate self-hosted inference cost?

When you run an open-weights model on your own GPUs, you pay for hours, not tokens. A useful conversion:

**cost per million tokens = (GPU price per hour x number of GPUs) / (tokens per second x 3,600 / 1,000,000)**

Measure tokens per second yourself, with your model, batch size and prompt lengths, on the hardware you plan to rent. Then divide by real utilization: a GPU that sits idle half the day doubles the effective price of every token it does serve. Self-hosting tends to make sense for steady, high-volume traffic or strict data rules, and rarely for spiky workloads.

## How do you reduce inference cost?

- **Put stable content first** in the prompt (instructions, tool definitions, reference documents) so the prefix can be cached.
- **Batch anything that can wait.** Evals, nightly summaries and backfills rarely need an answer in seconds.
- **Route by difficulty.** On Anthropic's list, Claude Haiku 5.5 costs a twentieth of Claude Sonnet 5.5 per input and output token on prompts up to 100,000 tokens. Send it the easy requests, and prove the quality holds with an eval set before you switch.
- **Cap output and steps.** Set maximum output tokens and a step limit per agent run.
- **Trim tool definitions.** Every tool you declare is billed as input on every call.
- **Watch cost per task in production.** Per-run token and cost data belong in your traces; see [agent observability](https://sdclabs.com/glossary/agent-observability/) , and the [LLMOps](https://sdclabs.com/glossary/llmops/) entry for where budgets fit in a release process.

Keeping spend inside agreed limits is part of our [generative AI development](https://sdclabs.com/services/generative-ai/) work: SDCLabs engineers set token budgets with alerts, cache repeated work and route simple requests to smaller models, and automated evals run on every change to prompts, models or retrieval. Senior engineers review the results and decide what ships.

## Sources

1. [Pricing](https://platform.claude.com/docs/en/about-claude/pricing) , Anthropic (Claude Platform Docs), 2026-11-19
1. [Pricing](https://developers.openai.com/api/docs/pricing) , OpenAI API docs, 2026-11-19
1. [Gemini Developer API pricing](https://ai.google.dev/gemini-api/docs/pricing) , Google AI for Developers, 2026-11-19

## Frequently asked questions

### What is the difference between training cost and inference cost?

Training cost is paid once to build or fine-tune a model. Inference cost is paid on every request for as long as the product runs, so for most applications built on hosted models it is the cost that grows with usage.

### Why are output tokens more expensive than input tokens?

The provider price pages we checked list the gap but do not explain it. On the price pages we checked on 2026-11-19, output cost five times the input price at standard rates for each model in our table (3.75 times for gpt-6.2-sol at long context).

### Do AI agents cost more to run than chatbots?

Usually, because an agent makes several model calls per task and resends its instructions, tool definitions and history on each one. Measure cost per completed task, and cache the repeated prefix.

### How much does prompt caching save?

It depends on how much of each prompt repeats. Cache reads cost a fraction of the input price (0.1x on most Claude models), so a long, stable prefix reused across calls can cut a bill by more than half, as in the calculator on this page.

### Are LLM API prices going down?

They move both ways. Anthropic cancelled a planned rise for Claude Sonnet 5 and kept its introductory price, while Google's page shows Gemini 4 Argon's prices doubling on December 1, 2026. Re-check price pages before you budget, and track your own cost per task.

Services

- [Generative AI](https://sdclabs.com/services/generative-ai/)
- [Cloud Operations and Managed Services](https://sdclabs.com/services/cloud-operations/)

Read next

- [The state of AI engineering in 2026](https://sdclabs.com/blog/state-of-ai-engineering-2026/)
- [Generative AI fails after the demo, not before it](https://sdclabs.com/blog/generative-ai-production/)
- [29% of cloud spend is wasted, and AI is pushing it up](https://sdclabs.com/blog/cloud-operations-spend-outages/)

Related terms

- [LLMOps](https://sdclabs.com/glossary/llmops/)
- [Agent observability](https://sdclabs.com/glossary/agent-observability/)
- [Agentic workflow](https://sdclabs.com/glossary/agentic-workflow/)

[Sergey Almyashev](https://sdclabs.com/author/almyashev/) Chief Operating Officer14+ years in QA, automated, exploratory and performance testing, and continuous integration and delivery within Scrum, helping teams in product and outsourcing companies organize teams, processes and tools.[LinkedIn](https://www.linkedin.com/in/sergeyalmyashev/)

## Building with AI agents? Talk to an engineer.

[Start a project](https://sdclabs.com/contact/) [Book a call with the CEO](https://calendly.com/sdclabs/60min)
