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(translator): only apply thoughtSignature to the first functionCall part in Gemini parallel tool calls

diegosouzapw2fe67ada97d3
diff --git a/open-sse/translator/request/openai-to-gemini.ts b/open-sse/translator/request/openai-to-gemini.ts
index f71a578c7a..149685f410 100644
--- a/open-sse/translator/request/openai-to-gemini.ts
+++ b/open-sse/translator/request/openai-to-gemini.ts
@@ -225,7 +225,7 @@ function openaiToGeminiBase(model, body, stream, toolNameOptions: GeminiToolName
.map((tc) => resolveGeminiThoughtSignature(tc.id, extractClientThoughtSignature(tc)))
.find((signature) => typeof signature === "string" && signature.length > 0);
- const shouldUseEmbeddedSignature = !parts.some((p) => p.thoughtSignature);
+ let shouldUseEmbeddedSignature = !parts.some((p) => p.thoughtSignature);
for (const tc of msg.tool_calls) {
if (tc.type !== "function") continue;
@@ -239,6 +239,10 @@ function openaiToGeminiBase(model, body, stream, toolNameOptions: GeminiToolName
? firstPersistedSignature || signatureForToolCall || DEFAULT_THINKING_GEMINI_SIGNATURE
: undefined;
+ if (embeddedThoughtSignature) {
+ shouldUseEmbeddedSignature = false;
+ }
+
// Gemini expects the signature on the functionCall part itself.
parts.push({
...(embeddedThoughtSignature ? { thoughtSignature: embeddedThoughtSignature } : {}),