What happened:
From claude:
How Traceloop/OpenTelemetry Treats Tokens
Based on the OpenTelemetry instrumentation code:
# From API response.usage:
usage = {
"prompt_tokens": 3891, # → gen_ai.usage.input_tokens
"completion_tokens": 1532, # → gen_ai.usage.output_tokens
"total_tokens": 11738,
"completion_tokens_details": {
"reasoning_tokens": 6315 # → gen_ai.usage.reasoning_tokens
}
}
Key findings:
1. ✅ prompt_tokens (input_tokens) does NOT include reasoning tokens
2. ✅ reasoning_tokens is extracted from completion_tokens_details.reasoning_tokens
3. ✅ They are stored as SEPARATE attributes: gen_ai.usage.input_tokens and gen_ai.usage.reasoning_tokens
4. ✅ Your ClickHouse query confirmed: total_tokens = input + output + reasoning
What you expected to happen:
How to reproduce it (as minimally and precisely as possible):
Anything else we need to know?:
Environment:
What happened:
From claude:
What you expected to happen:
How to reproduce it (as minimally and precisely as possible):
Anything else we need to know?:
Environment: