Home/Writing/What Claude Code Actually Costs: Subscription vs. API Billing

Writing

What Claude Code Actually Costs: Subscription vs. API Billing

Claude Code runs on a Claude plan's usage limits or on per-token API billing. See what drives token use in agentic coding sessions and how to estimate your spend.

Short answer

It depends on how you sign in. On a Pro, Max, Team or Enterprise plan, Claude Code usage counts against your plan's usage limits rather than being billed per token, and you only pay more if you turn on usage credits beyond those limits. With an API key, a Console login or a cloud provider, every token is billed at the model's API rate: $2.00 input / $10.00 output per 1M tokens on Claude Sonnet 5.5. Either way, most of a session's tokens are context re-sent on every request, so cache hits, model choice and clearing context between tasks drive the cost.

Use this guide forNext action
Understanding the cost decisionClaude Token Calculator →

"How much does Claude Code cost?" has two correct answers, depending on how you log in. On a Claude subscription, usage is metered against plan limits. On an API key it is metered in dollars per token. Both run on the same thing underneath: tokens. Agentic coding uses them in a pattern that surprises people used to pricing chat. This guide covers the billing models, what actually consumes tokens, and how to estimate a session before it reaches your invoice.

All billing and plan facts below come from Anthropic's Claude Code documentation, mainly the costs guide, authentication guide and prompt caching guide. Token prices come from our pricing store.

Two ways to pay for Claude Code

A Claude subscription. You can sign in with a Claude Pro, Max, Team or Enterprise account. Usage then counts against your plan's limits instead of being billed per token:

  • On Pro and Max, you see session and weekly limits. The limits are shared across all models, so once you hit one, switching models does not restore access before the window resets.
  • On Team and Enterprise, each member draws from a per-seat allowance that resets on a rolling five-hour window and a weekly window. That allowance is shared with Claude chat and Cowork.
  • On every plan, usage credits let you keep working past the limit. Those credits are billed against a spend limit that you (Pro, Max) or your admin (Team, Enterprise) sets.

Plan prices are on claude.com/pricing.

Per-token billing. If you sign in with a Claude Console account or an API key, or route through Amazon Bedrock, Google Cloud or Microsoft Foundry, every request is billed at the model's per-token rate. When you first authenticate with Console, a dedicated "Claude Code" workspace is created so spend can be tracked and capped separately from your other API usage.

The API-key trap

Claude Code chooses credentials in a fixed order, and the ANTHROPIC_API_KEY environment variable ranks above your subscription login. In an interactive session you are asked once whether to use the key, and the answer is remembered. In non-interactive mode (claude -p) the key is always used when it is set. If a key is exported in your shell profile, you can end up paying per token while believing you are on your plan. Run /status to see which credential is active, and unset ANTHROPIC_API_KEY to fall back to the subscription.

What actually drives token usage

The model keeps no memory between requests. On every request Claude Code sends the full context again: system prompt, tool definitions, CLAUDE.md, the whole conversation, and every tool result so far. Each tool call (reading a file, running a test, searching) produces another request carrying all of that. A single prompt from you can therefore turn into dozens of requests, each with a large input.

The main drivers:

  • Context length. Anthropic's guide says plainly that token costs scale with context size. A one-line question late in a long session still re-reads the whole conversation.
  • Prompt caching. Claude Code caches the unchanged start of each request, so re-reads are billed at the cached-token rate instead of full input price. The cache expires after inactivity. The main conversation gets a one-hour lifetime on a subscription within plan usage, and five minutes by default on an API key, a cloud provider, or once you draw on usage credits. Your first message after a longer break reprocesses everything at full price.
  • Cache-breaking actions. Switching models, turning on fast mode, connecting MCP servers whose tools load up front, and compacting all force a full re-read on the next request. On most models a mid-session effort change does too.
  • Thinking. Thinking tokens are billed as output tokens, and output is the expensive side of every Claude price.
  • Parallel work. Subagents, agent teammates, scheduled loops and compaction each send their own requests. Anthropic estimates agent teams at roughly seven times the tokens of a standard session when teammates run in plan mode.

Estimating an API-billed session

Estimate in two parts: how many requests a session makes, and how large the average request is. Here is an illustrative assumption, not a measured average: a two-hour session makes 150 model requests, each carrying about 80,000 tokens of context, with 1,500 output tokens per request including thinking. That is 12M input tokens and 225,000 output tokens.

If none of that input were cached, the session would cost:

  • $26.25 on Claude Sonnet 5.5
  • $52.50 on Claude Opus 5.5
  • $131.25 on Claude Fable 5.1

