Claude Code API vs. Subscription: Costs, Limits, and How to Choose

A calendar allowance and a metered token panel connected to the same coding terminal

A Claude Code subscription can offer excellent value for regular coding. API billing can be cheaper for occasional work and easier to budget by project. The useful comparison is the total cost of completing your work, including limits and interruptions.

This guide checks official documentation on 2026-10-26. Prices are USD before tax for direct web purchases; regional and mobile-store prices can differ. CLI commands and options were checked against locally installed Claude Code 2.1.310. The calculations below are examples, not measured bills or promised subscription capacity.

1. The same coding tool, three ways to pay

Claude Code is the coding tool. Your active credential determines which billing route it uses.

RouteWhat pays for the workWhat to watch
Subscription allowanceIncluded usage in Pro or MaxSession and weekly limits
Subscription usage creditsSeparately funded overage after included usage runs outCredit balance and monthly spending limit
API billingToken usage charged to a Claude Console organization or configured providerModel rates, spend limits, and API rate limits

For individual web subscriptions, Pro is $20/month, Max 5x is $100/month, and Max 20x is $200/month. Pro’s annual option is $200 paid upfront; the website rounds its monthly equivalent to $17. (Official pricing, Max tiers)

Official Pro and Max price cards showing the Pro annual headline, its $20 monthly option, and Max starting at $100

Anthropic’s public subscription price cards. Read the billing-period text beneath the headline price. (Source: Claude pricing, captured 2026-10-26)

Select any documentation image in this guide to open it at full size.

Max’s 5x and 20x refer to per-session capacity relative to Pro. They do not promise that many monthly tokens or completed tasks. Session limits reset every five hours, and weekly limits also apply. Claude chat and Claude Code draw on shared plan usage. Check your own reset times and remaining allowance in Settings > Usage. (Max limits, Shared usage limits)

2. Five assumptions that change the comparison

Common assumptionMore accurate guidance
The API never stops youAPI request, token-throughput, and spending limits can pause work
A subscription permits only one terminalParallel sessions are supported; their consumption still adds up
Subscriptions cannot run in CIAnthropic’s GitHub Action supports subscription OAuth tokens
Caching cuts the whole bill by 90%Discounts apply to eligible cached input; writes and output have their own prices
Every account change loses the conversationConfiguration directories can isolate work/personal subscription logins and their histories; plan the handoff explicitly

These distinctions are documented in API limits, parallel worktrees, GitHub Actions authentication, prompt caching, and multiple-account authentication.

A subscription is a capped allowance for a recurring fee. An API account gives you a metered budget and a throughput allocation. Neither arrangement guarantees an uninterrupted afternoon.

3. Estimate an API bill without guessing

A token is a unit of text processed by the model. In an agent loop, instructions, file contents, previous messages, and tool results can become input; generated text and tool calls contribute output. A short request can therefore lead to substantial usage.

Use four separate billing buckets: ordinary input, cache writes, cache reads, and output. Do not charge the same input tokens as both ordinary input and a cache write.

The following standard, global-routing rates were listed in the official API pricing table when checked. Amounts are per million tokens. This table is limited to two models; availability and other model prices differ.

ModelOrdinary input5-minute cache writeCache readOutput
Sonnet 5.5$2$2.50$0.10$10
Opus 5.5$4$5$0.20$20

Official API pricing columns for ordinary input, output, five-minute writes, one-hour writes, and cache hits

Anthropic’s public API pricing table, cropped to its column headings and first model rows. Match the exact model and cache category before calculating. (Source: API pricing, captured 2026-10-26)

For Sonnet 5.5 with five-minute writes:

USD = input_M × 2
    + cache_write_M × 2.50
    + cache_read_M × 0.10
    + output_M × 10

Here, _M means millions of tokens in that billing bucket. These hypothetical monthly workloads illustrate why a single universal estimate is unhelpful:

ExampleInput MWrite MRead MOutput MAPI total
Occasional0.50.580.1$4.05
Regular22401$23
Heavy10102008$145
Very heavy202040020$330

For the heavy example: $20 input + $25 writes + $20 reads + $80 output = $145. These are arithmetic scenarios, not typical-user benchmarks. They exclude taxes, paid server-side tools, other models, and any special pricing options. A subscription may cover a workload for less money, but this table cannot tell you whether that workload fits its limits.

What prompt caching actually saves

Claude Code manages prompt caching automatically. Reuse depends on a matching request prefix and an unexpired cache. A stable repository alone does not guarantee a hit; the actual request context matters. (Caching behavior)

At the Sonnet 5.5 rates above, cache reads cost 95% less than ordinary input. Older models can have a different discount. That percentage applies to the read tokens only.

For example, writing a 100,000-token prefix once costs $0.25. Reading it nine more times while the cache remains valid costs $0.09. The combined prefix cost is $0.34, compared with $2 for ten uncached reads: an 83% reduction for this input example, before output or other charges. One-hour writes have a different price. (Cache pricing)

4. Set up your billing route and verify it

Install Claude Code using the official quickstart if needed. You can use a subscription without creating an API key.

Start with your subscription

In your terminal:

claude auth login
claude

Choose your Claude subscription account in the login flow. Inside the Claude Code conversation, run these commands one at a time:

/status
/usage
/model

/status identifies the active authentication route. /usage shows plan usage and session information; a displayed API-equivalent session estimate is not an additional invoice for included subscription usage. /model checks the exact model. (Authentication, Usage display)

An existing ANTHROPIC_API_KEY can change the route. Current interactive Claude Code asks whether to use it and remembers that choice; in -p mode, a present API key is used automatically. For a personal setup, unset ANTHROPIC_API_KEY removes it from the current shell. Also review other configured credentials or helpers if /status still shows an unexpected route. Follow your administrator’s settings on a managed machine. (Credential precedence)

