Claude API Pricing: Input, Output & Cache Costs
Claude API pricing: the five-minute version
Claude API pricing is easier to manage when you separate three things: what the model reads, what it generates, and which prompt content it reuses through caching. A long prompt is not automatically expensive on every request, but caching does not make the entire conversation free.
This quick-start guide explains the billing categories, walks through a cost calculation, and shows how to evaluate a low-cost relay such as 59API without confusing advertised rates with your application's actual spend.
1. Understand the token categories
- Input tokens: New, uncached content processed by the model, including instructions, conversation history, tool definitions and retrieved documents.
- Output tokens: Content generated by the model, including tool-call arguments. Output usually costs more per token than ordinary input.
- Cache-write tokens: Eligible prompt content stored for reuse. Writing a cache generally costs more than processing ordinary input once.
- Cache-read tokens: Previously cached prompt content reused by a subsequent matching request. Reads are usually substantially cheaper than ordinary input.
Tokens are not words. Code, punctuation and non-English text can tokenize differently. Use a token-counting endpoint where supported, then compare estimates with actual response usage.
2. Calculate one request before optimizing
Rates are commonly quoted per million tokens. The basic calculation is cost = uncached input cost + cache-write cost + cache-read cost + output cost. Calculate each component as its token count multiplied by its applicable rate, divided by 1,000,000.
For illustration only, assume input costs $3 per million tokens and output costs $15. With standard Anthropic prompt-caching multipliers, a five-minute cache write would cost $3.75 per million and a cache read $0.30. These are example assumptions, not a live quote for a particular model or relay.
- First request: Write a 10,000-token reusable prefix, add 1,000 uncached input tokens and generate 1,000 output tokens. Cost: $0.0375 + $0.003 + $0.015 = $0.0555.
- Matching follow-up: Read that cached prefix, add 1,000 uncached tokens and generate 1,000 output tokens. Cost: $0.003 + $0.003 + $0.015 = $0.021.
- Without caching: Each equivalent request costs $0.033 in input plus $0.015 in output: $0.048.
The first cached request costs more, but reuse makes the two-request total cheaper. Longer answers can still dominate the bill.
3. Make your prompt cacheable
Put stable content first: tool definitions, system instructions and reference material. Put changing questions and request-specific data afterward. In Anthropic's native Messages format, supported content blocks can use cache_control with type ephemeral to mark a cache breakpoint.
Cache hits require a matching eligible prefix. Editing instructions, changing tool definitions or rearranging content can cause misses. Models also have minimum cacheable prompt lengths, so short prompts may not qualify.
Standard Anthropic caching uses a five-minute lifetime, with a one-hour option where supported. Five-minute writes typically cost 1.25 times base input, one-hour writes 2 times, and reads 0.1 times. Confirm model support and your provider's billing rules before relying on those multipliers.
4. Connect through 59API and verify billing
59API offers low-cost, pay-as-you-go access to Claude and GPT models, with compatibility for Claude Code, Codex and OpenAI SDK workflows. Its service describes the models as native, official-quality offerings without downgrading, making it an attractive option for cost-conscious developers.
- Use https://api.59api.com as the service base, then follow 59API's documentation for the SDK-specific path, authentication and exact model identifier.
- Check input, output, cache-write and cache-read prices separately; do not assume official pricing multipliers automatically apply.
- Send two requests sharing the same eligible prefix and inspect usage plus dashboard charges.
In native Anthropic usage reporting, inspect input_tokens, output_tokens, cache_creation_input_tokens and cache_read_input_tokens. Cache categories are separate from uncached input; avoid double-counting them.
5. Optimize the bill, not just the headline rate
Choose the smallest model that meets your quality target, request concise answers, and track retries and tool-loop costs. Compare total cost per successful task across providers. If that fits your workflow, consider signing up for 59API and testing a small workload; its referral rebate can provide additional savings under the program's terms.
Ready to get started?
Connect Claude & GPT in minutes at the lowest prices — full-power, never downgraded. Sign up to get your API key.
Sign up free