Claude Code pricing: subscription plan or pay-as-you-go API?

Key takeaways
- You pay for Claude Code in one of two ways: an Anthropic subscription, or per-token API billing. Current plan prices are on Anthropic's pricing page.
- Every subscription has usage limits, and Claude Code shares them with Claude chat on the web, desktop and mobile.
- An agent resends the whole conversation on every request, so on API billing most of the bill is input tokens.
- Point Claude Code at a FastMetal key and it bills per token from a prepaid balance, and the balance is your spending cap.
- Change
ANTHROPIC_MODELand the same Claude Code session runs GLM, DeepSeek or Kimi.
Plan prices change often, and what decides your monthly cost is how you pay and how many tokens your work uses. So this post leaves the dollar figures to Anthropic and covers the mechanics: what each option bills for, where the limits bite, how agent token usage adds up, and how to run Claude Code on a FastMetal key. Anthropic's pages were checked on October 6, 2026.
Four ways to pay for Claude Code
| Option | Billing unit | What limits you |
|---|---|---|
| Pro or Max plan | Flat monthly fee | Five-hour and weekly usage limits, shared with Claude chat |
| Team or Enterprise plan | Per seat; Enterprise adds usage at API rates | Plan limits and admin settings |
| Anthropic API | Per million tokens | Purchased credits and rate limits |
| FastMetal API key | Per million tokens, prepaid | Your balance |
How the subscription limits work
Claude Code is included in both Pro and Max. Max gives you 5x or 20x the usage of Pro.
None of the plans is unlimited. There is a five-hour session limit and a weekly limit, and you can watch both in your claude.ai settings. Usage is shared across Claude on the web, desktop and mobile and Claude Code in the terminal or IDE, so an afternoon of long documents in chat leaves less for Claude Code in the evening.
What uses up the limit fastest
Anthropic's docs name these patterns as the big consumers in long sessions:
- A session left open all day. Every request sends the whole conversation, so even a one-line question costs the full history.
- Coming back after a long break. Once the cache expires, the whole context is processed again.
- Subagents and agent teams, which each send their own requests.
- Scheduled tasks and loops, which send the full context on every run.
Where you hit the limit depends on the model, the length of the conversation and the size of the repository. In Claude Code, /usage shows your plan usage and what is consuming it.
When you hit the limit
Anthropic's help center lists four options:
- Wait for the limit to reset.
- Move to a bigger plan (Pro to Max 5x, Max 5x to Max 20x).
- Turn on usage credits and keep working at standard API rates.
- Switch to a Claude Console account and buy API credits.
Options 3 and 4 are both pay-as-you-go at API rates. Also check your environment: if ANTHROPIC_API_KEY is set, Claude Code authenticates with that key in place of your subscription and you pay API rates. If a flat plan has turned into a per-token bill, that variable is the first thing to look at. For the limit messages themselves, see Claude usage limit reached.
API billing: the agent resends the conversation every time
On the API you pay per million input tokens and per million output tokens, at a rate set for each model. Anthropic lists the rates in the API section of its pricing page.
What matters with Claude Code is how fast the tokens add up. It sends the whole conversation with every request, and each time Claude uses a tool, the result goes back in another request. One instruction to read a file, edit it and run the tests becomes dozens of requests behind the scenes.
Say your session is already at 50,000 tokens and a task takes 30 requests. That is roughly 1.5 million input tokens. The code and explanations Claude writes back come to a few tens of thousands of tokens. That shape is why input dominates an agent's bill.
Prompt caching and thinking tokens
Prompt caching covers the parts that are sent again and again. History read from the cache is billed at the cache-read rate, which brings the cost of resending down. In an example /usage readout in Anthropic's docs, a session with 1.2k input and 5.3k output tokens also had 940k tokens of cache reads: the cache was carrying almost all of the resending.
Two things to watch:
- The cache lifetime. It is 5 minutes by default with an Anthropic API key, and 1 hour on a subscription. Step away for longer and the next message reprocesses the whole context.
- Thinking tokens. They are billed as output tokens at the output rate, even when you never see them, and that is also true through FastMetal. On Opus 5.5, Sonnet 5.5 and Fable thinking cannot be turned off, so for simple work, lower it with
/effortto cut output.
Four ways to make Claude Code cheaper
These are the ones from Anthropic's own advice that make the biggest difference:
- Run
/clearwhen you move to unrelated work. Old context keeps costing tokens on every later message. - Use Sonnet for everyday coding and save Opus for hard design work and multi-step reasoning (switch with
/model). - Hand verbose jobs such as test runs and log analysis to subagents on a smaller model.
- Keep
CLAUDE.mdto what is essential and move detailed procedures into skills.
Subscription or API: which to choose
A plan's monthly fee does not convert into a number of API tokens, because the plan limits move with the model and the length of the conversation. As a rule of thumb:
| Your situation | Best fit |
|---|---|
| You use it every day, at a steady level | Subscription (Max if Pro runs out) |
| You hit the limit only a few days a month | Subscription plus usage credits |
| Your usage swings a lot from month to month | API, pay as you go |
| You need separate budgets per team or project | API, with a cap per key |
| You want models other than Claude for some tasks | A FastMetal API key |
A subscription costs the same every month; on the API you pay for what you use. On FastMetal the balance you bought is the ceiling, so pay-as-you-go never runs past it.
Run Claude Code on a FastMetal API key
FastMetal is an AI gateway: one API key for models from many labs. It has an Anthropic-compatible API, so Claude Code switches over with a few environment variables:
export ANTHROPIC_AUTH_TOKEN="$FASTMETAL_API_KEY"
export ANTHROPIC_BASE_URL="https://api.fastmetal.ai"
export ANTHROPIC_MODEL="anthropic-claude-sonnet-5" # optional
export ANTHROPIC_DEFAULT_HAIKU_MODEL="anthropic-claude-haiku-4-5" # required
Three things trip people up:
- Put the key in
ANTHROPIC_AUTH_TOKEN. InANTHROPIC_API_KEYit is sent as anx-api-keyheader, which FastMetal rejects. - Stop
ANTHROPIC_BASE_URLat the host. Add/v1and the path becomes/v1/v1/messages, which Claude Code reports as a model-access problem. - Always set
ANTHROPIC_DEFAULT_HAIKU_MODELto a FastMetal model ID. Claude Code sends its built-in Haiku ID for background work, FastMetal rejects that ID, and the background features fail if the variable is empty (checked in October 2026).
The full steps are in the Claude Code setup guide.
What you pay, and what caps it
With the key set, Claude Code authenticates with it in place of your claude.ai login. No plan limits apply; the tokens you use come out of your FastMetal balance.
- Prepaid credit, billed per million tokens. The rate for each model is on the pricing page.
- There is no subscription. Top up by card with a $5 minimum.
- Your balance is your spending cap. You get an email when it runs low and when it runs out, and after that requests are refused.
- You can issue several keys and give each one a daily or weekly spending cap. The usage page breaks spend down by model and by day.
Since input dominates an agent's bill, compare models on their input rate, and prefer models with prompt caching to keep the cost of resending down. Prompt caching works on Claude models through FastMetal (checked in October 2026).
Switch to GLM, DeepSeek or Kimi with ANTHROPIC_MODEL
On a FastMetal key, ANTHROPIC_MODEL takes any model ID in the catalog. Claude Code works the same; only the model underneath changes.
# Pick one
export ANTHROPIC_MODEL="glm-5.2" # Z.ai GLM 5.2
export ANTHROPIC_MODEL="deepseek-v4-pro" # DeepSeek V4 Pro
export ANTHROPIC_MODEL="kimi-k3" # Moonshot AI Kimi K3
That lets you run routine refactors and test writing on a lower-priced model and go back to Claude for the work that needs judgment. Compare rates and context lengths on the GLM 5.2, DeepSeek V4 Pro and Kimi K3 pages. Each model page also shows its data policy: whether prompts are used for training and whether they are kept. /v1/models on the API returns the full list of IDs.
Anthropic does not support Claude Code running on non-Claude models, and tool-call handling differs from model to model. Try a small task first.
Pricing for other coding agents
The same reasoning applies to the other agents:
- Codex pricing: when a ChatGPT plan fits and when API billing does
- Cline pricing: you bring your own key, so you pay only for the model
- Use Claude Code with an API key: the FastMetal setup and switching models
FAQ
Is Claude Code free?
According to Anthropic's pricing page, Claude Code comes with the Pro, Max, Team and Enterprise plans and is not part of the Free plan. You can also run it on API billing, which on FastMetal starts with a $5 top-up and charges only for the tokens you use.
What is the difference between Pro and Max?
Max gives you 5x or 20x the usage of Pro, plus priority access at busy times. Both have usage limits, and both share them between Claude chat and Claude Code. Check Anthropic's pricing page for the monthly fees.
What should I watch for when I use both a plan and an API key on one machine?
If ANTHROPIC_API_KEY is set, Claude Code uses that key in place of your plan and bills API rates. With a FastMetal key in ANTHROPIC_AUTH_TOKEN, usage comes out of your FastMetal balance. Unset these variables to go back to your plan.
How do I avoid overspending?
On FastMetal the balance you bought is the cap, and you can also give each key a daily or weekly spending cap. If you use usage credits on an Anthropic plan, set a monthly spending limit in your claude.ai settings.
Get started
Create an account, top up from $5 and issue a key, and Claude Code is ready to go.
Create an account | See pricing | Claude Code setup guide