Skip to content

fix(provider): preserve trailing stream usage chunks#110

Merged
duguwanglong merged 1 commit intomainfrom
fix/openai-trailing-stream-usage
Apr 13, 2026
Merged

fix(provider): preserve trailing stream usage chunks#110
duguwanglong merged 1 commit intomainfrom
fix/openai-trailing-stream-usage

Conversation

@xiami762
Copy link
Copy Markdown
Contributor

@xiami762 xiami762 commented Apr 13, 2026

Summary

  • preserve trailing usage-only stream chunks when OpenAI-compatible APIs send usage after the terminal finish chunk
  • apply the same handling to both OpenAIBaseProvider and OpenAICompatibleProvider
  • add provider tests covering the finish-then-usage ordering

Handle OpenAI-compatible streams that send the usage-only chunk after the
terminal finish chunk so downstream usage persistence still captures tokens.

Made-with: Cursor
@xiami762 xiami762 requested a review from duguwanglong April 13, 2026 10:32
@duguwanglong duguwanglong merged commit 9b4bfe8 into main Apr 13, 2026
2 checks passed
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.

2 participants