Merged
Conversation
Contributor
Author
SummaryCloses #583. Fix retry-generated assistant messages incorrectly inheriting input and cache token usage from the original response.
Change type
Affected areas
Verification
Screenshots, API examples, or logsBefore the fix, an assistant retry with After the fix, retry-owned values remain authoritative: {
"inputTokens": 103,
"cacheReadTokens": 0,
"cacheWriteTokens": 0
}Configuration, migration, and compatibility notes
Documentation
Security and privacy
Checklist
|
3 tasks
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.
Summary
Closes #572.
Improve usage reporting in the admin model call log:
TokentoUsage.media_typeandduration_billablemarkers instead of legacydurationSecondsvalues.Change type
Affected areas
Verification
go test ./internal/application/billing ./internal/application/conversationgo test ./...pnpm checkgit diff --checkThe checks include Go tests, Go vet, Biome, TypeScript, and generated API contract verification.
No browser automation or external provider generation request was used.
Screenshots, API examples, or logs
Example text-model usage:
The output tooltip shows:
Example video usage:
The inline video player continues to show duration in its control bar. The redundant top-left duration badge has been removed.
Configuration, migration, and compatibility notes
input_image_count.media_type: video.duration_billablemetadata remains the trusted indicator for video duration usage.—.durationSecondsvalues are not treated as video duration unless a trusted video marker is present.Documentation
The behavior is limited to the existing admin log and inline video interfaces.
Security and privacy
Only aggregate media counts and duration metadata are added to the pricing snapshot. No attachment contents, filenames, URLs, or user-provided media are copied into it.
Checklist
.pycfiles,.envfiles, and local storage data are not committed.