From 6c18d5154f6e6f37cc6e7454fe6840e4875ab379 Mon Sep 17 00:00:00 2001 From: Matthew Rogers Date: Fri, 16 May 2025 19:37:12 +0100 Subject: [PATCH] fix: permit use of global endpoint for vertex ai (#3469) --- .changeset/spotty-geese-try.md | 5 +++++ docs/custom-model-configs/gcp-vertex-ai.mdx | 10 +++++----- package-lock.json | 14 +++++++------- package.json | 2 +- src/shared/api.ts | 12 ++++++++++++ webview-ui/src/components/settings/ApiOptions.tsx | 5 ++++- 6 files changed, 34 insertions(+), 14 deletions(-) create mode 100644 .changeset/spotty-geese-try.md diff --git a/.changeset/spotty-geese-try.md b/.changeset/spotty-geese-try.md new file mode 100644 index 00000000..ce877d3b --- /dev/null +++ b/.changeset/spotty-geese-try.md @@ -0,0 +1,5 @@ +--- +"claude-dev": minor +--- + +adds global endpoint for vertex ai users diff --git a/docs/custom-model-configs/gcp-vertex-ai.mdx b/docs/custom-model-configs/gcp-vertex-ai.mdx index 7b29561f..466f249f 100644 --- a/docs/custom-model-configs/gcp-vertex-ai.mdx +++ b/docs/custom-model-configs/gcp-vertex-ai.mdx @@ -44,16 +44,16 @@ This guide is tailored for organizations with established GCP environments (leve #### 2.1 Choose and Confirm a Region -Vertex AI supports eight regions. Select a region that meets your latency, compliance, and capacity needs. Examples include: +Vertex AI supports multiple regions. Select a region that meets your latency, compliance, and capacity needs. Examples include: - **us-east5 (Columbus, Ohio)** -- **us-east1 (South Carolina)** -- **us-east4 (Northern Virginia)** - **us-central1 (Iowa)** -- **us-west1 (The Dalles, Oregon)** -- **us-west4 (Las Vegas, Nevada)** - **europe-west1 (Belgium)** +- **europe-west4 (Netherlands)** - **asia-southeast1 (Singapore)** +- **global (Global)** + +The Global endpoint may offer higher availability and reduce resource exhausted errors. Only Gemini models are supported. #### 2.2 Enable the Claude 3.5 Sonnet v2 Model diff --git a/package-lock.json b/package-lock.json index 74ea5cad..913f9298 100644 --- a/package-lock.json +++ b/package-lock.json @@ -15,7 +15,7 @@ "@aws-sdk/client-bedrock-runtime": "^3.758.0", "@bufbuild/protobuf": "^2.2.5", "@google-cloud/vertexai": "^1.9.3", - "@google/genai": "^0.9.0", + "@google/genai": "^0.13.0", "@grpc/grpc-js": "^1.9.15", "@grpc/reflection": "^1.0.4", "@mistralai/mistralai": "^1.5.0", @@ -5295,9 +5295,9 @@ } }, "node_modules/@google/genai": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/@google/genai/-/genai-0.9.0.tgz", - "integrity": "sha512-FD2RizYGInsvfjeaN6O+wQGpRnGVglS1XWrGQr8K7D04AfMmvPodDSw94U9KyFtsVLzWH9kmlPyFM+G4jbmkqg==", + "version": "0.13.0", + "resolved": "https://registry.npmjs.org/@google/genai/-/genai-0.13.0.tgz", + "integrity": "sha512-eaEncWt875H7046T04mOpxpHJUM+jLIljEf+5QctRyOeChylE/nhpwm1bZWTRWoOu/t46R9r+PmgsJFhTpE7tQ==", "license": "Apache-2.0", "dependencies": { "google-auth-library": "^9.14.2", @@ -29924,9 +29924,9 @@ } }, "@google/genai": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/@google/genai/-/genai-0.9.0.tgz", - "integrity": "sha512-FD2RizYGInsvfjeaN6O+wQGpRnGVglS1XWrGQr8K7D04AfMmvPodDSw94U9KyFtsVLzWH9kmlPyFM+G4jbmkqg==", + "version": "0.13.0", + "resolved": "https://registry.npmjs.org/@google/genai/-/genai-0.13.0.tgz", + "integrity": "sha512-eaEncWt875H7046T04mOpxpHJUM+jLIljEf+5QctRyOeChylE/nhpwm1bZWTRWoOu/t46R9r+PmgsJFhTpE7tQ==", "requires": { "google-auth-library": "^9.14.2", "ws": "^8.18.0", diff --git a/package.json b/package.json index 3545fa39..f44a319e 100644 --- a/package.json +++ b/package.json @@ -319,7 +319,7 @@ "@aws-sdk/client-bedrock-runtime": "^3.758.0", "@bufbuild/protobuf": "^2.2.5", "@google-cloud/vertexai": "^1.9.3", - "@google/genai": "^0.9.0", + "@google/genai": "^0.13.0", "@grpc/grpc-js": "^1.9.15", "@grpc/reflection": "^1.0.4", "@mistralai/mistralai": "^1.5.0", diff --git a/src/shared/api.ts b/src/shared/api.ts index f39b7b36..1246d0b8 100644 --- a/src/shared/api.ts +++ b/src/shared/api.ts @@ -114,6 +114,7 @@ export interface ModelInfo { outputPrice?: number // Output price per million tokens when budget > 0 outputPriceTiers?: PriceTier[] // Optional: Tiered output price when budget > 0 } + supportsGlobalEndpoint?: boolean // Whether the model supports a global endpoint with Vertex AI cacheWritesPrice?: number cacheReadsPrice?: number description?: string @@ -403,6 +404,7 @@ export const vertexModels = { contextWindow: 1_048_576, supportsImages: true, supportsPromptCache: true, + supportsGlobalEndpoint: true, inputPrice: 0.15, outputPrice: 0.6, cacheWritesPrice: 1.0, @@ -413,6 +415,7 @@ export const vertexModels = { contextWindow: 1_048_576, supportsImages: true, supportsPromptCache: false, + supportsGlobalEndpoint: true, inputPrice: 0.075, outputPrice: 0.3, }, @@ -421,6 +424,7 @@ export const vertexModels = { contextWindow: 32_767, supportsImages: true, supportsPromptCache: false, + supportsGlobalEndpoint: true, inputPrice: 0, outputPrice: 0, }, @@ -429,6 +433,7 @@ export const vertexModels = { contextWindow: 1_048_576, supportsImages: true, supportsPromptCache: false, + supportsGlobalEndpoint: true, inputPrice: 0, outputPrice: 0, }, @@ -445,6 +450,7 @@ export const vertexModels = { contextWindow: 1_048_576, supportsImages: true, supportsPromptCache: true, + supportsGlobalEndpoint: true, inputPrice: 2.5, outputPrice: 15, cacheReadsPrice: 0.31, @@ -468,6 +474,7 @@ export const vertexModels = { contextWindow: 1_048_576, supportsImages: true, supportsPromptCache: false, + supportsGlobalEndpoint: true, inputPrice: 0.15, outputPrice: 0.6, thinkingConfig: { @@ -480,6 +487,7 @@ export const vertexModels = { contextWindow: 1_048_576, supportsImages: true, supportsPromptCache: false, + supportsGlobalEndpoint: true, inputPrice: 0, outputPrice: 0, }, @@ -549,6 +557,10 @@ export const vertexModels = { }, } as const satisfies Record +export const vertexGlobalModels: Record = Object.fromEntries( + Object.entries(vertexModels).filter(([_k, v]) => v.hasOwnProperty("supportsGlobalEndpoint")), +) as Record + export const openAiModelInfoSaneDefaults: OpenAiCompatibleModelInfo = { maxTokens: -1, contextWindow: 128_000, diff --git a/webview-ui/src/components/settings/ApiOptions.tsx b/webview-ui/src/components/settings/ApiOptions.tsx index 4611aebb..cc35f51f 100644 --- a/webview-ui/src/components/settings/ApiOptions.tsx +++ b/webview-ui/src/components/settings/ApiOptions.tsx @@ -41,6 +41,7 @@ import { internationalQwenDefaultModelId, vertexDefaultModelId, vertexModels, + vertexGlobalModels, askSageModels, askSageDefaultModelId, askSageDefaultURL, @@ -933,6 +934,7 @@ const ApiOptions = ({ europe-west1 europe-west4 asia-southeast1 + global

Model {selectedProvider === "anthropic" && createDropdown(anthropicModels)} - {selectedProvider === "vertex" && createDropdown(vertexModels)} + {selectedProvider === "vertex" && + createDropdown(apiConfiguration?.vertexRegion === "global" ? vertexGlobalModels : vertexModels)} {selectedProvider === "gemini" && createDropdown(geminiModels)} {selectedProvider === "openai-native" && createDropdown(openAiNativeModels)} {selectedProvider === "deepseek" && createDropdown(deepSeekModels)}