Claude Code Subscription vs API Billing: Estimate Your Real Cost
The difference between a Claude Code subscription and API billing is what you are buying. A subscription buys a block of usage for a period at a flat monthly fee, and when you run out you wait for the window to reset. The API buys tokens: you pay for what you use, with no cap. Which one is cheaper depends on how much you actually consume each month, not on which one looks more expensive.
Below we cover how the two differ, then a way to estimate cost from your own data. Prices and limits change often, so this article gives no specific figures. Treat Anthropic's official pages as the source of truth.
How do subscription and API billing actually differ?
| Subscription login (Pro / Max, etc.) | API key (pay as you go) | |
|---|---|---|
| How you pay | Fixed monthly fee | Per input and output token |
| Usage limits | Usage windows; wait for reset once used up | Bound by the account's rate and spend limits; no "monthly allowance runs out and you stop" |
| Cost predictability | High; the monthly fee is the ceiling | Low; depends on usage |
| Light use | May go underused, so relatively wasteful | Often cheaper |
| Heavy, long-running agents | May hit the limit repeatedly | Keeps running, but the bill grows with it |
| Account requirement | A matching subscription account | An API account and a payment method |
The two are metered differently, so you can't compare the monthly fee directly with a per-million-token price. To compare them, you first need to know roughly how many tokens you use in a month.
How do usage windows work?
A subscription limit isn't "N requests per month." It is how much you may use within a time window. The window length, the size of the allowance, and the multiples between plans are adjusted by Anthropic, so check the official documentation.
Two practical consequences:
- A long conversation, reading many files, or having the agent retry repeatedly burns through the allowance faster, and not in proportion to the number of prompts you send.
- Once you hit the limit, you can only wait for the reset or switch to another way of working. How painful that is depends on whether you have a fallback.
If you already hit limits often, read Claude Code running out of quota: check usage first, then decide whether to upgrade or change billing, which walks through checking consumption before deciding.
How do you measure your own usage? (3 steps)
Don't guess. Use the data the tool already gives you.
Step 1: Check the cost of the current session. In Claude Code, type /cost. It shows the token usage and converted cost of the current session. When you are logged in with an API key, this number is the most meaningful. Under a subscription login, what it means is defined in the official docs, and it is better used as a reference for the scale of consumption.
Step 2: Record a typical week. At the end of each day, note the /cost result and what you did that day, for example "fixed a small bug" or "ran a large refactor." After a week you will see the order of magnitude of most days and which kinds of tasks are especially expensive.
Step 3: Convert to monthly cost. Use this formula:
monthly cost ≈ typical workday usage × workdays per month + large-task usage × number of large tasks per month
Multiply the resulting token count by the current official API price to get the pay-as-you-go monthly cost, then compare it with the subscription fee. Look up the latest prices on the official pricing page rather than using old numbers from someone else's article.
For a finer-grained estimate, including the input/output split and the effect of accumulating context, see How to estimate Claude Code token usage: work out your monthly cost from your own usage.
When does a subscription fit, and when does the API?
Use these rules for a first pass, and let the estimate above make the final call:
- You use it every day and usage is fairly steady: a flat monthly fee is easier to plan around.
- You use it rarely or in bursts: pay-as-you-go is often cheaper, since you don't pay for allowance you never use.
- You occasionally run one huge task: the API finishes it smoothly, while a subscription may get stuck on the limit.
- A team managing costs together: API keys can be created per project, which makes cost splitting easier (check the official console for exact features). You may also want a team plan; see Claude Team vs Pro: how many people before you need Team.
- You just want to understand Pro versus Max: see Claude Pro vs Max: when do you need to upgrade.
One more thing that is often overlooked: when you use the API, prompt caching has a large effect on cost. If a repeated long context hits the cache, the input portion of the bill drops noticeably; the exact discount is per the official docs. See How to use Claude prompt caching to save money: where to place markers, checking hits, and reconciling the bill.
A third option: a gateway's monthly allowance
Besides the official subscription and the official API, you can also connect through an aggregation gateway and pay by monthly allowance. Here is one, described objectively: AGI Plan. AGI Plan is a commercial partner of cdnping, so read the following as a partner's self-description, not a neutral review.
- A multi-provider LLM aggregation gateway, billed monthly in Chinese yuan (RMB), with no overseas credit card required.
- One subscription can switch between several capability groups: frontier reasoning, balanced general-purpose, Chinese flagship models, and fast lightweight models.
- Tools such as Claude Code and Codex keep working after you change just one endpoint URL, and no Claude account is needed.
- Some models are marked "overseas only"; see agiplan.dev/models for the details.
- The provider states plainly that it is not an officially authorized channel.
It suits you if you have no overseas credit card, or if you want one allowance to cover several tools. It does not suit you if you must use specific features of an official account, or if your company's compliance rules allow only official channels. If you are in a region the official services don't support, a gateway is not a way around that restriction either; available models and regions are per agiplan.dev/models. Whichever route you take, follow each service's terms and your local laws and regulations. Before choosing a gateway, read How to choose an API relay: 8 checks you can verify, from uptime to billing to data policy and Is a Claude API relay trustworthy? Four main risks and self-checks you can run, and go through the checklist item by item.
For setup, see Custom API endpoints for Claude Code, Codex and OpenCode. It comes down to three steps: sign up with an email verification code, pick a plan and create a key, and change one setting. Sign-up is at agiplan.dev/startup.
After switching billing, how do you confirm it took effect?
After changing the configuration, don't just check that the tool still answers. Confirm that requests are going where you expect, so the charges land where you expect.
- In Claude Code, use
/costto see whether session usage starts accumulating. - On the relevant platform's usage page, check that your recent requests appear and the token counts roughly match.
- If you see an auth conflict or a 401, see Claude Code auth conflict warning and 401: how to fix it.
- If responses feel slow or fail, first check /en/status/anthropic and /en/down/claude-code to see whether the official service has an incident, then troubleshoot your local network. For background on API latency from mainland China, see /en/learn/ai-api-latency-china.
Summary and next steps
Spend a week recording real usage with /cost, convert it to a monthly cost with the formula, then compare against the latest official prices. Steady, high-frequency usage points toward a subscription. Light or spiky usage points toward pay-as-you-go API billing. If you have no overseas payment method, or want one allowance to cover several tools, a gateway's monthly allowance is worth evaluating.
If you want to try the third option, start with the step-by-step guide at agiplan.dev/startup and look at the current plans at agiplan.dev/pricing. Whichever you pick, try it on a small allowance for a week before committing long term.