fix(vertex): Vertex (Antropic) provider: use .rep.googleapis.com for continental multi-region endpoints (us, eu)#28347
Conversation
|
Thanks for your contribution! This PR doesn't have a linked issue. All PRs must reference an existing issue. Please:
See CONTRIBUTING.md for details. |
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍 |
|
Hey! Your PR title Please update it to start with one of:
Where See CONTRIBUTING.md for details. |
|
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 |
|
Most probably closes #27063 as well |
|
Tested successfully with {
"$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 {
"$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. |
|
will review today |
| }, | ||
| } | ||
| }), | ||
| "google-vertex-anthropic": Effect.fnUntraced(function* () { |
There was a problem hiding this comment.
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
|
it will be deprecated in an upcoming release |
|
/review |
|
/review |
|
made a small change to make sure it should work for |
…continental multi-region endpoints (us, eu) (anomalyco#28347) Co-authored-by: Aiden Cline <aidenpcline@gmail.com>
…continental multi-region endpoints (us, eu) (anomalyco#28347) Co-authored-by: Aiden Cline <aidenpcline@gmail.com>
Issue for this PR
Closes #28348
Closes #27063
Type of change
What does this PR do?
When using Google Vertex AI with continental multi-region locations (eu, us), the
@ai-sdk/google-vertexSDK constructs endpoint URLs likehttps://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=euis 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:
The global opencode bin, NOT fixed, installed via brew
Checklist
If you do not follow this template your PR will be automatically rejected.