Skip to content

@ai-sdk/google-vertex@4.0.106: unconditional streamFunctionCallArguments breaks all Vertex unary API calls #14314

@danielwii

Description

@danielwii

Description

All @ai-sdk/google-vertex generateText / generateObject calls (Vertex unary endpoint generateContent) return 400 after upgrading to 4.0.106:

Unable to submit request because streaming function call is not supported in unary API.
Learn more: https://cloud.google.com/vertex-ai/generative-ai/docs/model-reference/gemini

Even without any tools, all Vertex models (gemini-2.5-flash-lite, gemini-3-flash-preview, etc.) fail 100%. The streaming endpoint (streamGenerateContent) is not affected.

Root Cause

4.0.106 (released 2026-04-09, likely from #11126) unconditionally adds to the request body:

{
  "toolConfig": {
    "functionCallingConfig": {
      "streamFunctionCallArguments": true
    }
  }
}

Two issues:

  1. This parameter must not be sent to the unary endpoint (generateContent) — Vertex API rejects it
  2. This parameter should not be sent when no tools/functionDeclarations are present

Bisection

Version toolConfig in body Result
4.0.105 none ✅ works
4.0.106 {streamFunctionCallArguments: true} ❌ 400

Code example

import { createVertex } from "@ai-sdk/google-vertex";
import { generateText } from "ai";

const vertex = createVertex({ apiKey: process.env.GOOGLE_VERTEX_API_KEY });

// Works in 4.0.105, fails in 4.0.106
const { text } = await generateText({
  model: vertex("gemini-2.5-flash-lite"),
  prompt: "Say hello",
});

Fetch intercept confirms the difference:

  • 4.0.105: {"generationConfig":{}, "contents":[...]} — clean
  • 4.0.106: {"generationConfig":{}, "contents":[...], "toolConfig":{"functionCallingConfig":{"streamFunctionCallArguments":true}}} — breaks

AI SDK Version

6.0.156

AI SDK Provider + Version

@ai-sdk/google-vertex 4.0.106

Other information

  • Runtime: Bun 1.3.10 (also reproducible with Node.js)
  • Vertex API mode: Express Mode (API Key auth)
  • Models affected: all tested models (gemini-2.5-flash-lite, gemini-3-flash-preview, etc.)
  • Workaround: pin to 4.0.105

Suggested fix

streamFunctionCallArguments should:

  1. Only be set for the streaming endpoint (streamGenerateContent), not unary (generateContent)
  2. Only be set when tools/functionDeclarations are present
  3. Or be opt-in rather than default-on

Metadata

Metadata

Assignees

No one assigned

    Labels

    ai/providerrelated to a provider package. Must be assigned together with at least one `provider/*` labelbugSomething isn't working as documentedprovider/google-vertexIssues related to the @ai-sdk/google-vertex providerreproduction provided

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions