Repository navigation
feat: enrich LLM token tracking with reasoning tokens and cache creation tokens - #5389
Merged
Merged
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 981b1ba8290518b7553c2983ebaf6b68cf85f754. Configure here.
Lucas Gomide (lucasgomide)
force-pushed
the
luzk/llm-cost-metrics
branch
from
April 10, 2026 03:50
981b1ba to
baab356
Compare
João Moura (joaomdmoura)
approved these changes
Apr 10, 2026
Lucas Gomide (lucasgomide)
force-pushed
the
luzk/llm-cost-metrics
branch
from
April 10, 2026 04:08
baab356 to
f9d97be
Compare
Lucas Gomide (lucasgomide)
force-pushed
the
luzk/llm-cost-metrics
branch
from
April 10, 2026 04:17
f9d97be to
4fb3b2b
Compare
Volkan ÖZYILDIRIM (volkanozyildirim)
pushed a commit
to volkanozyildirim/crew-ai
that referenced
this pull request
Apr 15, 2026
2 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Note
Medium Risk
Updates core token-usage accounting and the
UsageMetricsschema across multiple LLM providers, which could affect downstream reporting/analytics and any consumers expecting the previous metrics shape. No auth/data-path behavior changes beyond usage extraction and aggregation.Overview
Extends LLM usage tracking to record
reasoning_tokens(thinking/reasoning models) andcache_creation_tokens(cache write costs), and propagates these throughBaseLLM._token_usageandUsageMetricsaggregation.Enhances provider-specific usage extraction to populate these fields and improve cached-token detection (OpenAI Chat + Responses API, Azure, Gemini, Anthropic cache writes, and Bedrock cache-read keys), and adds/updates tests to cover the new metrics and default/absence behavior.
Reviewed by Cursor Bugbot for commit 4fb3b2b. Bugbot is set up for automated code reviews on this repo. Configure here.