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): v3.4.1 stabilization (QWEN OAuth, ZAI null content, Codex payload, NIM 404)
diegosouzapwb38351a47000
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex dc94a5950d..6d1a354407 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -26,6 +26,10 @@- **Provider Quota & Token Parsing:** Switched Antigravity limits to use `retrieveUserQuota` natively and correctly mapped Claude token refresh payloads to URL-encoded forms (#862)- **Rate-Limiting Stability:** Universalized the 429 Retry-After parsing architecture to cap provider-induced cooldowns at 24 hours max (#862)- **Dashboard Limit Rendering:** Re-architected `/dashboard/limits` quota mapping to render immediately inside chunks, fixing a major UI freezing delay on accounts exceeding 70 active connections (#784)+- **QWEN OAuth Authorization:** Mapped the OIDC `id_token` as the primary API Bearer token for Dashscope requests, fixing immediate 401 Unauthorized errors after connecting accounts or refreshing tokens (#864)+- **ZAI API Stability:** Hardened Server-Sent Events compiler to gracefully fallback to empty strings when DeepSeek providers stream mathematically null content during reasoning phases (#871)+- **Claude Code/Codex Translations:** Protected non-streaming payload conversions against empty responses from upstream Codex tools, avoiding catastrophic TypeErrors (#866)+- **NVIDIA NIM Rendering:** Conditionally stripped identical provider prefixes dynamically pushed by audio models, eliminating duplicate `nim/nim` tag structures throwing 404 on the Media Playground (#872)### ⚠️ Breaking Changesdiff --git a/open-sse/config/audioRegistry.ts b/open-sse/config/audioRegistry.tsindex 906bec7100..d95c1483c2 100644--- a/open-sse/config/audioRegistry.ts+++ b/open-sse/config/audioRegistry.ts@@ -341,7 +341,7 @@ export function getAllAudioModels() {for (const [providerId, config] of Object.entries(AUDIO_TRANSCRIPTION_PROVIDERS)) {for (const model of config.models) {models.push({- id: `${providerId}/${model.id}`,+ id: model.id.startsWith(`${providerId}/`) ? model.id : `${providerId}/${model.id}`,name: model.name,provider: providerId,subtype: "transcription",@@ -352,7 +352,7 @@ export function getAllAudioModels() {for (const [providerId, config] of Object.entries(AUDIO_SPEECH_PROVIDERS)) {for (const model of config.models) {models.push({- id: `${providerId}/${model.id}`,+ id: model.id.startsWith(`${providerId}/`) ? model.id : `${providerId}/${model.id}`,name: model.name,provider: providerId,subtype: "speech",diff --git a/open-sse/handlers/responseTranslator.ts b/open-sse/handlers/responseTranslator.tsindex ecb78bbb72..ef2fe7d3df 100644--- a/open-sse/handlers/responseTranslator.ts+++ b/open-sse/handlers/responseTranslator.ts@@ -402,11 +402,14 @@ export function translateNonStreamingResponse(* Helper to convert an OpenAI chat.completion JSON object to Claude format for non-streaming.*/function convertOpenAINonStreamingToClaude(openaiResponse: JsonRecord): JsonRecord {- const choice = Array.isArray(openaiResponse.choices) ? openaiResponse.choices[0] : null;- if (!choice) return openaiResponse; // If it doesn't look like OpenAI, return as-is+ const isChoicesArray = Array.isArray(openaiResponse.choices);+ if (!isChoicesArray && openaiResponse.object !== "chat.completion") {+ return openaiResponse; // If it doesn't look like OpenAI, return as-is+ }- const choiceObj = toRecord(choice);- const messageObj = toRecord(choiceObj.message);+ const choice = isChoicesArray ? openaiResponse.choices[0] : null;+ const choiceObj = choice ? toRecord(choice) : {};+ const messageObj = choiceObj.message ? toRecord(choiceObj.message) : {};const content: JsonRecord[] = [];diff --git a/open-sse/handlers/sseParser.ts b/open-sse/handlers/sseParser.tsindex aa579010bc..39758d409e 100644--- a/open-sse/handlers/sseParser.ts+++ b/open-sse/handlers/sseParser.ts@@ -53,7 +53,11 @@ export function parseSSEToOpenAIResponse(rawSSE, fallbackModel) {reasoningParts.push(delta.reasoning_content);}// Normalize `reasoning` alias (NVIDIA kimi-k2.5 etc.)- if (typeof delta.reasoning === "string" && delta.reasoning.length > 0 && !delta.reasoning_content) {+ if (+ typeof delta.reasoning === "string" &&+ delta.reasoning.length > 0 &&+ !delta.reasoning_content+ ) {reasoningParts.push(delta.reasoning);}@@ -98,11 +102,11 @@ export function parseSSEToOpenAIResponse(rawSSE, fallbackModel) {}}- const joinedContent = contentParts.length > 0 ? contentParts.join("").trim() : null;+ const joinedContent = contentParts.length > 0 ? contentParts.join("").trim() : "";const joinedReasoning = reasoningParts.length > 0 ? reasoningParts.join("").trim() : null;const message: Record<string, unknown> = {role: "assistant",- content: joinedContent || null,+ content: joinedContent,};if (joinedReasoning) {message.reasoning_content = joinedReasoning;diff --git a/open-sse/services/tokenRefresh.ts b/open-sse/services/tokenRefresh.tsindex cb2f020e14..c661326cb4 100644--- a/open-sse/services/tokenRefresh.ts+++ b/open-sse/services/tokenRefresh.ts@@ -324,7 +324,7 @@ export async function refreshQwenToken(refreshToken, log) {});return {- accessToken: tokens.access_token,+ accessToken: tokens.id_token || tokens.access_token,refreshToken: tokens.refresh_token || refreshToken,expiresIn: tokens.expires_in,};diff --git a/src/lib/oauth/providers/qwen.ts b/src/lib/oauth/providers/qwen.tsindex 0a31c09212..a400bdb2cb 100644--- a/src/lib/oauth/providers/qwen.ts+++ b/src/lib/oauth/providers/qwen.ts@@ -60,7 +60,7 @@ export const qwen = {}return {- accessToken: tokens.access_token,+ accessToken: tokens.id_token || tokens.access_token,refreshToken: tokens.refresh_token,expiresIn: tokens.expires_in,idToken: tokens.id_token,