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(deepseek): pass requestId context to cache and widen sanitizer regex

kang-heewon72dd7c9b4913
diff --git a/open-sse/handlers/chatCore.ts b/open-sse/handlers/chatCore.ts
index 90b4b1a784..7146188bc2 100644
--- a/open-sse/handlers/chatCore.ts
+++ b/open-sse/handlers/chatCore.ts
@@ -4134,7 +4134,7 @@ export async function handleChatCore({
try {
const firstChoice = translatedResponse?.choices?.[0];
const msg = firstChoice?.message;
- cacheReasoningFromAssistantMessage(msg, provider, model);
+ cacheReasoningFromAssistantMessage(msg, provider, model, { requestId: skillRequestId, messageIndex: 0 });
} catch {
// Cache capture is non-critical — never block the response
}
@@ -4421,7 +4421,7 @@ export async function handleChatCore({
const body = streamResponseBody as Record<string, unknown>;
const choices = body.choices as { message?: Record<string, unknown> }[] | undefined;
const msg = choices?.[0]?.message;
- cacheReasoningFromAssistantMessage(msg, provider, model);
+ cacheReasoningFromAssistantMessage(msg, provider, model, { requestId: skillRequestId, messageIndex: 0 });
} catch {
// Cache capture is non-critical — never block the stream
}
diff --git a/open-sse/handlers/responseSanitizer.ts b/open-sse/handlers/responseSanitizer.ts
index dfd7bb7a85..f7cbb300fc 100644
--- a/open-sse/handlers/responseSanitizer.ts
+++ b/open-sse/handlers/responseSanitizer.ts
@@ -28,7 +28,7 @@ const ALLOWED_RESPONSES_USAGE_FIELDS = new Set([
type JsonRecord = Record<string, unknown>;
function isDeepSeekV4Model(model: unknown): boolean {
- return typeof model === "string" && /^deepseek-v4(?:$|[-_/])/i.test(model);
+ return typeof model === "string" && /deepseek[-/]v4/i.test(model);
}
function toRecord(value: unknown): JsonRecord | null {