feat(provider): add google-vertex-openai for Vertex AI partner models#10742
feat(provider): add google-vertex-openai for Vertex AI partner models#10742bluet wants to merge 1 commit intoanomalyco:devfrom
Conversation
…dels
Add custom loader for google-vertex-openai provider that enables
Vertex AI partner models (GLM, Llama, Qwen, DeepSeek) via the
OpenAI-compatible Chat Completions API endpoint.
Implementation:
- Uses @ai-sdk/openai-compatible (already bundled)
- Injects Google OAuth via custom fetch wrapper
- Uses google-auth-library for auto-refreshing tokens (transitive dep)
- Supports both global and regional endpoints
- Auto-loads when GOOGLE_CLOUD_PROJECT is set and credentials available
Endpoint pattern:
https://{location}-aiplatform.googleapis.com/v1/projects/{project}/locations/{location}/endpoints/openapi
Companion PR in anomalyco/models.dev adds model definitions.
|
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. |
|
The following comment was made by an LLM, it may be inaccurate: POTENTIAL DUPLICATE FOUND: PR #10303: feat: add google-vertex-openapi provider with ADC authentication Why it's related:
Recommendation: Check PR #10303 to see if it's addressing the same feature or if there's overlap in implementation. They may need to be consolidated or one may supersede the other. |
|
Closing in favor of #10303, which takes a better approach (extending the existing google-vertex provider with a PR #10303 is more mature with comprehensive tests and aligns with the consolidation direction that @rekram1-node mentioned for models.dev. Happy to help review or test #10303 if needed. |
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