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(core): prevent emergency fallback from masking original errors
diegosouzapwd23b19c4669e
diff --git a/src/sse/handlers/chat.ts b/src/sse/handlers/chat.tsindex eec303ffa5..0fbf689550 100644--- a/src/sse/handlers/chat.ts+++ b/src/sse/handlers/chat.ts@@ -504,7 +504,7 @@ async function handleSingleModelChat(`${currentModelStr} -> ${fallbackModelStr} | reason=${fallbackDecision.reason}`);- return handleSingleModelChat(+ const fallbackResponse = await handleSingleModelChat(fallbackBody,fallbackModelStr,clientRawRequest,@@ -514,6 +514,15 @@ async function handleSingleModelChat(telemetry,{ ...runtimeOptions, emergencyFallbackTried: true });++ if (fallbackResponse.ok) {+ return fallbackResponse;+ }++ log.warn(+ "EMERGENCY_FALLBACK",+ `Emergency fallback to ${fallbackModelStr} failed with status ${fallbackResponse.status}. Resuming original provider account fallback.`+ );}}}