Skip to content

Set the 'Include Usage' parameter under 'Stream Options' to true in the 'chat-completion-accumulating' example #125

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: next
Choose a base branch
from

Conversation

bytesizedwizard
Copy link

Summary

This pull request adds the missingStreamOptions.IncludeUsage option in the example code that should be set to true to retrieve accurate token usage information from the API. Without this parameter, the example currently returns a token usage of 0.

Changes Made

  • Updated the relevant example request options to include the missing parameter with a value of true.

Issue Reference

Fixes #124

Testing

  • Ran the example after adding the parameter and confirmed that token usage is now reported accurately.

Additional Context

This change ensures users get accurate usage data when using the example code.

@jacobzim-stl
Copy link
Collaborator

Thanks, we'll merge this.

@bytesizedwizard
Copy link
Author

Hello @jacobzim-stl, any update on when this would be merged?

@stainless-app stainless-app bot force-pushed the next branch 5 times, most recently from f7f3f87 to bf7d424 Compare March 17, 2025 19:49
@stainless-app stainless-app bot force-pushed the next branch 4 times, most recently from db4bd1f to 4002a71 Compare March 22, 2025 17:23
@stainless-app stainless-app bot force-pushed the next branch 2 times, most recently from b0e3afb to 64e1530 Compare March 28, 2025 05:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Missing request option in example code results in incorrect token usage reporting
2 participants