token usage#774
Merged
Merged
Conversation
…ead+creation sum Previously the Anthropic adapter summed cache_read_input_tokens and cache_creation_input_tokens into cached_content_token_count, which made any downstream hit-rate metric (cached / prompt) wrongly count cache writes as hits. Cache writes now go to the new cache_creation_token_count field. Behavior change: Anthropic TokenUsageRecord.cached_tokens values will be lower than pre-fix records for equivalent traffic, because creation tokens no longer inflate the count. Hit-rate dashboards built on this should annotate the discontinuity.
The OpenAI-compatible deserializer previously silently dropped DeepSeek's prompt_cache_hit_tokens / prompt_cache_miss_tokens fields, leaving DeepSeek cache hit rate permanently unknown. Map prompt_cache_hit_tokens (preferred) or prompt_tokens_details.cached_tokens (fallback) to cached_content_token_count so the hit-rate formula works for DeepSeek.
The agent_type field on DialogTurnData was added by an earlier agent-tools refactor but three test fixtures in agentic_api.rs were not updated, breaking `cargo test -p bitfun-desktop` (lib test compile failure). None matches the field's documented use for non-user-dialog or utility turns.
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.
No description provided.