Build This Now
Build This Now
O que é o Código Claude?Instalar o Claude CodeInstalador Nativo do Claude CodeO Teu Primeiro Projeto com Claude Code
Claude Code v2.1.122 Release NotesClaude Code Dynamic Workflows: Como Orquestrar 1.000 Subagentes Num Codebase RealMelhores Práticas do Claude CodeBoas Práticas para o Claude Opus 4.7Claude Code num VPSIntegração GitRevisão de Código com ClaudeWorktrees no Claude CodeControle Remoto do Claude CodeChannels do Claude CodeChannels, Routines, Teleport, DispatchTarefas Agendadas no Claude CodePermissões do Claude CodeModo Auto do Claude CodeAdicionar Pagamentos Stripe Com o Claude CodeFeedback LoopsFluxos de Trabalho com TodosTarefas no Claude CodeTemplates de ProjetoPreços e Consumo de Tokens no Claude CodePreços do Claude Code: O Que Vais Mesmo PagarClaude Code Ultra ReviewConstruir Uma App Next.js Com o Claude CodeClaude Code With Supabase: Database, Auth, RLSVercel deepsec with Claude CodeComércio Agêntico: Como Construir uma App Que Agentes de IA Podem PagarClaude Code 1M Context in Practice: When Bigger Isn't BetterClaude Code GitHub Actions Setup Guide (@claude + Cron)Claude Code Headless Mode: The Definitive Guide to claude -pClaude Code Max Plan vs API Cost: Break-Even GuideClaude Code Prompt Caching: The Token Discount Most People Never Turn OnRun a Team of AI Agents in Parallel with Git WorktreesPrompt Injection in Coding Agents: How to Not Get Pwned
speedy_devvkoen_salo
Blog/Handbook/Workflow/Claude Code Max Plan vs API Cost: Break-Even Guide

Claude Code Max Plan vs API Cost: Break-Even Guide

Claude Code max plan vs api cost, decided by math. A Max 5x subscription beats an API key once you spend about $3.33/day; Max 20x breaks even at $6.67/day.

Pare de configurar. Comece a construir.

Templates SaaS com orquestração de IA.

Published Jun 15, 20269 min readHandbook hubWorkflow index

If you use Claude Code and want to know whether the Claude Code max plan vs api cost question favors a subscription or a raw API key, the answer is a dollar break-even. A Max 5x subscription ($100/month) beats pay-as-you-go the moment your API-equivalent spend would top about $3.33/day, and Max 20x ($200/month) breaks even around $6.67/day. Below those lines an API key is cheaper. Above them the subscription is effectively unlimited value until you hit a rate limit.


Pare de configurar. Comece a construir.

Templates SaaS com orquestração de IA.


The short answer (break-even at a glance)

The decision rule is one inequality. Let S be your flat subscription fee and C_api be what the same work would cost at API rates.

If  C_api  >  S   →  subscription is cheaper
If  C_api  <  S   →  API key (pay-as-you-go) is cheaper

Spread each flat fee across a 30-day month and you get a daily threshold you can sanity-check against your own habits.

PlanMonthly feeDaily break-even
Pro$20~$0.67/day of API-equivalent usage
Max 5x$100~$3.33/day
Max 20x$200~$6.67/day

If your measured API spend would exceed those figures most days, subscribe. If it sits below, an API key wins. Anthropic no longer publishes exact message-per-window counts, so this dollar model is the honest way to decide, not a claim about how many messages you get.

How Claude Code billing actually works

There are two billing modes, and which one you are in is decided by a single environment variable.

Subscription auth (the default)

By default, Claude Code authenticates against your Claude subscription. Interactive sessions draw on your plan's rolling-window allowance, not a dollar meter. You are not charged per token. You consume usage against a window, and when the window resets you get your allowance back.

This is the mode most people are in without thinking about it. You log in, you build, the meter you watch is "am I close to a rate limit," not "how many dollars did that cost."

API-key billing (the override)

Set an ANTHROPIC_API_KEY environment variable and everything changes. Claude Code then bills pay-as-you-go at API rates regardless of which plan you hold. The subscription is ignored.

# bill against your subscription's rolling window (default)
unset ANTHROPIC_API_KEY

# bill pay-as-you-go at API rates instead
export ANTHROPIC_API_KEY="sk-ant-..."

This is the lever the whole comparison turns on. If you want the API path, you opt into it with a key. If you want the subscription path, you make sure that variable is not set.

The June 15, 2026 change (Agent SDK credit pool)

