Skip to content

fix(vertex): Vertex (Antropic) provider: use .rep.googleapis.com for continental multi-region endpoints (us, eu)#28347

Merged
rekram1-node merged 4 commits into
anomalyco:devfrom
JPFrancoia:dev
May 22, 2026
Merged

fix(vertex): Vertex (Antropic) provider: use .rep.googleapis.com for continental multi-region endpoints (us, eu)#28347
rekram1-node merged 4 commits into
anomalyco:devfrom
JPFrancoia:dev

Conversation

@JPFrancoia
Copy link
Copy Markdown
Contributor

@JPFrancoia JPFrancoia commented May 19, 2026

Issue for this PR

Closes #28348

Closes #27063

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

When using Google Vertex AI with continental multi-region locations (eu, us), the @ai-sdk/google-vertex SDK constructs endpoint URLs like https://eu-aiplatform.googleapis.com.
Unlike standard regional endpoints (e.g. europe-west1-aiplatform.googleapis.com), these continental hostnames do not resolve correctly: they either return 404 or fail to connect, depending on the network environment.

This is a significant issue for enterprise users whose GCP projects provision Anthropic model quota exclusively in continental multi-regions (eu, us) rather than specific regions like europe-west1. In these setups, setting VERTEX_LOCATION=eu is required to reach the quota pool, but the current URL construction makes the endpoint unreachable.

For reference, this is exactly how the Anthropic Python SDK does it: https://github.com/anthropics/anthropic-sdk-python/blob/main/src/anthropic/lib/vertex/_client.py#L125

How did you verify your code works?

I tested the change manually, locally. In my case, my company has a pool of quota for Opus 4.6 in europe-west1, and a pool of quota for Opus 4.7 in "eu". These are the results of my tests:

For the fixed version, run directly from the local codebase:

- GOOGLE_CLOUD_PROJECT=my-fancy-project VERTEX_LOCATION=eu bun dev; opus 4.7 -> works
- GOOGLE_CLOUD_PROJECT=my-fancy-project VERTEX_LOCATION=europe-west1 bun dev; opus 4.6 -> works

The global opencode bin, NOT fixed, installed via brew

- GOOGLE_CLOUD_PROJECT=my-fancy-project VERTEX_LOCATION=europe-west1 opencode; opus 4.6 -> works
- GOOGLE_CLOUD_PROJECT=my-fancy-project VERTEX_LOCATION=eu opencode; opus 4.7 -> doesn't work (expected)

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

If you do not follow this template your PR will be automatically rejected.

@github-actions github-actions Bot added needs:issue needs:compliance This means the issue will auto-close after 2 hours. labels May 19, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions github-actions Bot removed needs:compliance This means the issue will auto-close after 2 hours. needs:issue labels May 19, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

@JPFrancoia JPFrancoia changed the title fix(vertex): use .rep.googleapis.com for continental multi-region endpoints Vertex (Antropic) provider: use .rep.googleapis.com for continental multi-region endpoints (us, eu) May 19, 2026
@github-actions
Copy link
Copy Markdown
Contributor

Hey! Your PR title Vertex (Antropic) provider: use .rep.googleapis.com for continental multi-region endpoints (us, eu) doesn't follow conventional commit format.

Please update it to start with one of:

  • feat: or feat(scope): new feature
  • fix: or fix(scope): bug fix
  • docs: or docs(scope): documentation changes
  • chore: or chore(scope): maintenance tasks
  • refactor: or refactor(scope): code refactoring
  • test: or test(scope): adding or updating tests

Where scope is the package name (e.g., app, desktop, opencode).

See CONTRIBUTING.md for details.

@JPFrancoia JPFrancoia changed the title Vertex (Antropic) provider: use .rep.googleapis.com for continental multi-region endpoints (us, eu) fix(vertex): Vertex (Antropic) provider: use .rep.googleapis.com for continental multi-region endpoints (us, eu) May 19, 2026
@rti
Copy link
Copy Markdown

rti commented May 21, 2026

I think this is the required fix. The docs state the same https://docs.cloud.google.com/vertex-ai/generative-ai/docs/partner-models/use-partner-models#eu

@PowerSlime
Copy link
Copy Markdown

Most probably closes #27063 as well

@rti
Copy link
Copy Markdown

rti commented May 21, 2026

Tested successfully with VERTEX_LOCATION=eu

{
  "$schema": "https://opencode.ai/config.json",
  "enabled_providers": [
    "google-vertex-anthropic"
  ],
  "provider": {
    "google-vertex-anthropic": {
      "whitelist": [
        "claude-opus-4-7@default"
      ]
    },
  }
}

Before the patch lands, overwriting baseURL is a possible workaround:

{
  "$schema": "https://opencode.ai/config.json",
  "enabled_providers": [
    "google-vertex-anthropic"
  ],
  "provider": {
    "google-vertex-anthropic": {
      "options": {
        "baseURL": "https://aiplatform.eu.rep.googleapis.com/v1/projects/YOUR-PROJECT-HERE/locations/eu/publishers/anthropic/models/"
      },
      "whitelist": [
        "claude-opus-4-7@default"
      ]
    },
  }
}

@JPFrancoia
Copy link
Copy Markdown
Contributor Author

JPFrancoia commented May 21, 2026

Tested successfully with VERTEX_LOCATION=eu

{
  "$schema": "https://opencode.ai/config.json",
  "enabled_providers": [
    "google-vertex-anthropic"
  ],
  "provider": {
    "google-vertex-anthropic": {
      "whitelist": [
        "claude-opus-4-7@default"
      ]
    },
  }
}

Before the patch lands, overwriting baseURL is a possible workaround:

{
  "$schema": "https://opencode.ai/config.json",
  "enabled_providers": [
    "google-vertex-anthropic"
  ],
  "provider": {
    "google-vertex-anthropic": {
      "options": {
        "baseURL": "https://aiplatform.eu.rep.googleapis.com/v1/projects/YOUR-PROJECT-HERE/locations/eu/publishers/anthropic/models/"
      },
      "whitelist": [
        "claude-opus-4-7@default"
      ]
    },
  }
}

Correct, that's the workaround I'm using too.

@rekram1-node
Copy link
Copy Markdown
Collaborator

will review today

},
}
}),
"google-vertex-anthropic": Effect.fnUntraced(function* () {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a legacy provider u should not use if u can help it, instead just use google-vertex it should work for other models and anthropic models just fine

@rekram1-node
Copy link
Copy Markdown
Collaborator

it will be deprecated in an upcoming release

@rekram1-node
Copy link
Copy Markdown
Collaborator

/review

Comment thread packages/core/src/plugin/provider/google-vertex.ts Outdated
@rekram1-node
Copy link
Copy Markdown
Collaborator

/review

Comment thread packages/opencode/src/provider/provider.ts
@rekram1-node
Copy link
Copy Markdown
Collaborator

made a small change to make sure it should work for google-vertex too when using anthropic models

@rekram1-node rekram1-node merged commit 7a97244 into anomalyco:dev May 22, 2026
8 checks passed
MyNameIsGMLi pushed a commit to MyNameIsGMLi/opencode that referenced this pull request May 22, 2026
…continental multi-region endpoints (us, eu) (anomalyco#28347)

Co-authored-by: Aiden Cline <aidenpcline@gmail.com>
rustybret pushed a commit to rustybret/opencode that referenced this pull request May 22, 2026
…continental multi-region endpoints (us, eu) (anomalyco#28347)

Co-authored-by: Aiden Cline <aidenpcline@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Vertex (anthropic): can't use continental multi-region locations Opus 4.7 doesn't work through Google Vertex AI

4 participants