docs: include_usage streaming behavior rewritten in Chat and FIM Completion APIs - #17
Open
github-actions[bot] wants to merge 1 commit into
Open
docs: include_usage streaming behavior rewritten in Chat and FIM Completion APIs#17github-actions[bot] wants to merge 1 commit into
github-actions[bot] wants to merge 1 commit into
Conversation
…letion APIs The `include_usage` streaming contract changed on both the Chat Completions and FIM Completion (Beta) API reference pages. The docs previously promised that setting `include_usage: true` streamed a *separate usage-only chunk* (empty `choices` array) just before `data: [DONE]`. They now describe a different response shape: no extra chunk is emitted at all, and the full-request token statistics ride on the final content chunk. Any client that parses streams by hunting for a dedicated usage chunk — or that keys off an empty `choices` array to find it — needs to re-check its parsing logic against the new shape. - `include_usage: true` → every chunk carries a `usage` field, `null` on all but the last; omitted/false → `usage` is absent from every chunk except the last. Either way, no separate usage-only chunk is emitted. - The last chunk before `data: [DONE]` carries the request's token-usage stats in `usage`, and its `choices` array always contains exactly one element: no new content, non-null `finish_reason`. - Changed on both `create-chat-completion` and `create-completion` (FIM Beta) in en and zh-cn, so both API families are affected. - `fetched:` dates bumped to 2026-08-26; index churn only otherwise. One metadata note: `zh-cn/news/news250120` now records a fallback-shell error, meaning that page's title could not be fetched — content of the article itself is unchanged.
github-actions
Bot
force-pushed
the
docs/sync
branch
from
August 26, 2026 13:21
a792811 to
3670213
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The
include_usagestreaming contract changed on both the Chat Completions and FIM Completion (Beta) API reference pages. The docs previously promised that settinginclude_usage: truestreamed a separate usage-only chunk (emptychoicesarray) just beforedata: [DONE]. They now describe a different response shape: no extra chunk is emitted at all, and the full-request token statistics ride on the final content chunk. Any client that parses streams by hunting for a dedicated usage chunk — or that keys off an emptychoicesarray to find it — needs to re-check its parsing logic against the new shape.include_usage: true→ every chunk carries ausagefield,nullon all but the last; omitted/false →usageis absent from every chunk except the last. Either way, no separate usage-only chunk is emitted.data: [DONE]carries the request's token-usage stats inusage, and itschoicesarray always contains exactly one element: no new content, non-nullfinish_reason.create-chat-completionandcreate-completion(FIM Beta) in en and zh-cn, so both API families are affected.fetched:dates bumped to 2026-08-26; index churn only otherwise. One metadata note:zh-cn/news/news250120now records a fallback-shell error, meaning that page's title could not be fetched — content of the article itself is unchanged.