{"version":"2.1.331","anchor":"otel-spans-record-gen-ai-token-usage","canonical_anchor":"otel-spans-record-gen-ai-token-usage","heading":"Traces now record token counts and the model that answered","tier":"internal","area":"Telemetry","scope":"org","heads_up":false,"url":"https:\/\/changelogs.core-directive.com\/v\/2.1.331\/e\/otel-spans-record-gen-ai-token-usage","release_url":"https:\/\/changelogs.core-directive.com\/v\/2.1.331","markdown":"### Traces now record token counts and the model that answered\n\nWhen tracing is on, each model call's trace now records input, output and cache token counts and the model that replied\n\n**What**\n\nClaude Code can send traces using OpenTelemetry, a standard format for recording what a program does and how long it takes. Each request to the model is recorded as a span, one timed entry in a trace. That span used to record only why the model stopped.\n\nIt now also records:\n\n- `gen_ai.usage.input_tokens`, which includes tokens read from and written to the cache\n\n- `gen_ai.usage.output_tokens`\n\n- `gen_ai.usage.cache_read.input_tokens`\n\n- `gen_ai.usage.cache_write.input_tokens`\n\n- `gen_ai.response.model`\n\nTokens are the small pieces of text the model reads and writes, and they are what usage is measured in.\n\n**Why**\n\nIf you collect traces, you can now see how many tokens each model call used and which model replied. This only applies when tracing is turned on.\n\n- Area: Telemetry\n- Tier: Under the hood\n- Useful: 2\/5\n- Signal: 1\/5\n- Scope: org\n- Heads-up: no"}