There is a wrinkle that took effect the day this post went up. As of June 15, 2026, non-interactive usage (the Agent SDK, claude -p, GitHub Actions, third-party apps) draws from a separate monthly credit pool, not your interactive 5-hour window.

The pool is $20 on Pro, $100 on Max 5x, and $200 on Max 20x. It does not roll over. When it is exhausted, usage flows to API-rate credits if you have enabled them, otherwise the requests stop. If you run a lot of headless or CI automation, budget for that pool on top of your interactive work, and read the June 2026 billing change before you wire Claude Code into a pipeline.

What you actually pay per token on the API

When you are in API-key mode, these are the rates the bill is built from. They are the per-million-token prices for the models you run inside Claude Code.

ModelContextInput $/MTokOutput $/MTokCache write (5-min)Cache read
Opus 4.81M$5.00$25.00~$6.25~$0.50
Sonnet 4.61M$3.00$15.00~$3.75~$0.30
Haiku 4.5200K$1.00$5.00~$1.25~$0.10
Fable 51M$10.00$50.00~$12.50~$1.00

Two things to read from this table. Output is five times the input rate on every model, so output length, not input size, is what moves your bill. And the cache columns matter: cache writes cost 1.25x the input rate for the default 5-minute TTL, while cache reads cost about 0.1x. The cache-write and cache-read figures above are derived from those multipliers, not separately published per cell. For the full per-model breakdown, see the Claude Code pricing guide.

The break-even math (with worked examples)

The formula has one job: turn token volume into a dollar figure you can compare to your flat fee.

The formula

C_api = (input_tokens_uncached  / 1e6 × input_rate)
      + (input_tokens_cache_write / 1e6 × input_rate × 1.25)
      + (input_tokens_cache_read  / 1e6 × input_rate × 0.10)
      + (output_tokens / 1e6 × output_rate)

Run that for a month, compare C_api to your subscription fee, and you have your answer. To make it concrete, the next two tables walk a realistic session through the math.

Cost per session, uncached

Take a "session" as 100K input tokens plus 20K output tokens, a realistic mid-size Claude Code turn carrying context. With no caching, here is the cost per session and how many sessions it takes to break even on each Max tier.

ModelInput (100K)Output (20K)$/sessionSessions to hit $100 (Max 5x)Sessions to hit $200 (Max 20x)
Haiku 4.5$0.10$0.10$0.205001,000
Sonnet 4.6$0.30$0.30$0.60~167~333
Opus 4.8$0.50$0.50$1.00100200
Fable 5$1.00$1.00$2.0050100

Read the Opus row. Doing about 100 Opus sessions a month puts you at $100 of API value, which is the Max 5x line. At 200 sessions a month you cross the Max 20x line. Heavy daily Opus users blow past both, and the subscription wins decisively.

Cost per session, with caching

That uncached table overstates real cost, because Claude Code caches aggressively. It reuses a large stable prefix (system prompt, file context) across turns, so most of your input is cache reads at about 0.1x. Take the same 100K input but assume 90K of it is a cache read and 10K is fresh, with 20K output, on Sonnet 4.6.

fresh input : 10,000  / 1e6 × $3.00        = $0.030
cache read  : 90,000  / 1e6 × $3.00 × 0.10 = $0.027
output      : 20,000  / 1e6 × $15.00       = $0.300
-------------------------------------------------
per turn                                   = $0.357

That is $0.357 versus $0.60 fully uncached, about a 40% cut, and almost all of it comes from cache reads on the input. The morphllm source measures an 81% cut on the input portion alone. Notice what dominates once caching is on: output, at $0.30 of a $0.357 turn. Model choice and output length matter more than input size. If you are below break-even and want to stay on an API key longer, read how prompt caching works and lean on it.

Break-even token volumes by plan and model

Putting it together, here is the monthly token volume at which the subscription beats an API key, by model, uncached. If your sessions are heavily cached, divide the input portion by roughly 10.

PlanOpus 4.8Sonnet 4.6Haiku 4.5
Pro ($20)~2M in + 0.4M out/mo~3.3M in + 0.7M out~10M in + 2M out
Max 5x ($100)~10M in + 2M out/mo~17M in + 3.3M out~50M in + 10M out
Max 20x ($200)~20M in + 4M out/mo~33M in + 6.7M out~100M in + 20M out

These figures are illustrative. They assume the 100K-in / 20K-out session ratio above and are derived from the verified API rates, not published caps. The honest takeaway: most daily-driver Opus users on Claude Code cross the Max 5x line within the month.

