59API

← Voltar aos guias

Claude API Pricing: Input, Output and Cache Tokens

Preços · EN · 2026-09-24

Understand the four Claude token billing categories

Claude API pricing is easiest to manage when you stop treating every token as the same thing. A production request can include regular input tokens, generated output tokens, cache-write tokens, and cache-read tokens. Each category has its own rate, and the model matters: Opus is designed for demanding reasoning, Sonnet balances intelligence and speed, Haiku targets low-latency workloads, and Fable can fit selected creative or agent workflows.

Input tokens are the tokens you send to Claude that are not served from a prompt cache. They include system instructions, user messages, tool definitions, retrieved documents, and conversation history. Output tokens are the tokens Claude generates: an answer, code, a tool call, or structured JSON. Output tokens usually cost more than input tokens because generation requires incremental model inference.

Cache-write tokens are a reusable prompt prefix saved for later requests. The first request that creates a cache costs more than ordinary input for that cached section. Cache-read tokens are tokens retrieved from that saved prefix on later requests. Cache reads are usually dramatically cheaper than normal input, which is why caching is valuable for repeated long context.

Calculate Claude API cost before deploying

Use this practical formula for every request: total cost = normal input tokens × input rate + output tokens × output rate + cache-write tokens × write rate + cache-read tokens × read rate. Always use the current price card for the specific model and cache lifetime you select, because model rates and product options can change.

For example, imagine a support assistant sends a 20,000-token policy manual and receives a 700-token answer. Without caching, the manual is charged as standard input on every question. With caching, the first request pays a cache-write charge for the reusable manual. Subsequent questions can read that same prefix at the lower cache-read rate, while only the new user question is billed as normal input. If hundreds of users ask questions about the same manual, the savings can be substantial.

Build a cost-aware Claude integration from zero

First, choose a model based on the task rather than choosing the most expensive model by default. Route straightforward classification, extraction, and FAQ tasks to a fast economical model. Reserve Sonnet or Opus for complex coding, deep analysis, multi-step agent work, and high-stakes reasoning. This routing decision often saves more than any token-level optimization.

Second, create a small telemetry record for every API call. Store the model name, input token count, output token count, cache-write token count, cache-read token count, latency, status code, and feature name. Tagging requests by feature lets you discover whether cost comes from chat history, retrieval payloads, tools, or unusually long outputs.

Third, establish budgets. Set a per-request output cap, a daily spend alert, and a maximum context size for each feature. For retrieval-augmented generation, do not blindly send every search result to Claude. Retrieve a small number of relevant chunks, remove duplicates, and keep chunk sizes consistent. Reducing irrelevant context lowers normal input cost and can improve answer quality.

Use prompt caching correctly in production

A cache is most effective when its beginning remains identical across requests. Put stable content first: system rules, product documentation, large reference files, and tool schemas. Put variable material last: the current question, user profile, recent event data, and request-specific retrieval results. Even a small change near the start of a cached prefix can prevent a reuse opportunity.

Measure the break-even point after launch. A cache write costs more than a standard input read, so caching a prompt used only once may not help. But when the same long prefix is reused repeatedly within the available cache lifetime, lower-cost cache reads can quickly offset the initial write. Monitor actual token usage instead of estimating from character counts; code, JSON, and non-English text can tokenize differently.

Lower-cost Claude access with 59API

59API is a practical option for teams that want pay-as-you-go access to native, official-quality Claude models without a downgrade. Its relay supports Claude models including Opus, Sonnet, Haiku, and Fable, alongside GPT models, and is compatible with Claude Code, Codex, and OpenAI SDK-based applications. Point your supported client at https://api.59api.com, add your 59API key, and select the model your workload needs.

For a safe rollout, start with a staging key, log token categories, test cache hits with a fixed prompt prefix, and compare cost per successful task across models. Then move proven routes to production. If you are looking for a low-cost relay with straightforward pay-as-you-go billing and a referral rebate, sign up for 59API and validate your real workload economics before scaling.

Preços · Docs

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