How Claude is billed
| Token type | What it is | Price |
|---|---|---|
| Input | Prompt, system prompt, tools and conversation history | The model's input price |
| Cache write | Input you mark for prompt caching, the first time | More than regular input |
| Cache read | Cached input reused by later requests | A small fraction of regular input |
| Output | Claude's reply, including extended thinking | The model's output price |
Caching saves money when the same long prefix (instructions, documents, tool definitions) is reused within the cache lifetime. If prefixes change every request, cache writes cost more than they save. Alye shows cache reads and writes separately so you can see which way it goes.
Very long prompts on some models are billed at a higher rate. Alye prices them at the standard rate today, so treat very long-context costs as a lower bound.
Claude on Amazon Bedrock and Google Vertex AI
- The same model can cost more in some regions, and Bedrock's cross-region inference profiles (us., eu., global.) have their own prices.
- Alye detects where each call ran from the endpoint and model id, and prices it for that region or profile.
- Spend across Anthropic, Bedrock and Vertex AI shows in one place, next to any OpenAI or Gemini usage.
Track it in two lines
Calls through the official Anthropic SDK are recorded automatically, including streaming.
# Python
pip install alye
import alye
alye.init(service="contract-review") # set ALYE_API_KEY in the environment
with alye.context(customer_id="northwind"):
anthropic.Anthropic().messages.create(model="claude-sonnet-4-5", max_tokens=1024, messages=[...])// Node.js
npm install alye
import * as alye from "alye";
import Anthropic from "@anthropic-ai/sdk";
alye.init({ service: "contract-review" });
const anthropic = alye.wrap(new Anthropic());See the docs for Express, NestJS and OpenTelemetry, and how LLM cost tracking works.