The catch: rate limits cap the subscription's value

The dollar break-even is only half the decision. A subscription is "cheaper" only up to the point where you hit a rate limit and get throttled.

All consumer plans reset usage on a roughly 5-hour rolling window, which was doubled permanently for Pro and Max on May 6, 2026. Max adds two weekly caps on top, one across all models and one for Sonnet-only, raised about 50% as a promo running through July 13, 2026. Anthropic does not publish exact numbers for any of these, so treat any specific count you see as an estimate.

Here is the trade-off in one sentence. A subscription is a flat fee with a soft ceiling (rate limits), and an API key is uncapped spend with no throttle. Heavy Opus users on long agentic runs can hit the 5-hour or weekly cap, and at that point the effective value of the subscription stops rising. If you cannot afford to be throttled mid-run, the uncapped API key is worth its higher cost. If you can absorb the occasional pause, the flat fee almost always wins on price.

So which should you pick?

Map your usage pattern to the row that fits.

Your usagePickWhy
Light or occasional, a few sessions a weekPro or API keyYou will not cross $20/mo of API value; pay the lower of the two
Daily Opus driverMax 5xDaily Opus use crosses $3.33/day fast; flat fee beats per-token
All-day agentic, multiple sessionsMax 20xYou need the headroom; $6.67/day is easy to exceed at this volume
Spiky or unpredictable, often very lowAPI keyPay exactly for what you use instead of a flat fee you may not earn back
Headless / CI heavyWatch the credit poolAs of June 15, 2026, non-interactive usage bills from a separate pool

If you are below break-even today and want to push that line further out, the fastest win is to cut your token costs with caching and tighter context, then optimize your usage against the rate-limit windows. When the cheapest-model question comes up, Haiku 4.5 at $1/$5 is the floor.

Frequently asked questions

Is the Claude Max plan worth it for Claude Code?

Yes, if your projected API-equivalent spend would exceed the flat monthly fee. Max 5x ($100/month) pays for itself once your API usage would top about $3.33/day, and Max 20x ($200/month) breaks even around $6.67/day. Below that, an API key is cheaper.

What is the difference between Max 5x and Max 20x for Claude Code?

Both are the same Claude Max plan at different usage multipliers. Max 5x costs $100/month and gives roughly five times Pro's usage allowance. Max 20x costs $200/month and gives roughly twenty times. The models and features are identical, only the rate-limit headroom changes.

Does using an API key in Claude Code override my subscription?

Yes. Setting an ANTHROPIC_API_KEY environment variable switches Claude Code to pay-as-you-go API billing and ignores your Pro or Max subscription entirely. Unset the variable to go back to billing against your subscription's rolling-window allowance.

How much does Claude Code cost per token on the API?

On the Anthropic API, Opus 4.8 costs $5 per million input tokens and $25 per million output tokens. Sonnet 4.6 is $3/$15, Haiku 4.5 is $1/$5, and Fable 5 is $10/$50. Cache reads are billed at roughly 10% of the input rate.

At what usage does the Claude subscription beat the API?

The dollar break-even is about $3.33/day of API-equivalent usage for Max 5x ($100/month) and about $6.67/day for Max 20x ($200/month). For Pro ($20/month) it is about $0.67/day. If your measured API spend would exceed those figures most days, the subscription is cheaper.

Do Claude Code Max plans have weekly limits?

Yes. Max 5x and Max 20x carry two weekly caps: one across all models and one for Sonnet-only usage. Anthropic does not publish exact numbers, and these caps were raised about 50% as a promo running through July 13, 2026. Pro has no separate weekly cap, only the rolling window.

Can I run Claude Code headlessly on my subscription?

Yes, but as of June 15, 2026 non-interactive usage (the Agent SDK, claude -p, and GitHub Actions) draws from a separate monthly credit pool rather than your interactive 5-hour window. The pool is $20 on Pro, $100 on Max 5x, and $200 on Max 20x, and it does not roll over.

Is Claude Code included in Claude Pro?

Yes. Claude Code is included in Pro ($20/month) with the lowest rate limits. The Max tiers include the same Claude Code access with five times or twenty times the usage allowance, which matters if you run Opus on long agentic sessions.

How does prompt caching change Claude Code costs?

Prompt-cache reads are billed at about 10% of the normal input rate, so a heavily-cached coding session costs a fraction of its raw token count. Because Claude Code reuses a large stable prefix across turns, most input becomes cache reads, which can cut the input portion of the bill by around 80%.

