Skip to content

Read token usage from responses API - #217

Merged
taniokay merged 3 commits into
mainfrom
fix-read-token-usage
Nov 5, 2025
Merged

taniokay merged 3 commits into
mainfrom
fix-read-token-usage

Conversation

@anelephantbowl

@anelephantbowl anelephantbowl commented Nov 4, 2025 •

Copy link
Copy Markdown
Contributor

Note

Make LiteLLM token usage parsing support both Responses and Chat Completions APIs, update tests, and bump version.

  • Metrics (LiteLLM):
    • Adjust '_get_token_usage' in metrics/eval_clients/_litellm.py to read token usage from both Responses API (input_tokens/output_tokens) and Chat Completions (prompt_tokens/completion_tokens).
  • Tests:
    • Update tests/metrics/eval_clients/test_litellm.py to mock ResponseAPIUsage and validate summed token usage for Responses API scenarios.
  • Version:
    • Bump version to 0.10.0.dev13 in pyproject.toml and src/langcheck/__init__.py.

Written by Cursor Bugbot for commit 12e6b38. This will update automatically on new commits. Configure here.

@anelephantbowl
anelephantbowl marked this pull request as ready for review November 4, 2025 03:40

@taniokay taniokay left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Confirmed that it correctly capture the tokens for reasoning too!

@taniokay
taniokay merged commit e351e66 into main Nov 5, 2025
27 checks passed
@taniokay
taniokay deleted the fix-read-token-usage branch November 5, 2025 05:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants