Blank white background with no objects or features visible.

Estamos disponibilizando acesso gratuito ao Gartner Hype Cycle for AI Governance 2026 completo. Obtenha sua cópia →

Observability for Claude in Production: Token Accounting and Tracing

By Ashish Dubey

Published: October 19, 2026

TL;DR
  • Claude’s usage isn’t one number. Total input tokens = cache_read_input_tokens + cache_creation_input_tokens + input_tokens, and each is priced differently — a cache read is 0.1x, a cache write 1.25x. If your accounting collapses them, your cost numbers are wrong.
  • Track five things per request: the three input token buckets plus output tokens, cost, latency, error rate, and cache hit rate. Cache hit rate is the one that tells you whether your caching is actually working.
  • Trace the whole call, not just the final answer — including requests that were refused or errored, which app-side logging usually misses.
  • At the gateway, every Claude call is recorded as a side effect, so coverage is complete without an SDK in every service.
  • Export, don’t replace: send Claude traces and metrics to your existing stack over OpenTelemetry rather than standing up a parallel one.

Claude in production fails quietly in two ways: the bill drifts up for reasons no dashboard explains, and a bad response is impossible to reconstruct after the fact. Both are observability gaps, and both have a Claude-specific wrinkle. The cost gap is specific because Claude’s token usage is not a single figure — it splits into normal input, cache writes, and cache reads, each priced differently — so naive token counting produces a number that does not match the invoice. The debugging gap is specific because the interesting failures (a refusal, a tool error, a cache that silently stopped hitting) often leave nothing in application logs.

This post is about closing both gaps: what to account for in Claude’s token usage, what to trace, and how to get complete coverage at the gateway instead of instrumenting every service by hand. The usage-field details are from Anthropic’s documentation, as of October 2026.

Token accounting: three input numbers, not one

The first thing to get right is that “input tokens” on Claude is three numbers that each cost something different.

How Claude’s input tokens split across normal, cache-write, and cache-read

‍

Every Claude response reports input_tokens, cache_creation_input_tokens, and cache_read_input_tokens, and the true total input is the sum of all three. They are not interchangeable for cost: a normal input token is 1x, a cache write is 1.25x (2x for the 1-hour TTL), and a cache read is 0.1x — or 0.05x on Opus 5.5 and Sonnet 5.5. So two requests with identical total token counts can cost very differently depending on how those tokens split. An accounting system that only sums “input tokens” will both misreport spend and hide the single most useful signal: whether your cache is being read or just written.

That signal is cache hit rate, and it is the number that tells you prompt caching is actually paying off. If cache_creation is high and cache_read stays near zero, you are paying the write premium and collecting no discount — a problem invisible to anything that does not break input tokens into its parts.

‍

Try now.

One gateway for all your models, MCP servers, and agents.
No credit card needed.

Start free
Table of Contents

One Gateway for Every LLM, Agent and MCP Server

Book a 30-min with our AI expert

Book a Demo

The fastest way to build, govern and scale your AI

Book Demo
Summarize with
ChatGPT logo by OpenAI
Perplexity AI logo
Blurry red snowflake on white background, symmetrical frosty design with soft edges and abstract shape.

Discover More

No items found.
October 19, 2026
|
5 min read

Guardrails for Claude: PII Redaction and Prompt-Injection Defense

No items found.
October 19, 2026
|
5 min read

Running Claude in Regulated Environments

No items found.
October 19, 2026
|
5 min read

Observability for Claude in Production: Token Accounting and Tracing

No items found.
October 17, 2026
|
5 min read

Agent Gateway vs. LLM Gateway: What’s the Difference

No items found.
No items found.

Recent Blogs

Black left pointing arrow symbol on white background, directional indicator.
Black left pointing arrow symbol on white background, directional indicator.

Frequently asked questions

How do I account for Claude token costs correctly?

Sum the three input buckets separately: input_tokens (1x), cache_creation_input_tokens (1.25x, or 2x for the 1-hour TTL), and cache_read_input_tokens (0.1x, or 0.05x on Opus 5.5 and Sonnet 5.5), plus output tokens. Collapsing them into one “input” figure misstates cost.

What’s the most important Claude metric to watch?

Cache hit rate, alongside cost and error rate. It’s the only signal that distinguishes a cache that’s actually being read from one that only pays the write premium.

Why do I need tracing if I have metrics?

Metrics tell you a number moved; a trace reconstructs a single request — including refusals, tool errors, guardrail blocks, and fallbacks that app-side logs usually miss.

Do I need an SDK in every service?

Not if Claude goes through a gateway. Every call is recorded there as a side effect, so coverage is complete — including refused requests — without per-service instrumentation.

Can I keep using my existing observability tools?

Yes. Export Claude traces and metrics over OpenTelemetry into Datadog, Grafana, or your current stack rather than running a separate one.

Take a quick product tour
Start Product Tour
Product Tour