NousResearch/hermes-agent

reasoning_tokens extraction from completion_tokens_details

Cluster 18466 · agent. Data as of

Nothing open on GitHub. Fix merged in #57340 on 2 Jul 2026. Check it covers your case.

The short answer

0open issues
0open PRs
3items grouped
Known?
Yes. 3 related items grouped here, 1 issue already closed.
Fix event
A fix was merged to main in PR #57340. Check it covers your case. No release data is tracked.
Tracker
The maintainers' tracker marks this unresolved. That is separate from the fix event.
Still open
Nothing open on GitHub.

These issues and PRs concern a bug where reasoning_tokens is always reported as 0 in chat completions mode, because usage normalization reads from output_tokens_details instead of completion_tokens_details. Members address fixes and broader reasoning/thinking token exposure across the API.

Open issues0

No open issues.

Open PRs0

No open pull requests.

Fixes on record

Merged to main. A stamp counts the issues a fix is linked to.

  • #57340 fix(usage): capture reasoning_tokens from completion_tokens_details on chat_completions

    merged to main

    files: agent/usage_pricing.py

    Show the diff
    • agent/usage_pricing.py
      @@ -820,9 +820,22 @@ def normalize_usage(
               input_tokens = [redacted:secret-assignment] prompt_total - cache_read_tokens - cache_write_tokens)
       
           reasoning_tokens = 0
      +    # Responses API shape: output_tokens_details.reasoning_tokens.
      +    # Chat Completions shape (OpenAI, OpenRouter, DeepSeek, etc.):
      +    # completion_tokens_details.reasoning_tokens. Reading only the former
      +    # left reasoning_tokens=0 for every chat_completions reasoning model —
      +    # hidden thinking was invisible in session accounting even though it
      +    # dominates output spend on models like deepseek-v4-flash (measured:
      +    # single calls burning 21K reasoning tokens to emit 500 visible tokens).
           output_details = getattr(response_usage, "output_tokens_details", None)
           if output_details:
               reasoning_tokens = [redacted:secret-assignment] "reasoning_tokens", 0))
      +    if not reasoning_tokens:
      +        completion_details = getattr(response_usage, "completion_tokens_details", None)
      +        if completion_details:
      +            reasoning_tokens = _to_int(
      +                getattr(completion_details, "reasoning_tokens", 0)
      +            )
       
           return CanonicalUsage(
               input_tokens=[redacted:secret-assignment]

1 PR closed without merging

From the close comments: done elsewhere 1

  • #18484 fix(usage): read reasoning_tokens from completion_tokens_details (chat completions) · done elsewhere → 3a122ba, #57340
Closed issues · 1
  • Closed#18466[Bug]: reasoning_tokens always 0 for chat_completions mode — normalize_usage only extracts from output_tokens_details, missing completion_tokens_details
How this cluster was grouped
  • Link evidence (structural links throughout): every member is connected by structural evidence: shared changed files, or a closing/superseded reference.
  • Pairwise link density 0.67: the share of item pairs that carry a link, counting a structural link in full and a relevance-only link at 0.36. 1.00 means every pair is linked.

Pick up a Lab task

Check whether a fix covers the open issues here, with your own agent. Bring back evidence for maintainers.

Open the Lab

At a glance

Subsystem
agent
Merged PRs
#57340
Closed issues
1
Attempts
1 PR closed without merging
Fix link checked
2 Jul 2026

For your agent

The same facts, typed.