feat(provider): add google-vertex-openai for Vertex AI partner models #10742
+38
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Adds custom loader for
google-vertex-openaiprovider to enable Vertex AI partner models (GLM, Llama, Qwen, DeepSeek) via the OpenAI-compatible Chat Completions API endpoint.Problem
The
@ai-sdk/google-vertexSDK only supports Google's Gemini models because it:publishers/googlein URL constructionv1beta1API versionPartner models like GLM-4.7, Llama 4, Qwen3, and DeepSeek use a different endpoint:
Solution
Created custom loader for
google-vertex-openaiprovider that:@ai-sdk/openai-compatible(already bundled in OpenCode)google-auth-libraryfor auto-refreshing tokens (transitive dep of@ai-sdk/google-vertex)GOOGLE_CLOUD_PROJECTenv var is set and credentials are availableTechnical Details
Auth Method: Google Application Default Credentials (ADC)
GoogleAuthfromgoogle-auth-libraryhttps://www.googleapis.com/auth/cloud-platformEndpoint Construction:
https://aiplatform.googleapis.com/v1/projects/{project}/locations/global/endpoints/openapihttps://{location}-aiplatform.googleapis.com/v1/projects/{project}/locations/{location}/endpoints/openapiImplementation Pattern:
Follows the same pattern as
google-vertex-anthropicloader - custom SDK with OAuth injection.Models Supported
Models are defined in companion PR: anomalyco/models.dev#716
Testing
Requires:
GOOGLE_CLOUD_PROJECTenvironment variablegcloud auth application-default loginTest command:
Related PRs
References