Skip to content
Guide

Claude API cost tracking on Anthropic, Bedrock, Vertex

By the Alye team · Updated

Short answer
Claude is billed per input and output token, with separate prices for prompt-cache writes and reads, and different prices on Amazon Bedrock and Google Vertex AI by region. To see what each feature or customer costs, record every call with its service and customer and price it for where it ran.

How Claude is billed

Token typeWhat it isPrice
InputPrompt, system prompt, tools and conversation historyThe model's input price
Cache writeInput you mark for prompt caching, the first timeMore than regular input
Cache readCached input reused by later requestsA small fraction of regular input
OutputClaude's reply, including extended thinkingThe 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.

Questions

How do I track Claude API costs by feature and customer?

Add the Alye SDK to each service and tag requests with your customer ID. Every Claude call through the official Anthropic SDK is recorded with its tokens, cost, latency and errors, split by service, model and customer.

How does prompt caching change Claude costs?

Writing to the cache costs more than normal input and reading from it costs much less, so caching saves money when the same long prefix is reused. Alye prices cache writes and cache reads separately from the usage each response reports.

Does Alye track Claude on Amazon Bedrock and Google Vertex AI?

Yes. Claude calls through Bedrock and Vertex AI are priced for the region they ran in, including Bedrock cross-region inference profiles.

Try it on one service. Free for 500,000 calls a month, set up in about five minutes.