Claude API Pricing: Input, Output & Cache Tokens
What Claude API pricing actually measures
When people say Claude is “expensive” or “cheap,” they usually skip the real unit of billing: tokens. With Claude API pricing, you are typically charged for input tokens, output tokens, and, on supported workflows, cache tokens. That means the final bill depends on what you send, what the model generates, and how much of your repeated context can be reused.
This is where 59API is useful. It gives developers pay-as-you-go access to Claude models through a low-cost relay, with official-quality native models, no downgrade, and compatibility with Claude Code, Codex, and any OpenAI SDK. If you are building a prototype or running production traffic, that combination makes cost control much easier.
Input tokens vs. output tokens
Input tokens are everything you send to the model: your system instructions, user prompt, chat history, tool definitions, and any pasted documents. Output tokens are everything the model generates back to you. In most Claude-style pricing models, output tokens cost more than input tokens, so long answers can move the bill faster than long prompts.
A simple way to think about it is this:
Total cost = input tokens + output tokens + cache-related tokens
That sounds simple, but the details matter. If you send a 7,000-token prompt and ask for a 1,000-token answer, you pay for both directions. If you then repeat the same long instructions in every request, you are paying for the same context again and again unless cache tokens reduce that repetition.
What cache tokens are and why they save money
Cache tokens are repeated context chunks that the API can store and reuse. This is especially valuable when your app sends the same large system prompt, policy block, product docs, or codebase context in many requests. Instead of charging the full input price every time, supported Claude workflows can bill a cheaper cache read after the first cache write.
Think of it like this:
- First request: you send a long reusable prompt and it gets written to cache.
- Later requests: you reuse that cached prompt instead of paying the full input cost again.
- Result: lower cost, faster repeated calls, and cleaner billing for context-heavy apps.
This is one of the biggest reasons to use a relay like 59API for Claude workloads. If you are sending large, stable prompts all day, the savings add up quickly. And because 59API is already among the cheapest pay-as-you-go relays, you get both lower model access costs and less waste from repeated input.
Hands-on example with 59API
Below is a practical example using the OpenAI SDK against 59API. The same style works for many Claude-compatible and OpenAI-compatible integrations. Replace the model name with the Claude tier you want, such as Opus, Sonnet, Haiku, or Fable on your account.
Python example: from openai import OpenAI client = OpenAI( api_key='YOUR_59API_KEY', base_url='https://api.59api.com/v1' ) response = client.responses.create( model='claude-sonnet', input='You are my assistant. Summarize this release note in 5 bullets and keep the tone technical.' ) print(response.output_text)
Now let’s estimate the bill. Suppose your reusable system prompt and docs total 6,000 tokens, your user request is 500 tokens, and the answer is 900 tokens. Without caching, every run pays for all 6,500 input tokens plus the 900 output tokens. With cache tokens, the first run may write the reusable block once, and later runs can read that cached context at a lower rate. That is exactly why cache-aware prompting matters in real apps.
How to reduce Claude costs in practice
- Keep prompts stable: Put long instructions in one reusable block so they can be cached.
- Shorten outputs: Ask for summaries, bullets, or structured JSON when you do not need long prose.
- Choose the right model: Use Haiku for lightweight tasks, Sonnet for balanced quality, and reserve Opus for harder work.
- Measure token usage: Watch your input and output counts in logs so you can spot expensive prompts early.
- Use a low-cost relay: 59API helps keep pay-as-you-go Claude access affordable, and the referral rebate can reduce your effective spend even more.
If you want to test this with real traffic, sign up on 59API, point your SDK to https://api.59api.com, and start with a small request. You will quickly see how input, output, and cache tokens affect your bill, and you can optimize before scaling up.
Pronto para começar?
Conecte Claude e GPT em minutos pelos menores preços, sem cortes. Cadastre-se e obtenha sua chave API.
Cadastro grátis