-
-
Notifications
You must be signed in to change notification settings - Fork 11.7k
[internal copy of #29550] fix: passthrough endpoints duplicate logs #29598
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
mateo-berri
merged 9 commits into
litellm_internal_staging
from
litellm__fix_passthrough_stream_dedup
Jun 3, 2026
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
e97dde1
fix duplicate cost callbacks for anthropic streaming pass-through
mubashir1osmani 2468e16
fix stream
mubashir1osmani 2bbb786
add
mubashir1osmani 57311e4
add stream to logging obj
mubashir1osmani 58022c2
test(pass_through): give mock logging object a real model_call_detail…
mateo-berri 8e1aa10
Merge branch 'litellm_internal_staging' into litellm__fix_passthrough…
mateo-berri b1f8d19
test(pass_through): cover streaming logging-obj stream flag
mateo-berri 4a60381
test(pass_through): cover SSE-response stream flag fallback branch
mateo-berri a5b0053
fix(pass_through): gate complete_streaming_response on stream flag
mateo-berri File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
complete_streaming_responseset unconditionally, breaks sync callbacks for non-streaming calls_create_anthropic_response_logging_payloadis called for both streaming and non-streaming Anthropic passthrough responses. Settingcomplete_streaming_responseinmodel_call_detailsunconditionally causessuccess_handlerto hit its early-return guard at line 2127 (if "complete_streaming_response" in self.model_call_details: return) even for non-streaming calls. Any user with sync callbacks configured (e.g.success_callback = ["langfuse"]or"s3") would have those callbacks silently skipped for all non-streaming Anthropic passthrough requests, because the executor-submittedsuccess_handlerexits before iterating the callback list. The guard at line 1635 (if self.stream is not True: return False) prevents_is_assembled_stream_successfrom misfiring, butsuccess_handler's early-return at 2127 is unconditional. The assignment should be guarded so it only fires for streaming calls.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is already addressed on HEAD in a5b0053. The
complete_streaming_responsewrite in_create_anthropic_response_logging_payloadis no longer unconditional; it is now gated onlogging_obj.model_call_details.get("stream") is True(line 120). For non-streaming Anthropic pass-through requestsmodel_call_details["stream"]is never set to True (only the two streaming branches in pass_through_endpoints.py set it), so the key is never written for non-streaming calls,success_handler's early-return at line 2127 is not taken, and sync callbacks such as langfuse and s3 keep firing. The guard scopes the assignment to streaming calls exactly as suggested, so there is no regression for non-streaming requests