Skip to content

[@ai-sdk/google-vertex] Unexpected global location domain #6644

Closed
@moret

Description

@moret

Description

Hi. I am using @ai-sdk/google-vertex to connect to Gemini models, but I noticed that when I set the location to global - either via GOOGLE_VERTEX_LOCATION environment variable, or via location parameter - it reaches out for https://global-aiplatform.googleapis.com/... instead of https://aiplatform.googleapis.com/..., resulting in a 404 from Google.

Non-working example:

createVertex({
  location: 'global',
  project: 'my-project',
})

I was able to workaround it by setting the global endpoint using baseURL. Working example:

createVertex({
  baseURL: 'https://aiplatform.googleapis.com/v1/projects/my-project/locations/global/publishers/google',
  location: 'global',
  project: 'my-project',
})

Ref.: https://cloud.google.com/vertex-ai/generative-ai/docs/learn/locations#global-endpoint

AI SDK Version

"@ai-sdk/google-vertex": "^2.2.24",
"ai": "^4.3.16",

Metadata

Metadata

Assignees

No one assigned

    Labels

    duplicateThis issue or pull request already exists

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions