Skip to content

Vertex AI multi-region location (us/eu) produces invalid hostname #37006

Description

@ethan-spitz-viasat-com

Description

When the Vertex AI provider's location is set to a continental multi-region value like us or eu, opencode builds an invalid API hostname:

Invalid hostname: us-aiplatform.googleapis.com

Only global is treated as not needing a region prefix on the hostname; us and eu need the same treatment (they're multi-region, not single-region like us-central1). This affects both the OpenAI-compatible endpoint template in opencode's own code, and the native @ai-sdk/google-vertex SDK call (which has the identical "only special-cases global" bug baked into its own default baseURL).

I have a fix ready and will open a PR referencing this issue.

Plugins

None

OpenCode version

1.18.1

Steps to reproduce

  1. Configure the google-vertex provider:
    "provider": {
    "google-vertex": {
    "options": { "project": "", "location": "us" }
    }
    }
  2. Select a Gemini model
  3. Send a message — request fails with "Invalid hostname: us-aiplatform.googleapis.com"

Screenshot and/or share link

Image

Operating System

macOS 26.5.1

Terminal

iTerm2

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Fields

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