Claude Code token measurement

How Claude Code token usage builds across a coding session

Claude Code token usage includes more than the visible instruction. The model may receive project rules, selected files, conversation state, tool schemas and tool results. Each additional turn can carry forward context. Understanding those components is the first step toward reducing cost without removing information the model actually needs.

Results vary by workload. Provider prices and limits remain controlled by the provider.

What normally enters the context

Typical inputs include system behavior, CLAUDE.md or project instructions, user messages, code excerpts, diffs, terminal output, MCP schemas and prior assistant actions. The exact composition depends on the current Claude Code version and integration, so provider-reported usage is more reliable than a simple character estimate.

How to audit a session

Choose one repeatable task. Record the initial context, each tool call, the number of turns and the final provider usage. Mark which content was unique, repeated, obsolete or unrelated. This creates a factual map of where tokens accumulate instead of blaming the model or one prompt.

Local token estimate

This is an approximate comparison, not provider billing data.

What can be reduced safely

Repeated logs, duplicated instructions and inactive tool schemas are candidates for testing. Active requirements, identifiers, current code and security instructions should remain. Varion supports local and paired tests so you can verify the provider-bound request and the resulting output.

Measurement checklist

  1. Choose a representative completed task, not an artificial one-line prompt.
  2. Record the selected model, provider input, cached input, output, retries and final result.
  3. Change one optimization mechanism at a time so the cause remains visible.
  4. Verify required identifiers, tool calls, code changes or business fields.
  5. Keep passthrough available when the reduced request does not pass.

How Varion fits

Varion Token Engine is a gateway and testing platform for reducing eligible input-token waste across supported AI traffic. It reports original and provider-bound input, keeps provider charges separate, and does not claim that every request can be reduced. New verified users receive 100,000 processed input tokens and 50 local test runs.

Frequently asked questions

Is a character-based token estimate exact?

No. Tokenization varies by model and content. Character estimates are useful for comparison, while provider usage is the source of truth.

Are output tokens included in Claude Code usage?

They can affect metered API cost and usage. Review the usage fields and rules reported by the access method you use.