That is a ceiling, not a forecast. On Sonnet 5.5, $24.00 of the total is input, and in a working session most of that input is a cache hit. Anthropic's pricing page bills cache reads on Sonnet 5.5 and Opus 5.5 at 5% of the base input rate, so a high hit rate removes most of the input line. The output line, $2.25 on Sonnet 5.5, gets no cache discount. On a well-cached session it often becomes the larger share.

Two consequences follow:

  1. Your cache hit rate matters more than the headline price. The Prompt cache (main) line in /usage shows what share of input tokens came from cache and how many misses you had.
  2. Model choice multiplies everything. As the list above shows, the same session costs a multiple of the Sonnet figure on Opus, and more again on Fable. Anthropic's guide recommends Sonnet for most coding and Opus only for complex architecture or multi-step reasoning.

One edge case: Claude 4.6 and later models bill their full 1M-token context at standard rates, except Claude Haiku 5.5. A Haiku 5.5 request with a prompt over 100,000 tokens pays five times its base rates. If you move subagents to Haiku 5.5 to save money, keep their context below that threshold.

To model your own numbers, put measured per-request input and output into the Claude Token Calculator. To measure prompt sizes, see how to count Claude tokens.

Subscription or API: how to decide with data

The reliable way to compare is to measure your own usage, not to reason from averages:

  • Read the session estimate. /usage prices every session at list rates from its token counts. On a subscription that figure is not your bill, but it shows what the same work would cost on an API key.
  • Collect a few typical days. Sum those estimates and compare the total with your plan's price on claude.com/pricing. If you regularly hit plan limits, add the usage-credit spend that /usage reports.
  • For teams, start small. Anthropic publishes enterprise averages per developer on its costs page, and advises running a small pilot group to set a baseline before a wider rollout. The Console dashboard and the Claude Code Analytics API report spend per user for API-billed organizations.

Cutting the bill without slowing down

These come from Anthropic's own cost guide, ordered by how much they usually help:

  • Clear between tasks. /clear starts a fresh context, so unrelated work stops re-reading old history. Compaction costs a large request of its own. Use /clear when you want a fresh start rather than continuity.
  • Match the model to the job. Default to Sonnet, switch to Opus deliberately, and set simple subagents to a Haiku model.
  • Lower the effort on routine work. On models where thinking is always on, /effort is the lever. On Opus 5.5, Sonnet 5.5, Haiku 5.5 and Fable 5.1 an effort change keeps the cache on an API key or subscription.
  • Keep the fixed context small. Keep CLAUDE.md short and move workflow-specific instructions into skills that load on demand. Disable MCP servers you are not using, and prefer CLI tools such as gh where they exist.
  • Filter verbose output. A hook that greps test or log output before Claude sees it can turn tens of thousands of tokens into hundreds. Running noisy jobs in a subagent keeps their output out of the main context.
  • Avoid mid-task switches. Pick the model at the start of a session. Every switch rebuilds the cache.

Understanding the token flow matters more than the plan you pick. Measure a week of real sessions, then choose between subscription and per-token billing with real numbers. For the general shape of input and output pricing, see input vs. output token costs.

Token prices in this article come from the AICostLabs pricing store, last verified against Anthropic's pricing page on October 13, 2026. Plan details change; check Anthropic's documentation before you commit a budget.

Claude Token CalculatorApply this guide to your own workload.Open calculator →

Common questions

Does Claude Code cost extra on a Claude Pro or Max plan?

Not per token. Anthropic's docs say Pro and Max subscribers have Claude Code usage included in the subscription, counted against session and weekly usage limits. If you turn on usage credits, usage beyond the plan limit is billed up to the monthly spend limit you set.

Why is my API key being charged when I have a subscription?

Claude Code ranks the ANTHROPIC_API_KEY environment variable above your subscription login. In interactive mode it asks once whether to use the key and remembers your answer. In non-interactive mode with -p it always uses the key when it is set. Unset the variable and check /status to confirm which credential is active.

How do I see how many tokens a Claude Code session used?

Run /usage. Its Session block lists input, output, cache read and cache write tokens per model, plus a dollar estimate at list price and a prompt cache hit summary. The estimate is computed locally; the Usage page in the Claude Console is the authoritative bill for API users.

Are Claude's thinking tokens billed in Claude Code?

Yes. Anthropic's Claude Code docs state that thinking tokens are billed as output tokens. On Opus 5.5, Sonnet 5.5, Haiku 5.5 and the Fable models thinking cannot be turned off, so lower the effort level with /effort to spend less on simple tasks.

Do subagents and agent teams increase Claude Code costs?

Yes. Each subagent and each agent-team teammate sends its own requests with its own context window. Anthropic notes that agent teams use roughly seven times more tokens than standard sessions when teammates run in plan mode. Put simple subagent work on a smaller model and shut teammates down when they finish.