Claude Code API Pricing: Budget the Whole Task
Compare Claude model rates on KeyoAPI and estimate your coding budget from input and output tokens. See the cost of a 100K-input / 10K-output workload, how repeated context affects spending, and how metered API billing differs from a monthly subscription.
Claude model API rates on KeyoAPI
The table shows KeyoAPI input and output rates per million tokens for the default billing group. Group multipliers, cache pricing and additional features can affect the final charge. Open the pricing page for current rates and the Claude API pricing page for the broader model comparison.
| KeyoAPI model ID | Input / 1M tokens | Output / 1M tokens |
|---|---|---|
| claude-haiku-5-5 | $0.07353 | $0.36765 |
| claude-sonnet-5 | $0.44120 | $2.20600 |
| claude-sonnet-5-5 | $0.88235 | $4.41175 |
| claude-opus-5 | $1.10300 | $5.51500 |
| claude-opus-5-5 | $1.76470 | $8.82350 |
| claude-fable-5-1 | $7.35300 | $36.76500 |
Choose a model by the cost and quality of completed work. Compare accepted edits, passing tests, response time and total token usage on your own repository.
A worked task budget: 100K input + 10K output
Example budget: 100,000 billed input tokens and 10,000 billed output tokens accumulated across a coding task. Actual usage varies with repository size, conversation length and tool results. Count each billed occurrence of repeated context. The calculation uses default-group token rates; cache pricing, other group multipliers and usage beyond this token budget are excluded.
Cost = total input tokens / 1,000,000 × input rate + total output tokens / 1,000,000 × output rate.
| Model ID | Input cost | Output cost | Total task cost | $20 balance: example workloads |
|---|---|---|---|---|
| claude-haiku-5-5 | $0.0073530 | $0.0036765 | $0.0110295 | 1813 |
| claude-sonnet-5-5 | $0.0882350 | $0.0441175 | $0.1323525 | 151 |
| claude-opus-5-5 | $0.1764700 | $0.0882350 | $0.2647050 | 75 |
| claude-fable-5-1 | $0.7353000 | $0.3676500 | $1.1029500 | 18 |
The last column divides a $20 API balance by the cost of the example token budget and rounds down. Your number of completed tasks depends on actual usage. See Build an AI agent with the KeyoAPI chat API for turn limits and session budgeting.
API billing vs a monthly Claude plan
API billing charges for requests at the applicable rates. A monthly Claude subscription has its own included products and usage limits. Compare your expected API spend with the current plan price and features; check Claude’s published plan terms for subscription access to Claude Code.
For occasional or uneven workloads, estimate spend from the token totals of completed tasks. For regular use, compare that monthly estimate with the subscription’s price and limits. Include caching, retries and revisions in your calculation. KeyoAPI gift credits follow the account’s model eligibility rules.
API formats and client requirements
Claude Code uses the Anthropic Messages format. KeyoAPI provides POST /v1/messages and OpenAI-compatible POST /v1/chat/completions. Choose the endpoint required by your client and a model available to your API key.
Client support depends on the selected model and the required features, including streaming and tool use. A chat request alone does not establish full Claude Code support. Use the exact model ID from the catalog; client defaults and model aliases may differ.
The curl example below sends an OpenAI-compatible chat request with claude-sonnet-5-5. See the API endpoint reference for authentication and request formats.
Make a metered chat request with a catalog ID
Set KEYO_API_KEY to your console API key, send the request below and use the response usage to track input and output tokens.
curl https://www.keyoapi.xyz/v1/chat/completions \
-H "Authorization: Bearer $KEYO_API_KEY" \
-H "Content-Type: application/json" \
-d '{"model":"claude-sonnet-5-5","messages":[{"role":"user","content":"Review this migration plan: add a nullable column, backfill it, validate and enforce the constraint. Identify missing rollback steps."}],"max_tokens":400}'
Keep the task within a spending budget
Track usage for every request, limit repeated retries, and cap the number of turns and the amount of context your application sends. Measure the cost per accepted result. Use your client’s budget controls and usage reports where available.
Eligible gift-credit model calls consume gift credits according to account billing rules. Check model eligibility, available balances and billing details in the console.
FAQ
How many tokens does one Claude Code task use?
Usage varies with repository context, tool results, repeated turns, caching and retries. The table uses an example budget of 100K input plus 10K output tokens. Estimate your own tasks from their cumulative billed usage.
Which listed model has the lowest token price?
claude-haiku-5-5 has the lowest input and output rates in this table for the default group. Compare total usage and result quality to choose the best value for your workload.
Which API format does Claude Code require?
Claude Code uses Anthropic Messages. KeyoAPI exposes POST /v1/messages; compatibility also depends on the model and client features. The example on this page uses OpenAI-compatible chat, which has a different request format.
Is a prepaid API balance the same as a Claude subscription?
A prepaid API balance pays for metered requests. A subscription covers the products and usage limits listed in its plan. Compare current plan terms with your expected API usage.
Where are the current Claude API rates?
Use the pricing page for the live catalog and the Claude API pricing page for the broader guide. See the full pricing list for model IDs and documented endpoints.