Skip to content

Conversation

@vrtnis
Copy link
Contributor

@vrtnis vrtnis commented Aug 6, 2025

Restores OpenAI token usage counts in RunContext.usage by teaching the Usage class to consume the existing snake_case fields from API responses. Previously, Usage only looked for camelCase props and silently dropped all prompt_tokens, completion_tokens, and total_tokens.

RunContext.usage will now accurately reflect both request counts and aggregated token usage across single or multi-step agent runs.

Resolves #298

@changeset-bot
Copy link

changeset-bot bot commented Aug 6, 2025

🦋 Changeset detected

Latest commit: 3982e84

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 5 packages
Name Type
@openai/agents-openai Patch
@openai/agents-core Patch
@openai/agents Patch
@openai/agents-realtime Patch
@openai/agents-extensions Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vrtnis vrtnis marked this pull request as ready for review August 6, 2025 18:50
@seratch seratch enabled auto-merge (squash) August 11, 2025 03:30
@seratch seratch merged commit 4818d5e into openai:main Aug 11, 2025
4 checks passed
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.

Usage request not containing token amounts but contains number of requests

2 participants