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
TypeScript a2aai-agentsai-gatewayanthropicclaudeclaude-codeclinecodexcopilotcursordeepseekfree-aigeminikimillm-gatewaymcpopenaiopenai-proxyqwentoken-saver
fix(sse): strip empty text content blocks before translation
Oleg Saprykin2908303d4bd0
diff --git a/open-sse/handlers/chatCore.ts b/open-sse/handlers/chatCore.tsindex 820692030a..9aa4812f38 100644--- a/open-sse/handlers/chatCore.ts+++ b/open-sse/handlers/chatCore.ts@@ -233,6 +233,19 @@ export async function handleChatCore({});}+ // Strip empty text content blocks from messages.+ // Anthropic API rejects {"type":"text","text":""} with 400 "text content blocks must be non-empty".+ // Some clients (LiteLLM passthrough, @ai-sdk/anthropic) may forward these empty blocks as-is.+ if (Array.isArray(translatedBody.messages)) {+ for (const msg of translatedBody.messages) {+ if (Array.isArray(msg.content)) {+ msg.content = msg.content.filter((block: Record<string, unknown>) =>+ block.type !== "text" || (typeof block.text === "string" && block.text.length > 0)+ );+ }+ }+ }+translatedBody = translateRequest(sourceFormat,targetFormat,