I’m hitting a wall trying to run google/gemini-3-pro-preview with tools enabled through streamText + /ai-sdk-provider. Curious if anyone has replicated this or found a workaround. I can see some posts on n8n community and other communities with this issue.
Stack
-
Node 20 backend with Vercel AI SDK (ai latest)
-
OpenRouter provider (/ai-sdk-provider@1.7.5)
-
Streaming mode with 15 tool() definitions registered (toolChoice: 'auto')
-
Model: google/gemini-3-pro-preview (same code path works fine for GPT-4o, Claude, Gemini 2.5, etc.)
What happens
-
Model issues a tool call normally (we log the entire result.fullStream, including custom “Gemini3 Debug” lines).
-
Tool executes (in this case a GitHub REST fetch) and we send the tool-result back.
-
Next streamText call to OpenRouter immediately fails before any new tokens arrive: Google responds with 400 INVALID_ARGUMENT, and finishReason is unknown.
Full error snippet:
{
"error": {
*"code"*: 400,*"message"*: "Provider returned error",*"metadata"*: { *"raw"*: "{\\"error\": {
\"code\": 400,
\"message\": \"Request contains an invalid argument.\",
\"status\": \"INVALID_ARGUMENT\"
}
}
",
*"provider_name"*: "Google"}}
}
Suspected cause
Gemini 3’s docs say function/tool calls require a thought_signature token that must be echoed back alongside the tool response. Problem: the Vercel/OpenRouter stream never surfaces that field. My logs show the tool-call and tool-result data exactly, but there’s no signature to replay, so Google drops the conversation as soon as the next turn starts.
What I’ve tried
-
Added instrumentation around result.fullStream to dump any chunk with thought_signature/thoughtSignature. Got nothing.
-
Reduced context, removed attachments, etc.—same error.
-
Switching to “ask” mode within my platform (no tools) works fine, so the issue only appears when tools are available.
-
Reached out to OpenRouter support to ask if they expose thought signatures yet.
Questions for whoever is reading
-
Has anyone successfully run Gemini 3 with tools via Vercel’s AI SDK (either directly or through OpenRouter)?
-
Does the SDK expose thought_signature anywhere, and if so, how are you capturing/replaying it between steps?
-
If it’s not supported yet, are folks disabling tools for Gemini 3 or routing those calls straight to Google’s API?
Happy to share more logs or a minimal repro. Appreciate any pointers!
