Skip to content

Record Anthropic thinking tokens from the raw response (litellm reports 0) #140

Description

@MaxGhenis

litellm 1.88.1 estimates Anthropic reasoning tokens by token-counting the visible thinking text instead of reading the API's usage.output_tokens_details.thinking_tokens; Claude Opus 5 / Fable 5 / Sonnet 5 default to display: "omitted" (empty thinking text), so completion_tokens_details.reasoning_tokens is structurally 0 for them. Filed upstream with a proposed fix: BerriAI/litellm#36290.

Until that lands, our per-row usage recording (and the published usage_summary.csv) shows zero reasoning tokens for every Claude row regardless of actual thinking. Options:

  • Prefer the raw provider usage when available: read output_tokens_details.thinking_tokens off the response and record it in our reasoning column directly, falling back to litellm's field for other providers.
  • Regenerate the affected analysis CSVs for runs where thinking actually occurred (the tool_choice-auto sensitivity run is the first).

The board's canonical runs are unaffected in substance (Claude genuinely produced no thinking under the forced tool — see sensitivity/claude-thinking-2026-08.md), but the column should stop being wrong-by-construction before any v2 run where Claude thinking engages (#139).

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions