---
title: "Claude Code cost: how billing works and how to track spend per developer"
description: "Claude Code cost explained: subscription plans, API and cloud billing, what drives token use, built-in usage tools, and how to track spend per developer."
summary: "Claude Code is billed through a Claude subscription, pay-as-you-go API usage in the Claude Console, or a cloud provider, and each route meters usage differently. This guide covers those routes, what drives token use, the built-in usage tools, and gateway controls with one key per developer."
type: "guide"
canonical_url: "https://theaiengineering.com/articles/claude-code-cost"
markdown_url: "https://theaiengineering.com/articles/claude-code-cost.md"
topic: "AI coding agents"
author: "The AI Engineering Editors"
publisher: "The AI Engineering"
published: "2026-11-20"
updated: "2026-11-20"
keywords: ["claude code cost","claude code usage tracking","claude code enterprise","claude code pricing","claude code api cost"]
citation: "The AI Engineering Editors. \"Claude Code cost: how billing works and how to track spend per developer.\" The AI Engineering, updated Nov 20, 2026. https://theaiengineering.com/articles/claude-code-cost"
---

# Claude Code cost: how billing works and how to track spend per developer

## TL;DR

- Claude Code is included in every paid Claude plan (Pro, Max, Ultra, Team, and Enterprise), while a Claude Console API key, Amazon Bedrock, Google Cloud, or Microsoft Foundry bills it per token at API or cloud rates.
- Anthropic's cost documentation reported, as of November 2026, an average of about $13 per developer per active day and $150 to $250 per developer per month across enterprise deployments.
- Most Claude Code tokens come from re-sending the growing context on every request, and prompt caching bills that repeated prefix at the cache-read rate only while the cache stays warm.
- The /usage command (aliases /cost and /stats), /context, and the status line show local list-price estimates, while OpenTelemetry export, Console analytics, and Team or Enterprise analytics give per-user numbers for an organization.
- An AI gateway that issues one virtual key per developer adds budgets, rate limits, and per-request cost logs that work the same on Anthropic's API, Bedrock, and Google Cloud.

Claude Code cost depends on which credential a developer signs in with: a Claude subscription covers Claude Code up to the plan's usage limits, while a Claude Console API key, Amazon Bedrock, Google Cloud, or Microsoft Foundry bills every token. Within any of those routes, the same task can cost very different amounts depending on the model, the size of the context Claude Code carries, and how often that context is re-sent.

This guide covers each billing route, the mechanisms behind token use, the built-in usage tools, ways to cut spend, and per-developer tracking with an [AI gateway](https://theaiengineering.com/glossary/ai-gateway). Prices and plan limits are as Anthropic listed them in November 2026 and change often, so confirm them on the linked pages before you budget. For the wider category of tools, see our [AI coding agents hub](https://theaiengineering.com/topics/ai-coding).

## How much does Claude Code cost?

As of November 2026, Claude Code costs $20 a month on Claude Pro, $100 on Max, and $200 on Ultra, and Team seats start at $20 per seat per month billed annually. API keys and cloud providers bill per token instead, and Anthropic reports that enterprise deployments average about $13 per developer per active day.

That average comes from Anthropic's [Claude Code cost documentation](https://code.claude.com/docs/en/costs), checked on November 16, 2026, which also puts monthly spend at $150 to $250 per developer and says 90% of users stay below $30 per active day. Spend varies with model choice, codebase size, and automation, so Anthropic recommends a small pilot group to set a baseline before a wider rollout.

A budget therefore has two parts: the fixed price of a plan or seat, and the variable cost of [tokens](https://theaiengineering.com/glossary/tokens) beyond what the plan includes.

## How Claude Code is billed

Claude Code is billed through one of three routes. A Claude subscription draws on plan usage limits that reset every five hours and every week. A Claude Console API key bills each token at API rates. Amazon Bedrock, Google Cloud's Agent Platform, and Microsoft Foundry bill tokens to your cloud account at the cloud provider's prices.

| Billing route | How you pay | What it meters | Where you see spend | Where you cap spend |
|---|---|---|---|---|
| Pro, Max, or Ultra subscription | Monthly plan price | Share of five-hour and weekly usage limits; optional usage credits at API rates past the limit | `/usage`, claude.ai Settings > Usage | Plan limits; a monthly spend limit on usage credits |
| Team plan | Price per Standard or Premium seat | Per-seat allowance shared with chat and Cowork; usage credits past it | Spend report in org analytics | Spend limits per organization, group, or member |
| Enterprise, usage-based | Seat fee plus usage at API rates | Tokens at API rates, no per-seat usage cap | Org analytics, Enterprise Analytics API | Admin spend limits per user and organization |
| Claude Console API key | Prepaid or invoiced API usage | Input, output, cache-write, and cache-read tokens | Console Cost page, Claude Code dashboard | Workspace spend limits and rate limits |
| Bedrock, Agent Platform, or Foundry | Your cloud bill | Tokens at the cloud provider's prices | Cloud billing console | Cloud budget controls |

If an organization mixes sign-in methods, each developer is metered according to the method they authenticated with, so the credential on each machine is the first thing to check when a bill looks wrong.

### Subscription plans that include Claude Code

Claude Code is included in every paid Claude plan, and the Free plan does not include it. Terminal sessions, IDE sessions, and chats draw from one usage pool, so a long coding day also reduces what is left for chat. Anthropic's [pricing page](https://claude.com/pricing) listed these plans on November 16, 2026:

| Plan | Price | Usage | Notes |
|---|---|---|---|
| Pro | $20 per month, or $17 per month billed annually ($200 up front) | Baseline | Fable models paid with usage credits |
| Max | $100 per month | 5x Pro, every five hours and every week | Fable up to half the weekly limit; $100 per month in Claude Platform API credits |
| Ultra | $200 per month | 10x Pro weekly; no five-hour limit for verified accounts | $200 per month in Claude Platform API credits |
| Team Standard | $25 per seat per month, or $20 billed annually | More than Pro | 2 to 150 seats; Claude Code and Cowork included |
| Team Premium | $125 per seat per month, or $100 billed annually | 5x a Standard seat | Seat types can be mixed |
| Enterprise | $20 per seat per month billed annually, 20-seat minimum, plus usage at API rates | Usage-based | Admin spend limits, SCIM, audit logs |

At a limit, a subscriber can wait for the reset, move to a larger plan, or turn on usage credits, which bill further work at standard API rates. The `/usage-credits` command opens those settings from Claude Code, or sends a request to an admin for Team and Enterprise members without billing access.

### Claude Code Enterprise and Team seats

On Team plans, each member's Claude Code usage draws from a per-seat allowance that resets on a rolling five-hour window and a weekly window, and the allowance is shared with Claude chat and Cowork. Admins can turn on usage credits and set spend limits per organization, group, or member. Anthropic's [support article on Team and Enterprise seats](https://support.claude.com/en/articles/11845131-use-claude-code-with-your-team-or-enterprise-plan) says new and self-serve Enterprise plans include Claude Code with a single seat type and have no per-seat usage limits; usage is billed at API rates instead. Older seat-based Enterprise plans keep included allowances.

The monthly API credits that come with a Team plan cannot be spent in Claude Code, according to the same support article. The org spend report also shows dollars for usage-credit spend only, because usage inside a seat allowance is not metered in dollars.

### Pay-as-you-go API usage through the Claude Console

A Claude Console API key bills every request at [API rates](https://platform.claude.com/docs/en/about-claude/pricing), with no plan limits. Each request is metered in four token types: base input, cache writes, cache reads, and output. On November 16, 2026, Anthropic listed these prices per million tokens for its current models:

| Model | Input | 5-minute cache write | 1-hour cache write | Cache read | Output |
|---|---|---|---|---|---|
| Claude Fable 5.2 | $8 | $10 | $16 | $0.20 | $40 |
| Claude Opus 5.5 | $4 | $5 | $8 | $0.20 | $20 |
| Claude Sonnet 5.5 | $2 | $2.50 | $4 | $0.10 | $10 |
| Claude Haiku 5.5, prompts up to 100,000 tokens | $0.10 | $0.125 | $0.20 | $0.01 | $0.50 |

Haiku 5.5 prompts over 100,000 tokens cost $0.50 input and $2.50 output per million. US-only inference multiplies every token category by 1.1, and fast mode on [Claude Opus 5.5](https://theaiengineering.com/releases/2026/09#claude-opus-5-5) costs $8 input and $40 output per million. Output costs five times input on each model here, and extended thinking tokens bill as output, so reasoning settings matter as much as context size.

When a developer first signs in to Claude Code with a Console account, Anthropic creates a workspace called Claude Code that holds the organization's Claude Code usage. Claude Code mints a per-user API key there at sign-in, and Anthropic's [workspaces documentation](https://platform.claude.com/docs/en/manage-claude/workspaces) says it is the only Console workspace that supports per-user monthly spend limits.

### Amazon Bedrock, Google Cloud, and Microsoft Foundry

Setting `CLAUDE_CODE_USE_BEDROCK=1`, `CLAUDE_CODE_USE_VERTEX=1`, or `CLAUDE_CODE_USE_FOUNDRY=1` sends Claude Code's requests to Amazon Bedrock, Google Cloud's Agent Platform (formerly Vertex AI), or Microsoft Foundry, and the cloud provider bills the tokens at its own prices. Anthropic's pricing docs note that regional and multi-region endpoints on Bedrock and Google Cloud carry a 10% premium over global endpoints for Claude 4.5 models and later.

Claude Code does not send cloud-provider usage back to Anthropic, so the Console dashboard and the Claude Code Analytics API do not cover it. Per-developer attribution on these routes needs OpenTelemetry, Anthropic's self-hosted Claude apps gateway, or another LLM gateway. The [Bedrock setup page](https://code.claude.com/docs/en/amazon-bedrock) also warns that an unpinned primary model defaults to Opus and bills at Opus rates, and it suggests a dedicated AWS account for Claude Code to simplify cost tracking.

### Which credential gets billed

Claude Code picks one credential when several are present, and that choice decides who pays. Cloud provider variables rank first, followed by `ANTHROPIC_AUTH_TOKEN`, `ANTHROPIC_API_KEY`, and an `apiKeyHelper` script, and a subscription login from `/login` ranks last, per the [authentication docs](https://code.claude.com/docs/en/authentication). A Max subscriber with a stray `ANTHROPIC_API_KEY` in their shell is billed at API rates once they approve the key. Running `/status` shows which credential is active.

## What drives token use in Claude Code

Claude Code token use grows with the context it re-sends. Every request carries the system prompt, tool definitions, CLAUDE.md, and the full conversation, including every file and tool result read so far. Model choice, extended thinking, subagents, and long or idle sessions multiply that base, and prompt caching discounts the repeated part only while the cache stays warm.

**Figure 1: Every Claude Code request re-sends the full context. A warm prompt cache bills the unchanged prefix at the cache-read rate.**

Four layers of a Claude Code request: system prompt and tools, project context, and conversation form a cached prefix, and the newest turn is processed as new input.

Layers, top to bottom:

1. **System prompt and tools**: Changes when tools change (Instructions, Built-in tools, MCP tool names)
2. **Project context**: Reloaded at start, /clear, /compact (CLAUDE.md, Auto memory, Rules)
3. **Conversation**: Grows on every turn (Messages, File reads, Tool results)
4. **Newest turn**: Your message or the latest tool results

Cached prefix spans System prompt and tools through Conversation. New input spans Newest turn through Newest turn.

### Context size and repeated file reads

The model keeps no memory between requests, so Claude Code re-sends the entire context each time, and each round of tool calls adds another request carrying the new results. A file read early in a session is billed again on every later request, at the cache-read rate when the cache is warm, until the conversation is cleared or compacted. Near the limit of the [context window](https://theaiengineering.com/glossary/context-window), Claude Code runs automatic [compaction](https://theaiengineering.com/glossary/context-compaction). A broad request to improve a codebase triggers wide scanning; naming the file and function keeps reads small.

### Tool output

Test runs, build logs, and command output enter the context in full unless something trims them first. The cost guide shows a `PreToolUse` hook that keeps only the last 100 lines of test output, and suggests hooks that filter a large log for error lines before Claude reads it, which can shrink tens of thousands of tokens to hundreds.

### Subagents and agent teams

A [subagent](https://theaiengineering.com/glossary/subagent) runs in its own context window and sends its own requests, which count toward the same plan limits or API bill as the main conversation. Delegating a verbose job keeps the main context small because only a summary returns, but the subagent's work is still billed. Agent teams go further: Anthropic's docs say they use about 7 times the tokens of a standard session when teammates run in plan mode, because each teammate is a separate Claude instance with its own context.

### Model choice and extended thinking

Opus 5.5 costs twice as much per token as Sonnet 5.5, and since Claude Code version 2.1.280 the `default` model setting resolves to Opus 5.5 on Pro, Max, Ultra, Team, Enterprise, and the Anthropic API, according to the [model configuration docs](https://code.claude.com/docs/en/model-config). Extended thinking is on by default, its tokens bill as output, and Anthropic notes the default budget can reach tens of thousands of tokens per request. Thinking cannot be turned off on Opus 5.5, Sonnet 5.5, Haiku 5.5, or the Fable models, so the effort level is the control there; Fable 5.2 and the 5.5 models default to `medium`.

### MCP tool definitions and CLAUDE.md

Tool definitions sit at the front of every request. Claude Code defers [Model Context Protocol](https://theaiengineering.com/glossary/model-context-protocol) tool definitions by default through tool search, so only tool names and server instructions load at session start and a full definition loads when Claude uses that tool. Each connected server still adds its listing, while command-line tools such as `gh` or `aws` add none. CLAUDE.md, the project instruction file that works like [AGENTS.md](https://theaiengineering.com/glossary/agents-md), loads into every session, so workflow-specific instructions in it cost tokens during unrelated work. Anthropic suggests keeping CLAUDE.md under 200 lines and moving specialized instructions into skills, which load only when invoked.

### Long and idle sessions

A long session costs more per question, because a one-line prompt in a session that has been open all day still re-sends the whole conversation. Cache expiry adds a second cost: the first message after a break longer than the cache lifetime reprocesses the full context at the uncached rate. Scheduled `/loop` tasks, goal check-ins, session recaps, and idle compaction can also send requests while the developer is away, and `/compact` itself is a large request because it reads the conversation it summarizes.

### How prompt caching reduces repeat input costs

[Prompt caching](https://theaiengineering.com/glossary/prompt-caching) lets the API reuse the unchanged start of a request, called the prefix, and bill it at the cache-read rate: 0.05 times the base input price on Opus 5.5 and Sonnet 5.5, and 0.1 times on most other models. Claude Code manages caching automatically and orders each request so content that rarely changes comes first. The match is exact, so a change anywhere in the prefix reprocesses everything after it.

Cache writes cost more than base input: 1.25 times for the five-minute cache and 2 times for the one-hour cache. According to Anthropic's [prompt caching guide for Claude Code](https://code.claude.com/docs/en/prompt-caching), Claude Code requests the one-hour cache for the main conversation only on a subscription within plan usage. With an API key, a cloud provider, or usage credits it defaults to five minutes, and the `promptCacheTtl` setting changes that. Actions that invalidate the cache include switching models, toggling fast mode, adding or removing MCP servers when tools load upfront, compaction, and, on most models, changing the effort level. Anthropic's advice is to pick the model and effort level at the start of a session and compact at natural breaks between tasks.

## How to check Claude Code usage

Claude Code has three built-in views of usage: the `/usage` command (also opened by `/cost` and `/stats`), the `/context` grid, and a configurable status line. All three are local estimates at list price for one machine. Organization-wide numbers come from OpenTelemetry export, the Claude Console dashboard and Analytics API, or Team and Enterprise analytics.

| Tool | Scope | Covers | Who uses it |
|---|---|---|---|
| `/usage` and the status line | One session on one machine | Any billing route, estimated at list price | Every developer |
| OpenTelemetry export | Per user, near real time | Every billing route | Admins, through managed settings |
| Console dashboard and Claude Code Analytics API | Per user, daily | Console API usage only | Console roles with usage access; Admin API key |
| Team and Enterprise analytics | Per user, daily spend report | Usage-credit spend; Enterprise usage via the Analytics API | Admins and Owners |
| Cloud billing console | Per account or project | Bedrock, Agent Platform, Foundry | Cloud admins |
| AI gateway logs | Per request, per key | Any traffic routed through the gateway | Gateway admins |

### The /usage, /cost, and /context commands

`/usage` shows the session's estimated total cost, API time, lines changed, and tokens per model, split into input, output, cache read, and cache write. Since version 2.1.251 it adds a prompt cache line with the share of input served from cache and recent misses. On a subscription it also shows plan usage bars and a breakdown of recent usage by skills, subagents, plugins, and individual MCP servers, with a recommendation for any behavior behind 10% or more of that usage. `/context` draws the current context as a colored grid and flags heavy tools and memory files.

The dollar figure is computed locally at list price, so it will not match a contracted rate. The `modelPricing` managed setting makes `/usage`, the status line, and OpenTelemetry report at the organization's own rates; it changes the estimate, not the charge.

### Status line

The [status line](https://code.claude.com/docs/en/statusline) runs a script you configure and passes it session data as JSON on stdin, including `cost.total_cost_usd`, `context_window.used_percentage`, and, for Pro, Max, and Ultra subscribers, `rate_limits.five_hour.used_percentage` and `rate_limits.seven_day.used_percentage`. That puts the session's estimated cost and remaining plan headroom on screen at all times. Running `/statusline` with a short description generates a script.

### OpenTelemetry export

[OpenTelemetry](https://theaiengineering.com/glossary/opentelemetry) export is, per Anthropic's docs, the only built-in option that streams per-user token and cost metrics into your own observability stack in near real time, and it works on every billing route. Administrators enable it in managed settings so every machine reports to the same collector. This block follows the example in the [monitoring docs](https://code.claude.com/docs/en/monitoring-usage), with resource attributes added for team attribution:

```json
{
  "env": {
    "CLAUDE_CODE_ENABLE_TELEMETRY": "1",
    "OTEL_METRICS_EXPORTER": "otlp",
    "OTEL_LOGS_EXPORTER": "otlp",
    "OTEL_EXPORTER_OTLP_PROTOCOL": "grpc",
    "OTEL_EXPORTER_OTLP_ENDPOINT": "http://collector.example.com:4317",
    "OTEL_RESOURCE_ATTRIBUTES": "department=engineering,team.id=platform,cost_center=eng-123"
  }
}
```

The two cost metrics are `claude_code.cost.usage`, in US dollars, and `claude_code.token.usage`, split by `type` into input, output, cacheRead, and cacheCreation. Both carry `model` and attribution fields such as `agent.name`, `skill.name`, and `mcp_server.name`, and every metric carries `session.id`, `organization.id`, `user.account_uuid`, and `user.email` when available. `OTEL_RESOURCE_ATTRIBUTES` adds labels such as team or cost center. Metrics export every 60 seconds by default, and Anthropic describes the cost metrics as approximations, so reconcile them against the invoice. Our guide to [LLM observability](https://theaiengineering.com/articles/llm-observability) covers backends and dashboards for this data.

### Console, Team, and Enterprise reporting

Console organizations see spend and lines accepted per member on the [Claude Code dashboard](https://platform.claude.com/claude-code), and the [Claude Code Analytics API](https://platform.claude.com/docs/en/build-with-claude/claude-code-analytics-api) returns daily per-user records with input, output, and cache tokens and estimated cost per model, with up to an hour of delay. It needs an Admin API key and covers only usage on the Claude API. Workspace spend limits cap monthly Claude Code spend, and a workspace rate limit keeps Claude Code from crowding out production API traffic in the same organization.

Team and Enterprise admins get the claude.ai [analytics dashboard](https://code.claude.com/docs/en/analytics) for daily active users, sessions, and contribution metrics, plus a spend report with per-user and per-model CSV export. On Enterprise, the Enterprise Analytics API returns per-user usage and cost reports across Claude surfaces, including Claude Code.

## How to track Claude Code spend per developer

Per-developer tracking needs a data source that knows who sent each request. Claude Code attaches the account to its OpenTelemetry metrics, Anthropic's consoles report per-user spend for Console and subscription usage, and a gateway with one key per developer logs every request. On cloud providers, only OpenTelemetry and a gateway give per-user numbers.

**Figure 2: Where Claude Code usage data comes from. Without a gateway, Claude Code calls the provider directly and only the OpenTelemetry and billing paths remain.**

Claude Code sends OTLP metrics to an OTel collector and model requests to an AI gateway, which forwards them to the provider and logs them; provider usage reaches billing consoles.

Components:

- **Claude Code**: /usage, /context, status line local list-price estimates
- **OTel collector**: per-user tokens and cost
- **AI gateway**: one virtual key per developer budgets, limits, request logs
- **Observability backend**: dashboards and alerts
- **Model provider**: Anthropic API, Bedrock, Google Cloud, Foundry
- **Billing and analytics**: Console, claude.ai admin, cloud billing

Groups:

- Your infrastructure: OTel collector, AI gateway, Observability backend
- Provider side: Model provider, Billing and analytics

Connections:

- Claude Code → OTel collector: OTLP metrics
- Claude Code → AI gateway: model requests
- AI gateway → Model provider
- OTel collector → Observability backend
- AI gateway → Observability backend: request logs
- Model provider → Billing and analytics: usage and cost

OpenTelemetry shows what each developer spent, and on which model, skill, or MCP server, in near real time. Anthropic's consoles show what the invoice will say for Console and subscription usage. A gateway shows which request cost what, and it is the only one of the three that can stop a request before it reaches the provider.

Anthropic ships its own option for cloud-provider deployments. The [Claude apps gateway](https://code.claude.com/docs/en/claude-apps-gateway) is a self-hosted service built into the `claude` binary that signs developers in through your identity provider, holds the upstream credential, relays OTLP metrics, and enforces daily, weekly, or monthly spend caps for each developer, set per user, per identity-provider group, or as an organization default.

For sizing organization rate limits, Anthropic's cost guide suggests per-user token-per-minute allowances that fall as teams grow, from 200,000 to 300,000 for 1 to 5 users down to 10,000 to 15,000 above 500 users, because fewer developers run Claude Code at the same moment in large organizations.

## How to reduce Claude Code cost

The largest savings come from matching the model to the task, keeping the context small, and keeping the prompt cache warm. Use Sonnet or Haiku where Opus is not needed, clear between unrelated tasks, keep CLAUDE.md and the MCP server list lean, lower the effort level on simple work, and avoid switching models in the middle of a task.

- **Choose the model per task.** `/model` switches models, and the `opusplan` alias uses Opus in plan mode and Sonnet for execution, though each plan-mode toggle starts a fresh cache. Set `model: haiku` in a subagent's configuration for simple delegated work, or set a default with `CLAUDE_CODE_SUBAGENT_MODEL`. Admins can restrict choices with the `availableModels` managed setting.
- **Clear and compact on purpose.** `/clear` starts a new conversation at no cost and suits a switch to unrelated work. `/compact` accepts focus instructions, such as `/compact Focus on test output and code changes`, and costs least while the cache is warm.
- **Keep CLAUDE.md short.** Move instructions for specific workflows, such as reviews or migrations, into skills.
- **Trim MCP servers.** Disable unused servers in `/mcp`, prefer command-line tools where they exist, and run `/context` to see what fills the window.
- **Limit thinking on simple work.** Lower the level with `/effort`, set `MAX_THINKING_TOKENS` on models with a fixed thinking budget, or cap a fleet with the `maxEffortLevel` managed setting.
- **Filter tool output.** Trim test and log output with hooks, and send verbose jobs to a subagent on a smaller model.
- **Protect the cache.** Choose the model, effort level, and fast mode at the start of a session. API-key users who often step away can set `promptCacheTtl` to `1h`, paying a 2x write price to avoid full reprocessing.
- **Cap automation.** In print mode, `--max-budget-usd` stops a run when estimated spend reaches a limit, and `--max-turns` caps agent turns. Spend can pass the cap, so leave headroom.

Our guide to [context engineering](https://theaiengineering.com/articles/context-engineering) covers the same decisions in more depth, including what enters the window, what gets compressed, and what runs in a separate context.

## Team controls: an AI gateway with one key per developer

An AI gateway sits between Claude Code and the model provider and gives each developer or team its own [virtual key](https://theaiengineering.com/glossary/virtual-key). The gateway then enforces budgets and [rate limits](https://theaiengineering.com/glossary/rate-limiting) per key, logs every request with its tokens and cost, and applies the same rules whether the upstream is Anthropic's API, Bedrock, or Google Cloud.

[Claude Code connects to a gateway](https://theaiengineering.com/articles/claude-code-proxy) through `ANTHROPIC_BASE_URL` plus a gateway credential in `ANTHROPIC_AUTH_TOKEN` or an `apiKeyHelper` script. Anthropic's [LLM gateway docs](https://code.claude.com/docs/en/llm-gateway) describe the rollout: give the gateway the provider credential, issue each developer a gateway credential so usage is attributed and offboarding revokes one key, and distribute the configuration through managed settings. While a gateway credential is active, subscription limits do not apply, and the traffic is billed per token to whoever owns the upstream credential. The gateway must also forward Claude Code's `cache_control` markers: per Anthropic's caching guide, a gateway that silently strips them bills the whole conversation history as uncached input on every turn. Our explainer on [what an AI gateway is](https://theaiengineering.com/articles/what-is-an-ai-gateway) covers the architecture in general.

Bifrost, the open-source (Apache 2.0) AI gateway from Maxim AI, is one example of this pattern. Its documented features for Claude Code traffic include:

- **Virtual keys with budgets.** Each `sk-bf-*` [virtual key](https://docs.getbifrost.ai/features/governance/virtual-keys) carries its own budget and allowed providers and models. [Budgets](https://docs.getbifrost.ai/features/governance/budget-and-limits) also exist for teams, customers, and provider configs; every applicable budget is checked independently, and budgets reset daily, weekly, monthly, quarterly, or yearly.
- **Rate limits.** Request and token limits over windows such as a minute, an hour, or a day apply at the provider-config, virtual-key, team, and customer levels.
- **Alerting.** Bifrost Enterprise evaluates [alert rules](https://docs.getbifrost.ai/enterprise/alerting/overview) over budget and rate-limit usage every 60 seconds and notifies Slack, Microsoft Teams, PagerDuty, or a webhook.
- **Per-request logs.** The built-in log store records tokens, cost, and latency for each request and filters by model, provider, and cost range.
- **Cache-friendly routing.** Session affinity keeps a Claude Code session, including its subagents, on the same provider and key, so the provider's prompt cache keeps hitting.

The [Bifrost CLI](https://docs.getbifrost.ai/quickstart/cli/coding-agents) launches Claude Code with the gateway URL, credential, and model already set for that session, without editing `~/.claude/settings.json`:

```bash
bifrost context add production --base-url https://bifrost.example.com --use
printf '%s\n' "$BIFROST_VIRTUAL_KEY" | bifrost auth set-virtual-key --stdin
bifrost claude --model anthropic/claude-sonnet-4-6
```

Teams that want to keep subscription billing can still route through the gateway for logs and governance. Bifrost's [Claude Code guide](https://docs.getbifrost.ai/cli-agents/claude-code) describes signing in with `/login` and sending the virtual key in an `x-bf-vk` header through `ANTHROPIC_CUSTOM_HEADERS`, in which case the subscription's usage limits still apply.

Where to go next: our comparison of [AI coding agents](https://theaiengineering.com/articles/ai-coding-agents) covers how Claude Code differs from other terminal, IDE, and cloud agents, our [Claude Code vs Cursor](https://theaiengineering.com/articles/claude-code-vs-cursor) comparison sets the two plans side by side, and the [AI coding tools directory](https://theaiengineering.com/platforms/ai-coding-tools) lists the products by surface, model choice, and license.

## Frequently asked questions

### How much does Claude Code cost per month?

As of November 2026, Claude Code is included in Claude Pro at $20 a month, Max at $100, and Ultra at $200, with Team seats from $20 per seat per month billed annually. Pay-as-you-go use through an API key is billed per token instead. Anthropic's documentation reports that enterprise deployments average $150 to $250 per developer per month, so heavy users on API billing can pass the price of a subscription.

### Is Claude Code free?

No. Claude Code is not included in the Free Claude plan. It comes with every paid plan, including Pro, Max, Ultra, Team, and Enterprise, and it can also run on pay-as-you-go API credits from a Claude Console account or on Amazon Bedrock, Google Cloud's Agent Platform, or Microsoft Foundry, where the cloud provider bills each token. Every route therefore draws on either a paid plan's usage limits or per-token billing.

### Is a Claude subscription or the API cheaper for Claude Code?

A subscription is usually cheaper for a developer who uses Claude Code most working days, because the plan price is fixed and usage limits reset every five hours and every week. API billing suits occasional use, automation, and teams that need per-token accounting and no plan limits. Anthropic's enterprise averages of $150 to $250 per developer per month are a useful break-even reference against the $100 Max plan.

### How do I check my Claude Code usage?

Run /usage inside Claude Code. It shows the session's estimated cost and tokens per model, the prompt cache hit rate, and, on a subscription, plan usage bars with a breakdown by skills, subagents, plugins, and MCP servers. /cost and /stats open the same screen. /context shows what fills the context window, and a custom status line can display cost and context use continuously.

### How much does Claude Code Enterprise cost?

Anthropic's pricing page listed Claude Enterprise at $20 per seat per month, billed annually with a 20-seat minimum, plus usage charged at API rates, on November 16, 2026. Claude Code is included with the seat, and usage-based Enterprise plans have no per-seat usage limits. Admins set spend limits per user and for the organization, and volume or committed-spend discounts are negotiated with Anthropic's sales team.

### How do I track Claude Code usage per developer?

Enable OpenTelemetry export through managed settings, which sends per-user token and cost metrics from every machine to your own collector on any billing route. Console organizations also get per-member spend on the Claude Code dashboard and the Claude Code Analytics API, and Team or Enterprise admins get a per-user spend report. An AI gateway with one virtual key per developer adds per-request logs and budgets.

## Terms in this guide

- [AI gateway](https://theaiengineering.com/glossary/ai-gateway): An AI gateway is a proxy layer between applications and model providers that exposes one API for many models and centralizes routing, failover, access control, cost tracking, caching, and logging.
- [Tokens](https://theaiengineering.com/glossary/tokens): Tokens are the units of text a language model processes, typically whole words, word fragments, punctuation, or bytes, each mapped to an integer ID from the model's fixed vocabulary.
- [Context window](https://theaiengineering.com/glossary/context-window): A context window is the maximum number of tokens a language model can take into account in a single request, including the system prompt, conversation history, tool results, and the generated output.
- [Context compaction](https://theaiengineering.com/glossary/context-compaction): Context compaction is a context management technique that replaces older conversation turns with a model-written summary as the context window nears its limit, so an agent can keep working.
- [Subagent](https://theaiengineering.com/glossary/subagent): A subagent is an AI agent that another agent starts for one subtask, running in a separate context window with its own instructions and tools, and returning only a condensed result.
- [Model Context Protocol (MCP)](https://theaiengineering.com/glossary/model-context-protocol): Model Context Protocol (MCP) is an open protocol, introduced by Anthropic in November 2024, that standardizes how AI applications connect to external tools, data sources, and prompts through MCP servers.
- [AGENTS.md](https://theaiengineering.com/glossary/agents-md): AGENTS.md is an open format for a plain Markdown file, placed at a repository's root and optionally in subdirectories, that gives AI coding agents project instructions such as build commands, test commands, and conventions.
- [Prompt caching](https://theaiengineering.com/glossary/prompt-caching): Prompt caching is an LLM API and inference-server feature that stores the computed attention state for a repeated prompt prefix, so later requests sharing that prefix skip reprocessing it.
- [OpenTelemetry](https://theaiengineering.com/glossary/opentelemetry): OpenTelemetry is an open source, vendor-neutral observability framework of APIs, SDKs, a wire protocol, and naming conventions for traces, metrics, and logs, including conventions for LLM calls and agent runs.
- [Virtual key](https://theaiengineering.com/glossary/virtual-key): A virtual key is an API key issued by an AI gateway that maps a caller to its allowed models, budget, and rate limits, while the gateway keeps the real provider credentials.
- [Rate limiting](https://theaiengineering.com/glossary/rate-limiting): Rate limiting is the enforcement of a maximum number of requests or tokens a client may send to an API within a time window, with excess requests rejected, usually with HTTP 429.

## Related guides

- [Claude Code proxy: run Claude Code through an LLM gateway](https://theaiengineering.com/articles/claude-code-proxy): A Claude Code proxy routes Claude Code through an LLM gateway. Set ANTHROPIC_BASE_URL for Bifrost, LiteLLM, OpenRouter, Bedrock, or Vertex, and fix errors.
- [Claude Code vs Cursor: how the two coding agents differ](https://theaiengineering.com/articles/claude-code-vs-cursor): Claude Code vs Cursor compared: terminal agent vs AI editor, models, subagents, hooks, rules files, code review, CI use, pricing, and enterprise controls.
- [AI coding agents: how they work and how the major tools compare](https://theaiengineering.com/articles/ai-coding-agents): AI coding agents compared: how they differ from autocomplete, the four main categories, a comparison table of major tools, and how to evaluate and secure them.
- [What is context engineering? A practical guide for AI agents](https://theaiengineering.com/articles/context-engineering): Context engineering is the practice of choosing what fills an LLM context window. Learn its components, why context rot happens, and how to measure results.

Part of the [AI coding agents](https://theaiengineering.com/topics/ai-coding) topic hub.

## Cite this guide

The AI Engineering Editors. "Claude Code cost: how billing works and how to track spend per developer." The AI Engineering, updated Nov 20, 2026. https://theaiengineering.com/articles/claude-code-cost

- Title: Claude Code cost: how billing works and how to track spend per developer
- Author: The AI Engineering Editors
- Publisher: The AI Engineering
- Published: 2026-11-20
- Updated: 2026-11-20
- URL: https://theaiengineering.com/articles/claude-code-cost
- Markdown: https://theaiengineering.com/articles/claude-code-cost.md

To cite one section, link to its anchor:

- [How much does Claude Code cost?](https://theaiengineering.com/articles/claude-code-cost#how-much-does-claude-code-cost)
- [How Claude Code is billed](https://theaiengineering.com/articles/claude-code-cost#how-claude-code-is-billed)
- [What drives token use in Claude Code](https://theaiengineering.com/articles/claude-code-cost#what-drives-token-use-in-claude-code)
- [How to check Claude Code usage](https://theaiengineering.com/articles/claude-code-cost#how-to-check-claude-code-usage)
- [How to track Claude Code spend per developer](https://theaiengineering.com/articles/claude-code-cost#how-to-track-claude-code-spend-per-developer)
- [How to reduce Claude Code cost](https://theaiengineering.com/articles/claude-code-cost#how-to-reduce-claude-code-cost)
- [Team controls: an AI gateway with one key per developer](https://theaiengineering.com/articles/claude-code-cost#team-controls-an-ai-gateway-with-one-key-per-developer)
- [Frequently asked questions](https://theaiengineering.com/articles/claude-code-cost#faq)
