Skip to content

fix: align request usage entries with known token usage - #4582

Closed
seanxuu wants to merge 2 commits into
openai:mainfrom
seanxuu:contrib/issue-4563-request-usage-entries
Closed

fix: align request usage entries with known token usage#4582
seanxuu wants to merge 2 commits into
openai:mainfrom
seanxuu:contrib/issue-4563-request-usage-entries

Conversation

@seanxuu

@seanxuu seanxuu commented Aug 22, 2026

Copy link
Copy Markdown
Contributor

This pull request resolves #4563 by defining request_usage_entries as a list of requests with known token usage.

When a provider returns no usage payload, Usage.requests remains the authoritative physical request count and the SDK does not synthesize zero-valued RequestUsage entries. Retry and streaming paths now follow the same contract while preserving known usage entries and aggregate totals.

Validation:

  • Focused usage, retry, and streaming tests pass.
  • Ruff, targeted Pyright, and targeted Mypy pass.
  • Full repository gates were run; the local environment reports unrelated optional-dependency and existing sandbox/voice failures, documented in the handoff.

@seanxuu
seanxuu marked this pull request as ready for review August 22, 2026 06:01
@seratch seratch closed this Aug 22, 2026
@seanxuu
seanxuu deleted the contrib/issue-4563-request-usage-entries branch August 24, 2026 03:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

request_usage_entries: two paths disagree on whether a zero-token request gets an entry

2 participants