mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[GH-ISSUE #2865] [Bug]: chat/completions stream ignores stream_options.include_usage (usage stays on the finish_reason chunk) #1157
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#1157
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Eranicus30666 on GitHub (Oct 17, 2026).
Original GitHub issue: https://github.com/Niko1221/Strata/issues/2865
What happened
OpenAI's streaming contract: with
"stream_options": {"include_usage": true}, the last chunk before[DONE]has"choices": []and carriesusage; the other chunks carry no usage./v1/chat/completionsignoresstream_optionsand always putsusageon the same chunk asfinish_reason.In my setup (LiteLLM in front of Strata), LiteLLM does not read the usage from that chunk and recounts the tokens itself, lower than the engine's count. A client that uses this number to decide when to compact its context then compacts too late.
Expected: with
include_usage: true, the usage in its own last chunk with"choices": []; unchanged without the option. A PR with a fix follows.Related: #2278 adds the legacy /v1/completions endpoint and says its final chunk already carries the usage; this issue is only about /v1/chat/completions.
Strata version, GPU, OS
0.1.45 · 2x NVIDIA A2 16GB (sm_86) · Debian 13, CUDA 13.4
@Niko1221 commented on GitHub (Oct 19, 2026):
Thanks for taking the time to report this.
We're resetting the tracker for 0.2.0-beta. There are more than 1,300 open issues and pull requests, too many for us to read properly, so we're closing everything that isn't being worked on right now. Closed here does not mean rejected.
To reopen it takes about two minutes:
/reopen. A check runs and either reopens the issue or lists what is still missing.The rules are in CONTRIBUTING.md.