Try API billing with a small budget

Create an organization and API key in the Claude Console. Configure its spending limit before running a job. In Bash or Zsh, this example reads the key without putting the value in shell history and confines the exported variable to a subshell:

(
  printf 'Anthropic API key: ' >&2
  IFS= read -r -s ANTHROPIC_API_KEY
  printf '\n' >&2
  export ANTHROPIC_API_KEY
  claude --model sonnet
)

Confirm the API route with /status before working. The sonnet alias can change as models are updated; use /model to check which model your account actually selected. Higher-priority provider or gateway credentials can also affect routing.

For a scripted trial, supply the API key through your secret manager or job environment, then run:

claude -p "Summarize this repository. Do not modify files." \
  --model sonnet \
  --max-budget-usd 2 \
  --max-turns 4 \
  --output-format json > claude-report.json

The budget option applies to print mode, uses a client-side estimate, and can overshoot. It is not an organization-wide billing ceiling. Use Console spend controls as well, and inspect job errors if a turn or budget limit stops the run. The report can contain repository information, so keep it out of public artifacts. These examples were checked for command syntax and documented options; no paid generation was run for this article. (CLI budget and turn options)

5. Continue a subscription session with usage credits

For occasional overflow, you can keep the same subscription login and enable Usage credits in Claude Settings > Usage, or open the settings with /usage-credits. Set a monthly cap and fund the balance; review auto-reload before enabling it. Beyond included limits, eligible requests use separately charged, standard API-rate overage. (Usage credit setup and billing)

This makes a useful middle option. For example, Pro at $20 plus an illustrative $15 of overage is $35 for that month. Whether Max is preferable depends on how much of your work its included allowance would cover and how often you are interrupted.

Monthly API credits included with Max are a separate benefit. The current program lists $100 for Max 5x and $200 for Max 20x, after claiming them through a linked Console organization. Its exclusions include Claude Code and extra usage in the Claude apps; unused credits also expire without rollover. Do not subtract their face value from a Claude Code bill. Check the API credit program if you also build eligible API applications.

6. Parallel terminals share capacity

Opening three Claude Code sessions can be useful for independent tasks. Use separate repositories or Git worktrees for simultaneous edits. Subscription consumption still draws from the account’s allowance; multiple windows do not multiply it.

With API billing, workers share organization or workspace limits. Watch requests per minute, input tokens per minute, and output tokens per minute. More API keys do not automatically create more organizational throughput. Queue work and handle rate-limit responses; when a 429 response includes retry-after, wait as directed. Spend-limit failures need a budget or account change rather than endless retries. (API limits and errors)

Start with one worker, measure cost and throughput, then add another. This is easier to evaluate than launching several expensive loops at once.

7. Automation is available through both routes

GitHub Actions can run Anthropic’s official Claude Code Action. Its documented authentication options include:

CredentialGitHub secretAction inputBilling route
API keyANTHROPIC_API_KEYanthropic_api_keyConsole/API
Subscription OAuth tokenCLAUDE_CODE_OAUTH_TOKENclaude_code_oauth_tokenThe token owner’s subscription

For the subscription token, run this locally and complete the authorization flow:

claude setup-token

Official documentation describing claude setup-token for CI and scripts without a browser at runtime

Anthropic’s public long-lived-token instructions. Authorization happens during token creation; the job later reads the token from its secret store. (Source: Authentication, captured 2026-10-26)

Store the generated token as a repository secret, not in a committed workflow file. Follow the complete GitHub Action setup for the GitHub App, workflow, and permissions. OAuth runs still consume the subscriber’s allowance. For shared organizational automation, an organization-managed API credential or supported workload identity can be easier to govern than a person’s subscription token. Add workflow timeouts and concurrency controls whichever route you choose.

Supported subscription authentication in Claude Code does not make a personal subscription a general-purpose credential for every third-party application. For tools or products you build for others, follow Anthropic’s developer authentication guidance.

8. Keep account separation and terms clear

Work and personal Claude subscription accounts can have separate CLAUDE_CONFIG_DIR directories, with separate settings and session histories. That supports legitimate separation; it should not be presented as a guaranteed way to pool subscription limits. (Multiple-account setup)

Anthropic’s Consumer Terms prohibit sharing account credentials and bypassing protective systems. That supports avoiding limit-evasion schemes. It does not establish a public rule that every person with two accounts will be banned, nor prove claims about card or device fingerprinting. For an account arrangement you depend on, ask Anthropic about that specific setup.

Personal Pro/Max and API use also fall under different agreements; check your organization’s requirements before sending work code. Anthropic’s Claude Code legal guide maps the applicable consumer and commercial terms.

9. Choose from a week of your own work

Your situationA sensible starting point
Learning or occasional short jobsA small API budget, or Pro if you also value Claude chat
Regular interactive developmentPro, then measure whether limits interrupt important work
Frequent included-usage exhaustionCompare Max with your measured subscription overage cost
CI or scheduled personal jobsEither documented route; account for shared quota and credential ownership
Shared automation or a product for othersOrganization-managed API/provider access and spend controls

For seven days, record the active billing route, exact model, useful tasks completed, interruptions, and spend. For API work, include all workers and cache categories; for subscriptions, record the five-hour and weekly usage bars. Use /usage for inspection and the relevant billing dashboard for the actual charges.

Compare subscription fee + usage-credit charges + separately billed API work, then consider the time lost to interruptions. Start with the smallest plan that covers your work, keep overflow spending bounded, and upgrade when your own records justify it. A fixed monthly price is useful when its allowance fits your workload; metered billing is useful when you need granular budgets and controlled automation.