-
Notifications
You must be signed in to change notification settings - Fork 2.5k
feat(vertex-anthropic): add support for custom Vertex AI Anthropic model #1651
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: next
Are you sure you want to change the base?
Changes from all commits
fa34d8e
abf144a
607c597
eb5331b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| 'task-master-ai': minor | ||
| --- | ||
|
|
||
| Add support for Vertex AI Anthropic provider to use Claude models through Google Vertex AI |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -583,6 +583,11 @@ async function setModel(role, modelId, options = {}) { | |
| determinedProvider = CUSTOM_PROVIDERS.VERTEX; | ||
| warningMessage = `Warning: Custom Vertex AI model '${modelId}' set. Please ensure the model is valid and accessible in your Google Cloud project.`; | ||
| report('warn', warningMessage); | ||
| } else if (providerHint === CUSTOM_PROVIDERS.VERTEX_ANTHROPIC) { | ||
| // Set provider without model validation since Vertex Anthropic models are managed by Google Cloud | ||
| determinedProvider = CUSTOM_PROVIDERS.VERTEX_ANTHROPIC; | ||
| warningMessage = `Warning: Custom Vertex AI Anthropic model '${modelId}' set. Please ensure the model is valid and accessible in your Google Cloud project.`; | ||
| report('warn', warningMessage); | ||
| } else if (providerHint === CUSTOM_PROVIDERS.GEMINI_CLI) { | ||
| // Gemini CLI provider - check if model exists in our list | ||
| determinedProvider = CUSTOM_PROVIDERS.GEMINI_CLI; | ||
|
|
@@ -693,7 +698,7 @@ async function setModel(role, modelId, options = {}) { | |
| success: false, | ||
| error: { | ||
| code: 'MODEL_NOT_FOUND_NO_HINT', | ||
| message: `Model ID "${modelId}" not found in Taskmaster's supported models. If this is a custom model, please specify the provider using --openrouter, --ollama, --bedrock, --azure, --vertex, --lmstudio, --openai-compatible, --gemini-cli, or --codex-cli.` | ||
| message: `Model ID "${modelId}" not found in Taskmaster's supported models. If this is a custom model, please specify the provider using --openrouter, --ollama, --bedrock, --azure, --vertex, --vertex-anthropic, --lmstudio, --openai-compatible, --gemini-cli, or --codex-cli.` | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Include
💡 Proposed fix- message: `Model ID "${modelId}" not found in Taskmaster's supported models. If this is a custom model, please specify the provider using --openrouter, --ollama, --bedrock, --azure, --vertex, --vertex-anthropic, --lmstudio, --openai-compatible, --gemini-cli, or --codex-cli.`
+ message: `Model ID "${modelId}" not found in Taskmaster's supported models. If this is a custom model, please specify the provider using --openrouter, --ollama, --bedrock, --azure, --vertex, --vertex-anthropic, --claude-code, --lmstudio, --openai-compatible, --gemini-cli, or --codex-cli.`🤖 Prompt for AI AgentsThere was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. CLI flag
|
||
| } | ||
| }; | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| /** | ||
| * google-vertex-anthropic.js | ||
| * AI provider implementation for Anthropic models on Google Vertex AI using Vercel AI SDK. | ||
| * This provider uses the createVertexAnthropic client to route requests to the | ||
| * publishers/anthropic endpoint instead of publishers/google. | ||
| * | ||
| * Extends VertexAIProvider — only the client factory and display name differ. | ||
| */ | ||
|
|
||
| import { createVertexAnthropic } from '@ai-sdk/google-vertex/anthropic'; | ||
| import { VertexAIProvider } from './google-vertex.js'; | ||
|
|
||
| export class VertexAnthropicProvider extends VertexAIProvider { | ||
| constructor() { | ||
| super(); | ||
| this.name = 'Google Vertex AI (Anthropic)'; | ||
| } | ||
|
|
||
| /** | ||
| * Creates and returns a Google Vertex AI Anthropic client instance. | ||
| * Uses createVertexAnthropic to route to the publishers/anthropic endpoint. | ||
| * @param {object} params - Parameters for client initialization | ||
| * @param {string} [params.apiKey] - Google API key | ||
| * @param {string} params.projectId - Google Cloud project ID | ||
| * @param {string} params.location - Google Cloud location (e.g., "us-central1") | ||
| * @param {object} [params.credentials] - Service account credentials object | ||
| * @param {string} [params.baseURL] - Optional custom API endpoint | ||
| * @returns {Function} Google Vertex AI Anthropic client function | ||
| * @throws {Error} If required parameters are missing or initialization fails | ||
| */ | ||
| getClient(params) { | ||
| try { | ||
| const { apiKey, projectId, location, credentials, baseURL } = params; | ||
| const fetchImpl = this.createProxyFetch(); | ||
|
|
||
| // Configure auth options - either API key or service account | ||
| const authOptions = {}; | ||
| if (apiKey) { | ||
| authOptions.googleAuthOptions = { | ||
| ...credentials, | ||
| apiKey | ||
| }; | ||
| } else if (credentials) { | ||
| authOptions.googleAuthOptions = credentials; | ||
| } | ||
|
|
||
| // Return Vertex AI Anthropic client (publishers/anthropic endpoint) | ||
| return createVertexAnthropic({ | ||
| ...authOptions, | ||
| project: projectId, | ||
| location, | ||
| ...(baseURL && { baseURL }), | ||
| ...(fetchImpl && { fetch: fetchImpl }) | ||
| }); | ||
| } catch (error) { | ||
| this.handleError('client initialization', error); | ||
| } | ||
| } | ||
| } | ||
cursor[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: eyaltoledano/claude-task-master
Length of output: 1990
🏁 Script executed:
Repository: eyaltoledano/claude-task-master
Length of output: 1228
🏁 Script executed:
Repository: eyaltoledano/claude-task-master
Length of output: 3425
🏁 Script executed:
Repository: eyaltoledano/claude-task-master
Length of output: 528
🏁 Script executed:
Repository: eyaltoledano/claude-task-master
Length of output: 353
Add
vertex-anthropicto config-manager.js and supported-models.json registries.Lines 586–590 allow users to set
VERTEX_ANTHROPICas the provider, but the integration is incomplete. The provider is missing from:isApiKeySet()andgetMcpApiKeyStatus()will fail for this provider.getAvailableModels()will not discoververtex-anthropicmodels, andMODEL_MAPvalidation will not recognize the provider.Users can persist the provider here but will encounter broken key-status checks and missing model metadata downstream. Add the provider to both registries with the appropriate API key mapping and model metadata.
🤖 Prompt for AI Agents