Claude Code API pricing: when a plan is cheaper than the API
Claude Code can be used through a paid Claude plan or billed through API usage, depending on the credential and gateway configuration. The plan is easier to forecast; the API is easier to attribute per task. Compare them with the same workload, model, cache hit rate and review time rather than assuming that the larger monthly number is always more expensive.
Reviewed by OpenLux Engineering Team · Last verified

Claude plans that include Claude Code
Plan prices and limits can change. This snapshot is from Claude's official pricing page on 26 November 2026 and does not include tax.
| Plan | Monthly price | Published usage position | Main planning question |
|---|---|---|---|
| Pro | $20 monthly; $17 monthly equivalent with annual billing | Claude Code included; shared 5-hour and weekly limits | Will normal interactive use stay inside the shared limits? |
| Max | $100 monthly | 5x Pro usage per 5-hour and weekly window; $100 monthly API credits | Do long-running agents need more headroom and API credits? |
| Ultra | $200 monthly | No 5-hour limit; 10x Pro weekly usage; $200 monthly API credits | Is the team running all-day agents that justify the highest plan? |
| Team / Enterprise | Seat pricing plus usage terms | Administration, pooled credits and organisation controls vary by plan | Which shared controls, data terms and invoicing are required? |
Claude API token rates
Official standard rates per million tokens. Cache writes and reads have separate pricing; batch processing and cloud-marketplace terms can differ.
| Model | Input | Output | Cache hit | Best-fit note |
|---|---|---|---|---|
| Claude Sonnet 5.5 | $2 / MTok | $10 / MTok | $0.10 / MTok | Balanced coding and agent work |
| Claude Opus 5.5 | $4 / MTok | $20 / MTok | $0.20 / MTok | Harder reasoning and long-running agents |
| Claude Fable 5.2 | $8 / MTok | $40 / MTok | $0.20 / MTok | Long-horizon demanding work |
| Claude Fable 5.1 | $10 / MTok | $50 / MTok | $0.25 / MTok | Legacy higher-cost option |
How does Claude Code billing actually work?
Claude Code is included in paid Claude plans and shares the plan's usage limits. When a paid user reaches a limit, the options can include waiting for a reset, moving to a higher plan, or enabling usage credits at standard API rates on eligible plans. The plan price therefore buys a usage allowance, not unlimited execution.
API access is different. Each request is billed by the model's input, output and cache rates, with no interactive plan limit. This can be cheaper for bursty or low-volume work and more expensive for an agent that runs continuously. The relevant comparison is monthly spend per accepted task, not the plan headline against one API call.
How do you calculate Claude Code API cost?
For each task, add uncached input tokens, cache write tokens, cache read tokens and output tokens at the model's rates. Agent loops repeat context, so input can dominate even when output looks small. Prompt caching can reduce repeated context cost, but cache hits depend on the provider, the prompt prefix and the timing between turns.
Claude's current pricing documentation lists cache writes at 1.25x base input for five minutes or 2x for one hour, and cache reads at a model-specific multiplier that can be 0.05x or 0.1x. Use the exact table for the selected model. Do not apply a generic discount to an uncached estimate and call it a forecast.
When is the Pro plan enough?
Pro is a sensible starting point for one developer doing normal interactive coding, code explanation and moderate refactoring. The uncertainty is the shared limit: long sessions, large repositories, multiple parallel agents and expensive models consume the allowance faster. Observe real usage for two weeks instead of guessing from token totals.
If the team frequently reaches limits, the answer is not automatically a higher plan. Separate normal interactive work from batch or automated agent work. The former may fit a plan; the latter may be easier to attribute and cap through API keys, budgets and a gateway.
When does API billing make sense?
API billing is useful when work is bursty, when each task must be attributed to a customer or repository, or when the organisation already has a gateway and wants one metered route across several coding tools. It also gives a clear unit for experimentation: cost per accepted patch, test pass or review minute.
The trade-off is variance. A runaway agent, a retry loop or a context explosion can create a bill that a subscription would have absorbed. Use per-key budgets, concurrency limits, request deadlines and alerts. Review output rather than assuming that token spend equals useful work.
How can a gateway reduce operational cost?
A gateway centralises keys, usage records and model selection. That makes it easier to compare models on the same workload and to cap a team's spend. OpenLux publishes model rates in its catalogue and exposes an OpenAI-compatible API; Claude Code itself expects Anthropic-shaped requests, so an Anthropic-to-OpenAI bridge may be required and must be tested.
Do not choose a gateway solely because a rate table looks lower. Validate the model, protocol path, streaming and tool-call behaviour. A bridge adds a component that can fail or alter token accounting. Keep the bridge local or private, log only the metadata you need, and verify that provider data terms match the repository's sensitivity.
How should a team forecast and review spend?
Build three scenarios: one developer with interactive sessions, a small team running agents daily, and an automated workload that executes many tasks per hour. For each, record median and p95 input tokens, output tokens, cache hit rate, retries and accepted-task rate. Multiply by the current model rates and add gateway or plan costs.
Review monthly against the invoice and the request log. Investigate changes in cost per accepted task, not only total spend. A rise can mean more usage, a model substitution, a cache regression, a prompt change or a quality drop that causes rework. Keep a baseline so the cause is visible.
How do plans, API credits and usage limits interact?
A Claude plan is a bundled usage product, not a prepaid API account. The published price includes an allowance with time-based limits, and some plans also describe monthly API credits for eligible usage. The definitions and eligibility can change, so confirm the current plan page before treating credits as a direct offset against gateway traffic.
Model the plan by the work it completes, not by comparing its price with a raw token budget. Interactive sessions, parallel agents, context size and model choice all affect consumption. Track when the team reaches a limit, how often it waits and whether it buys extra usage.
Model the API route with the same tasks and the actual cache pattern. Include bridge overhead, retries and failed attempts. A plan can be cheaper for predictable interactive work while API billing can win for bursty or attributable workloads. The useful threshold is the point where wait time, unused capacity and administrative cost change the decision.
Do not treat plan credits as a universal discount. Confirm which products and request paths are eligible, when the credits reset and whether they expire. Then apply the same rule in the forecast. If the published terms are ambiguous, use the conservative assumption and record the uncertainty rather than presenting false precision.
What should a plan-versus-API pilot measure?
Run a two-week pilot with a representative group of developers. Capture tasks started, tasks accepted, elapsed time, time blocked by limits, token usage and review minutes. If plan usage is visible only as a percentage or reset window, record that limitation rather than inventing token precision.
For the API route, use one project key with a hard budget and request logs. Ensure the model and cache settings match the plan comparison as closely as possible. Exclude one-off migrations and holidays from the baseline, or at least annotate them.
At the end, calculate cost per accepted task for both routes and list the operational differences: attribution, procurement, data handling and support. Choose a default and a review date. Keep the alternative documented so the team can switch when usage patterns or published terms change.
Review the pilot with finance and engineering together. Finance needs predictable accrual and invoice treatment; engineering needs a route that completes work without hidden limits. A decision that satisfies only one side tends to be reversed after the first busy month.
Which option fits?
Use a Claude plan when
- One developer wants a predictable monthly bill for interactive coding.
- Usage fits the shared limits and does not need per-task attribution.
- You do not need a custom gateway for policy or routing.
Use a metered API route when
- Usage is bursty, automated or must be attributed to a team or customer.
- You need one gateway for several coding tools and models.
- Budgets and request-level observability are more important than a flat seat price.
Configuration example
Cost formula for one accepted task
# Replace rates with the exact model and cache rates from the current price page.
input_cost = uncached_input_tokens / 1_000_000 * input_rate
write_cost = cache_write_tokens / 1_000_000 * cache_write_rate
read_cost = cache_read_tokens / 1_000_000 * cache_read_rate
output_cost = output_tokens / 1_000_000 * output_rate
cost_per_accepted_task = (input_cost + write_cost + read_cost + output_cost) / accepted_tasks
print(cost_per_accepted_task)Bridge configuration shape
# The bridge accepts Anthropic-shaped Claude Code traffic and forwards it
# to a verified OpenAI-compatible route. Keep the mapping in local config.
export ANTHROPIC_BASE_URL="http://localhost:4000"
export ANTHROPIC_AUTH_TOKEN="local-bridge-placeholder"
claudeEstimate your coding-agent API cost
Adjust the workload to match one developer, then scale by team size. The calculation uses the current OpenLux catalogue rate and a blended token assumption.
Assumptions: one blended per-million-token rate, all input and output tokens counted once, and failed attempts equal to the retry percentage. Your console invoice is authoritative. Compare OpenLux plans.
Same assumptions across text models
These rows apply the same token, session and retry assumptions to each published model rate.
| Model | Monthly per developer | Monthly team cost |
|---|---|---|
| gpt-6-astra | $2.15 | $2.15 |
| gpt-5.6-sol | $1.07 | $1.07 |
| gemini-3.8-flash | $0.3221 | $0.3221 |
| gemini-3-flash-preview | $0.2151 | $0.2151 |
| claude-sonnet-4-5-20250929 | $1.55 | $1.55 |
| claude-opus-5 | $2.58 | $2.58 |
| claude-fable-5-1 | $10.32 | $10.32 |
| gemini-3.1-pro-preview | $0.8598 | $0.8598 |
| deepseek-v4 | $0.3583 | $0.3583 |
| qwen3-max | $0.4582 | $0.4582 |
Related models and live rates
| Model | Vendor | Price | Vs. official |
|---|---|---|---|
| claude-sonnet-4-5-20250929 | Anthropic | $0.2647 / 1M tokens | -91% |
| claude-opus-5 | Anthropic | $0.4412 / 1M tokens | -91% |
| gpt-6-astra | OpenAI | $0.3677 / 1M tokens | -96% |
| deepseek-v4 | DeepSeek | $0.0613 / 1M tokens | -90% |
Key takeaways
- Compare plan and API costs against the same accepted-task workload.
- Account for cache writes, cache reads, retries and repeated repository context.
- Use budgets and request logs; a lower token rate can still lose to rework.
Frequently asked questions
Is Claude Code included in Pro?
Claude's current pricing page lists Claude Code as included in paid plans, including Pro, with shared usage limits. Check the plan comparison before purchasing because limits and allowances can change.
Is Claude Code cheaper through a subscription or the API?
There is no universal answer. A subscription is predictable for normal interactive use that fits its limits. API billing can be cheaper for low-volume or bursty work and easier to attribute, but an uncontrolled agent loop can cost more.
What is prompt caching?
Prompt caching reuses a stable prompt prefix so repeated context is billed at a cache-read rate instead of the full input rate. It can reduce cost for long coding sessions when the provider supports caching and the prefix remains stable.
Can OpenLux run Claude Code directly?
OpenLux exposes an OpenAI-compatible API, while Claude Code uses the Anthropic Messages protocol. A local or private compatibility bridge is normally needed. Verify streaming, tools and response fields before production use.
What should a team monitor?
Track spent tokens by model and key, cache hit rate, retries, accepted tasks and human review time. Also alert on spend spikes and unexpected model substitutions.
Sources and methodology
Competitor claims were checked against the linked public pages on the verification date. Pricing and product terms can change; confirm them before purchase.
- Claude plans and pricingOfficial Pro, Max, Ultra, Team and Enterprise plan snapshot; checked 26 November 2026.
- Claude Platform pricingOfficial model, cache, batch and platform pricing documentation; checked 26 November 2026.
- Claude Code costsOfficial usage tracking, credits and team cost guidance; checked 26 November 2026.
- Claude Code gatewaysOfficial explanation of gateway credentials and ANTHROPIC_BASE_URL; checked 26 November 2026.
- OpenLux model catalogue and ratesChecked against the 19-model catalogue on 26 November 2026.
- OpenLux API documentationOpenAI-compatible endpoint, SDK migration and error handling.
Related comparisons and guides
OpenRouter alternative for coding
Compare routing choices for coding agents.
LiteLLM alternative
Review the bridge and self-hosted gateway path.
Claude Code cost guide
Use the existing deeper cost model.
Coding agent cost comparison
Compare Claude Code, Codex, Cursor and other tools.
LLM API cost calculator
Estimate a workload with your own assumptions.
Model the cost before choosing a plan
Use accepted tasks, cache hit rate and review time, not token price alone.