Should a solo developer pick Pro, Max 5x, or an API key for Claude Code?

Pick Pro for light or occasional use, Max 5x if you drive Opus daily, and Max 20x for all-day agentic work across multiple sessions. Choose an API key only for low or spiky volume you cannot predict, where you would rather pay exactly for what you use than a flat fee.

Continue in Workflow

  • Comércio Agêntico: Como Construir uma App Que Agentes de IA Podem Pagar
    Um guia em português simples sobre comércio agêntico em 2026: o que fazem o x402, o ACP e o Machine Payments Protocol, mais um passo a passo de fim de semana para lançar uma API paga que agentes de IA podem comprar.
  • Melhores Práticas do Claude Code
    Cinco hábitos separam os engenheiros que entregam com Claude Code: PRDs, regras modulares em CLAUDE.md, slash commands personalizados, resets com /clear e uma mentalidade de evolução do sistema.
  • Modo Auto do Claude Code
    Um segundo modelo Sonnet revê cada chamada de ferramenta do Claude Code antes de ser executada. O que o modo auto bloqueia, o que permite e as regras de permissão que cria nas tuas definições.
  • Channels, Routines, Teleport, Dispatch
    As quatro funcionalidades de Claude Code que a Anthropic lançou em março e abril de 2026 e que transformam a CLI numa camada de coordenação orientada a eventos entre telemóvel, web e desktop.
  • Claude Code 1M Context in Practice: When Bigger Isn't Better
    The 1M-token context window is GA at flat pricing, but bigger isn't always better. A decision framework, token-cost math, and when to use /compact, subagents, and dynamic workflows instead.
  • Channels do Claude Code
    Liga o Claude Code ao Telegram, Discord ou iMessage com plugins MCP. Walkthroughs de configuração e os fluxos de trabalho assíncronos e mobile-first que tornam a ligação válida.

More from Handbook

  • Fundamentos do agente
    Cinco maneiras de criar agentes especializados no Código Claude: Sub-agentes de tarefas, .claude/agents YAML, comandos de barra personalizados, personas CLAUDE.md e prompts de perspetiva.
  • Engenharia de Harness para Agentes
    O harness é cada camada ao redor do seu agente de IA, exceto o modelo em si. Aprenda os cinco pontos de controle, o paradoxo das restrições, e por que o design do harness determina o desempenho do agente mais do que o modelo.
  • Padrões de Agentes
    Orchestrator, fan-out, cadeia de validação, routing especializado, refinamento progressivo e watchdog. Seis formas de orquestração para ligar sub-agentes no Claude Code.
  • Boas Práticas para Equipas de Agentes
    Padrões testados em produção para Equipas de Agentes Claude Code. Prompts de criação ricos em contexto, tarefas bem dimensionadas, posse de ficheiros, modo delegado, e correções das versões v2.1.33-v2.1.45.

Pare de configurar. Comece a construir.

Templates SaaS com orquestração de IA.

Claude Code Headless Mode: The Definitive Guide to claude -p

How to run Claude Code non-interactively with claude -p — output formats, jq parsing, stdin piping, permission flags, and when to reach for the Claude Agent SDK instead.

Claude Code Prompt Caching: The Token Discount Most People Never Turn On

Claude Code prompt caching is automatic and bills cached tokens at ~10% of normal input. Here's how to stop leaking the 90% discount, with real cost math.

On this page

The short answer (break-even at a glance)
How Claude Code billing actually works
Subscription auth (the default)
API-key billing (the override)
The June 15, 2026 change (Agent SDK credit pool)
What you actually pay per token on the API
The break-even math (with worked examples)
The formula
Cost per session, uncached
Cost per session, with caching
Break-even token volumes by plan and model
The catch: rate limits cap the subscription's value
So which should you pick?
Frequently asked questions
Is the Claude Max plan worth it for Claude Code?
What is the difference between Max 5x and Max 20x for Claude Code?
Does using an API key in Claude Code override my subscription?
How much does Claude Code cost per token on the API?
At what usage does the Claude subscription beat the API?
Do Claude Code Max plans have weekly limits?
Can I run Claude Code headlessly on my subscription?
Is Claude Code included in Claude Pro?
How does prompt caching change Claude Code costs?
Should a solo developer pick Pro, Max 5x, or an API key for Claude Code?

Pare de configurar. Comece a construir.

Templates SaaS com orquestração de IA.