mirror of
https://github.com/Wei-Shaw/sub2api.git
synced 2026-10-16 07:33:06 +08:00
BufferedResponseAccumulator.SupplementResponseOutput rebuilt the output only when the terminal response had an empty output array. Upstreams can also end with a non-empty output whose message carries no (or only blank) output_text. The buffered Chat Completions and Anthropic Messages paths then returned an empty reply although the text had streamed, while usage still billed the terminal output_tokens. When the terminal output has no usable message text, fill the first empty output_text part (or append one, or append a message item) from the accumulated deltas. Non-empty terminal text stays authoritative, and nothing is synthesized when no text streamed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>