Repository navigation
feat(gateway): P3-B streaming SSE cross-protocol conversion (v0.5.0) - #85
Merged
Merged
Conversation
Streaming SSE events interconversion between openai_chat / anthropic / responses protocols, so stream:true requests can forward to any upstream protocol (previously cross-protocol streaming -> 400): - src/sse.rs (new): ported openai_sse_to_anthropic + openai_sse_to_openai_responses from openlocalrouter streaming.rs (buffered parsing, tool/thinking/usage), plus new anthropic_sse_to_openai (text/tool deltas -> choices, [DONE]), anthropic_sse_to_responses (via openai intermediate), responses_sse_to_openai_chat (output_text.delta / function_call_arguments.delta -> choices) - forward_stream: picks outbound per key (resolve_outbound), transforms request body cross-protocol, converts response SSE stream by (upstream, client) protocol pair; usage extracted in-stream via UsageSlot -> settle_usage - responses -> anthropic streaming deferred (clear 400) - tests 94 -> 102 (+7 sse converter tests, +1 gateway e2e conversion w/ settlement) - live smoke: anthropic client -> openai upstream SSE round-trip verified Closes rant 2026-08-18T18:59:29 (P3-B streaming SSE protocol conversion).
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.
Summary
Streaming SSE cross-protocol conversion:
stream:truerequests can now forward to any upstream protocol (previously cross-protocol streaming → 400).openai_sse_to_anthropic+openai_sse_to_openai_responsesfrom openlocalrouterstreaming.rs(buffered block parsing, tool-call/thinking deltas, usage extraction), plus new converters:anthropic_sse_to_openai: content_block_delta text → choices delta, tool_use/input_json_delta → tool_calls delta, message_delta usage+stop → finish_reason + [DONE]anthropic_sse_to_responses: via openai chat intermediate stateresponses_sse_to_openai_chat: output_text.delta / function_call_arguments.delta → choicesresolve_outbound; cross-protocol request body transformed (P3-A transform_request); response SSE stream converted by (upstream, client) protocol pair; usage extracted in-stream viaUsageSlot→settle_usageRelated
2026-08-18T18:59:29: P3-B 流式 SSE 协议转换(宿主指示继续,P3-A 已完成)Tests
cargo test→ 102/102 (+7 sse converter tests, +1 gateway e2e conversion with settlement)cargo fmt --checkclean,cargo clippy --all-targets -D warningsclean