fix(anthropic): remove non-standard 'data: [DONE]' from Anthropic streaming#37510
Merged
DarkLight1337 merged 1 commit intovllm-project:mainfrom Mar 19, 2026
Merged
Conversation
…eaming Signed-off-by: cdpath <cdpath@outlook.com>
Contributor
There was a problem hiding this comment.
Code Review
This pull request correctly addresses a protocol compliance issue in the Anthropic streaming endpoint by removing the non-standard data: [DONE] marker. The change is applied to all stream termination paths, including normal completion and error scenarios, ensuring the endpoint adheres to the Anthropic API specification. This fix is well-targeted and resolves an issue for downstream consumers that expect strict protocol compliance. The changes are correct and improve the API implementation.
bbartels
approved these changes
Mar 19, 2026
DarkLight1337
approved these changes
Mar 19, 2026
fxdawnn
pushed a commit
to fxdawnn/vllm
that referenced
this pull request
Mar 19, 2026
…eaming (vllm-project#37510) Signed-off-by: cdpath <cdpath@outlook.com>
chooper26
pushed a commit
to intellistream/vllm-hust
that referenced
this pull request
Mar 21, 2026
…eaming (vllm-project#37510) Signed-off-by: cdpath <cdpath@outlook.com>
SouthWest7
pushed a commit
to SouthWest7/vllm
that referenced
this pull request
Mar 27, 2026
…eaming (vllm-project#37510) Signed-off-by: cdpath <cdpath@outlook.com>
khairulkabir1661
pushed a commit
to khairulkabir1661/vllm
that referenced
this pull request
Mar 27, 2026
…eaming (vllm-project#37510) Signed-off-by: cdpath <cdpath@outlook.com>
Monishver11
pushed a commit
to Monishver11/vllm
that referenced
this pull request
Mar 27, 2026
…eaming (vllm-project#37510) Signed-off-by: cdpath <cdpath@outlook.com> Signed-off-by: Monishver Chandrasekaran <monishverchandrasekaran@gmail.com>
JiantaoXu
pushed a commit
to JiantaoXu/vllm
that referenced
this pull request
Mar 28, 2026
…eaming (vllm-project#37510) Signed-off-by: cdpath <cdpath@outlook.com>
vrdn-23
pushed a commit
to vrdn-23/vllm
that referenced
this pull request
Mar 30, 2026
…eaming (vllm-project#37510) Signed-off-by: cdpath <cdpath@outlook.com> Signed-off-by: Vinay Damodaran <vrdn@hey.com>
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.
Purpose
Fix protocol leakage in the Anthropic streaming endpoint: remove the non-standard
data: [DONE]\n\nmarker from all stream termination paths.The
data: [DONE]sentinel is specific to the OpenAI streaming protocol. According to the Anthropic API specification, a stream terminates with anevent: message_stopblock where the data payload is valid JSON (e.g.,{"type": "message_stop"}).Appending the OpenAI-style
[DONE]marker to the Anthropic protocol breaks strict API gateways/middleware (such as LiteLLM) that expect alldata:payloads to be JSON objects —json.loads(" [DONE]")evaluates to['DONE'], causing anAttributeErrorwhen calling.get("type").Test Plan
curl -s http://localhost:8000/v1/messages \ -H "x-api-key: dummy" \ -H "Content-Type: application/json" \ -H "anthropic-version: 2023-06-01" \ -d '{ "model": "<model>", "messages": [{"role": "user", "content": "Say hi"}], "max_tokens": 20, "stream": true }'Verify the stream ends with
event: message_stopand no trailingdata: [DONE].Test Result
Before: stream ends with
event: message_stopfollowed bydata: [DONE]After: stream ends cleanly with
event: message_stoponlyStandard Anthropic clients (Claude Code, official SDKs) continue to function correctly, as their state machines close upon receiving
message_stop.