# Inference cost

> Canonical: https://skillalmanac.com/glossary/inference-cost | Last verified: 2026-11-24 | Index status: not offered to search engines

Inference cost is what it costs to run a trained AI model to produce answers. For hosted models it is usually billed per token read and written; for self-hosted models it is the hardware and energy.

Also called: LLM inference cost, cost of inference, inference pricing, AI inference cost, cost per token, running cost of AI.

## In plain language

Inference cost is the price of using an AI model, as opposed to the one-off cost of training it. Each time you ask a question, the model does work, and someone pays for the computers that do it. With a hosted model, the vendor turns that into a price per token, where a token is a small piece of text. Anthropic's pricing page lists separate rates for text sent in and text generated. Longer prompts and longer answers cost more, and an agent that reads many files sends a lot of text. Before you automate something at volume, estimate the cost for one run and multiply it.

## Technical definition

Anthropic's pricing documentation prices usage per million tokens, with separate rates for base input tokens, cache writes, cache hits and output tokens, and a discount for asynchronous batch processing. It states that tool use adds tokens, including those for tool definitions and results. Claude Code's cost documentation says Claude Code charges by API token consumption and that token costs scale with context size. IBM describes the goal of inference as deploying a trained model in a maximally efficient, cost-effective way, and says loading model parameters into memory for each run uses energy, which batching spreads across many inputs. Self-hosted cost is hardware, energy and operations, not a per-token price.

## How it shows up when you use agents

In an agent session, inference cost is the sum of every request the harness sends to the model. Each request carries the conversation so far, plus file contents and tool results, and the model's reply is billed as output. Claude Code's cost documentation says costs scale with context size and that it sends the full conversation with every request. Anthropic's pricing page also says tool use adds tokens. See [Token](/glossary/token) for the unit and [Rate limit](/glossary/rate-limit) for the separate caps on how fast you may send requests.

What breaks when this is misunderstood: a loop that looked cheap per step becomes expensive because each step carries the growing history. Cost per run and cost per month are different questions, and a cheap run can still add up when automated.

Next actions: run `/usage` in Claude Code to see the session's token use, clear context between unrelated tasks, pick a smaller model for simple work, and estimate a monthly range before scaling a workflow. Use your own current prices; vendors change them.

## Common confusions

- **Inference cost versus training cost.** Training builds the model. Inference is the cost of each use after that. See [Inference](/glossary/inference).
- **Per-token price versus total cost.** The rate is only one factor. Total cost also depends on prompt length, output length and how many requests an agent makes.
- **API cost versus subscription.** Anthropic's Claude Code documentation says Claude Code charges by API token consumption and points to a separate page for subscription plan pricing. See [AI subscription](/glossary/ai-subscription).
- **Hosted versus self-hosted cost.** A hosted model has a price list. A self-hosted model has hardware, energy and upkeep, which are harder to turn into a per-token figure.
- **Myth.** Caching does not make requests free. Anthropic's pricing page lists cache writes and cache reads as separate priced items.

## Worked examples in this catalogue

### [llm-cost-estimator](https://skillalmanac.com/skills/skill-almanac/llm-cost-estimator)

```
Give the skill a usage profile (requests per day, input and output tokens) and your own price table.
```

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: A monthly LLM cost range with cache, batch and subscription effects.

Why it exercises the concept: It turns the per-token pricing idea into a budget for your own usage, using prices you supply.

### [agent-session-cost-review](https://skillalmanac.com/skills/skill-almanac/agent-session-cost-review)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: A report of where a coding-agent session spent its tokens, built by parsing the saved session transcript with a script.

Why it exercises the concept: Inference cost in an agent session comes from what each request carries. This skill shows where the spend went.

### [Claude Code Pricing: What Drives Cost and Plan Options](https://skillalmanac.com/learn/claude-code-pricing-explained)

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: The guide explains how Claude Code usage is billed on plans and per token, and the settings that control spend.

Why it exercises the concept: It is the plain-language companion for one product: which billing path applies and what drives the cost.

### [Claude Code](https://skillalmanac.com/tools/claude-code)

```
/usage
```

Status: illustrative example from the item's own documentation, not executed for this page.

What you see: Claude Code shows plan usage and the token use of the current session. /cost is an alias of /usage.

Why it exercises the concept: It is the in-session view of the token use that inference cost is built from.

## Related terms

- [Inference](https://skillalmanac.com/glossary/inference.md)
- [Token](https://skillalmanac.com/glossary/token.md)
- [Rate limit](https://skillalmanac.com/glossary/rate-limit.md)
- [Prompt caching](https://skillalmanac.com/glossary/prompt-caching.md)
- [Usage limits](https://skillalmanac.com/glossary/usage-limits.md)
- [Context window](https://skillalmanac.com/glossary/context-window.md)
- [Together AI](https://skillalmanac.com/glossary/together-ai.md)
- [Batch API](https://skillalmanac.com/glossary/batch-api.md)
- [fal.ai](https://skillalmanac.com/glossary/fal-ai.md)

## Sources

- [Commands](https://code.claude.com/docs/en/commands), Anthropic (Claude Code Docs) (accessed 2026-11-24)
- [Pricing](https://platform.claude.com/docs/en/about-claude/pricing), Anthropic (Claude Docs) (accessed 2026-11-24)
- [Manage costs effectively](https://code.claude.com/docs/en/costs), Anthropic (Claude Code Docs) (accessed 2026-11-24)
- [What is AI inference?](https://www.ibm.com/think/topics/ai-inference), IBM (accessed 2026-11-24)

Definitions are written by Skill Almanac from the sources above and checked against them on 2026-11-24. [Glossary index](https://skillalmanac.com/glossary.md).
