Skip to content

Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors

fix(combo): strip omniModel tags from outbound streaming responses (#585)

diegosouzapw5a8c6440f0f5
diff --git a/open-sse/services/combo.ts b/open-sse/services/combo.ts
index 7742ab492f..5bc36d6bc0 100644
--- a/open-sse/services/combo.ts
+++ b/open-sse/services/combo.ts
@@ -522,10 +522,33 @@ export async function handleComboChat({
},
});
- const transformedStream = res.body.pipeThrough(transform);
+ // FIX #585: Sanitize outbound stream — strip <omniModel> tags from
+ // visible content so they don't leak to the user. The tag is still
+ // present in the full response for round-trip context pinning, but
+ // we clean it from each SSE chunk's content field before delivery.
+ const sanitize = new TransformStream({
+ transform(chunk, controller) {
+ const text = decoder.decode(chunk, { stream: true });
+ // Only run replacement if the chunk actually contains the tag
+ if (text.includes("<omniModel>")) {
+ const cleaned = text.replace(
+ /(?:\\\\n|\\n)?<omniModel>[^<]+<\/omniModel>(?:\\\\n|\\n)?/g,
+ ""
+ );
+ controller.enqueue(encoder.encode(cleaned));
+ } else {
+ controller.enqueue(chunk);
+ }
+ },
+ });
+
+ const transformedStream = res.body.pipeThrough(transform).pipeThrough(sanitize);
+ // Add model info as response header for clients that support it
+ const headers = new Headers(res.headers);
+ headers.set("X-OmniRoute-Model", modelStr);
return new Response(transformedStream, {
status: res.status,
- headers: res.headers,
+ headers,
});
}
: handleSingleModel;