A bridge between VS Code Copilot Chat and Google Cloud Vertex AI (Gemini & Claude), secured via native GCP identity (ADC) and billed via Google cloud Billing. (uses VS Code LanguageModelChatProvider A
翻譯準備中
外掛TypeScript · JavaScriptGitHub @jorsm自行安裝營運者未確認
試用過了嗎? 點一下就好,不需要登入。
尚未偵測到更新。GitHub 發布版本後會顯示在這裡。
個人 GitHub 帳號下公開儲存庫的擁有者可以登入並驗證所有權,自行管理介紹,無需管理員核准。
登入並產生驗證檔案,在 30 分鐘內將其提交至此儲存庫的預設分支。其他分支或分叉儲存庫中的檔案無效。然後在下方檢查檔案,即可無需管理員核准直接管理專案。請保留檔案以維持管理權限。
如需登入,將前往登入頁面。登入後請回到此處,再次點擊所選的驗證按鈕。
安裝型專案無需部署網域也可驗證。個人儲存庫可透過 GitHub 登入驗證,組織儲存庫可使用上方的儲存庫驗證檔案。
A bridge between VS Code Copilot Chat and Google Cloud Vertex AI (Gemini & Claude), secured via native GCP identity (ADC) and billed via Google cloud Billing. (uses VS Code LanguageModelChatProvider API).
翻譯準備中
取自儲存庫 README
正在載入完整 README。
檢視完整 README ↗Use Google Gemini, Anthropic Claude, and xAI Grok directly in the standard VS Code Chat panel. You always choose the Google Cloud project (vertexAiChat.projectId) on which the Vertex APIs are invoked and billed. By default the extension calls Vertex directly; organizations can instead route Gemini and Claude through an enterprise proxy to centralize metrics, access policies, and business logic.
SecretStorage.projectId, settable per workspace, selects the Google Cloud project to invoke and bill as you switch contexts, directly or through a proxy.Before you start, make sure the target Google Cloud project is ready:
aiplatform.googleapis.com). See the Google Agent Platform documentation.roles/aiplatform.user).[!TIP] Pro tip: Set a monthly Agent Platform spend cap to receive alerts at 50% and 80% and pause new usage at the limit. Enforcement isn't instant, so some overage is still possible.
Install Google Agent Platform for Copilot Chat from the VS Code Marketplace.
Authenticate in the environment where the extension runs:
gcloud auth application-default login in a terminal. This is for direct calls to Vertex; a proxy uses gcloud auth login instead (see Which Google identity makes the call).Set the project (required) in VS Code Settings (Ctrl+,):
{
"vertexAiChat.projectId": "my-gcp-project-id"
}
projectId is mandatory in every mode: it is the project on which the Vertex APIs are invoked and billed. Set it in workspace settings when different repositories should use different Google Cloud projects. Without it, no models are available.
Optionally, add vertexAiChat.proxyUrl to go through an organization proxy (see Direct or via proxy). Leave it empty to call Vertex directly.
Start chatting: Open VS Code Chat, select a Google Agent Platform model, and send a prompt. If the picker is empty, run Google Agent Platform: Refresh Models.
For Remote SSH, Dev Containers, and Codespaces, install the extension and configure credentials in the remote workspace environment. See Setup & Configuration.
In direct mode, model discovery groups effort variants by their model endpoint and shares each endpoint's result across its catalog entries. It allows up to 45 seconds per endpoint in each region by default, covering its requests and retry delays after it leaves the queue. If discovery needs more time, change Model Discovery Timeout Seconds in VS Code Settings or set a custom value in user or workspace settings:
{
"vertexAiChat.modelDiscoveryTimeoutSeconds": 90
}
Run Google Agent Platform: Refresh Models to apply the new timeout. Discovery runs at most three endpoints concurrently, spacing initial starts by 500–1,000 ms. Transient failures receive up to three retries after the first attempt, with randomized exponential backoff; Retry-After is honored within the endpoint's timeout. Endpoints that return 429 remain available with all their catalog effort variants even if retries are exhausted. Endpoints that never respond are skipped. Queue time can make the entire discovery run longer than the per-endpoint timeout.
In proxy mode, discovery first waits for a personal ID token, then fetches the catalog. The gcloud command timeout accepts 1–300 whole seconds per attempt, with a 20-second default for invalid values. The authentication allowance is four times vertexAiChat.gcloudCommandTimeoutSeconds, plus 10 seconds (90 seconds with the default command timeout), including any wait in the shared CLI queue. After authentication, the catalog HTTP request and response reading get the full vertexAiChat.modelDiscoveryTimeoutSeconds allowance (45 seconds by default). The default combined allowance is therefore up to 135 seconds; reducing the HTTP timeout does not reduce the authentication allowance. See proxy discovery for the full policy.
vertexAiChat.projectId is always required. vertexAiChat.proxyUrl is optional and only changes the route:
proxyUrl | Route | Authentication | Project |
|---|---|---|---|
| Empty | Extension → Vertex | ADC or Service Account | projectId |
| Set | Extension → proxy → Vertex | Personal gcloud auth login identity, verified by the proxy | projectId, sent to the proxy, which calls Vertex on it |
{
"vertexAiChat.projectId": "my-gcp-project-id",
"vertexAiChat.proxyUrl": "https://ai-proxy.example.com"
}
Google Cloud keeps two independent credential stores, and the extension uses a different one in each mode:
Direct (proxyUrl empty) | Via proxy (proxyUrl set) | |
|---|---|---|
| Credential store | Application Default Credentials (ADC) | Standard gcloud accounts |
| Created with | gcloud auth application-default login | gcloud auth login |
| Why | The Vertex SDKs (Gemini, Claude, Grok) look up the default credentials themselves | The extension runs gcloud auth print-identity-token and sends that token to the proxy |
| Which account | The single ADC identity, or a stored Service Account | The active account in gcloud auth list |
The two stores do not follow each other. If gcloud auth list shows user A as active but gcloud auth application-default login was run as user B, direct calls to Vertex are made as B and calls through the proxy are authenticated as A. Switching proxyUrl on or off therefore changes the identity, and so the IAM permissions, quota and audit trail that apply. A Service Account selected in the extension is used only in direct mode and is never accepted by the proxy.
The vscode-vertex-ai-user label and the usage dashboard account come from the active gcloud account (or the Service Account's email), not from ADC, so in direct mode they can name a different person than the one Vertex bills and authorizes.
To check each identity:
gcloud auth list; the active account is marked with *. Change it with gcloud config set account <email>.~/.config/gcloud/application_default_credentials.json (%APPDATA%\gcloud\application_default_credentials.json on Windows) and are not listed by gcloud auth list. To change them, run gcloud auth application-default login again as the intended user.When both modes are used, log in to both with the same account, or keep the identities deliberately different and know which one applies. Refresh Models after changing either.
proxyUrlFor organizations that need centralized model access, budgets, telemetry, or conditional access to specific projects, vertexAiChat.proxyUrl routes Gemini and Claude calls through your own service. The proxy is where you implement those policies and business logic, such as allowing only cataloged projects and only certain users on each of them. If the proxy cannot call Vertex on your project, the error is shown in VS Code.
proxyUrl is a user-level setting; workspace settings cannot change it. To use no proxy for one repository and different proxies for others, create one VS Code profile per route and tie each folder to its profile. projectId can still be set per repository in .vscode/settings.json. See using different proxies per workspace.
See the enterprise proxy guide for use cases, configuration, the access model, and the implementation contract.
gemini-3-flash-preview). Use Google Agent Platform: Select Commit Message Model to choose from the current catalog, or edit vertexAiChat.commitMessageModel in user, workspace, or folder settings. An empty or unavailable selection shows an error without switching models.Run Google Agent Platform: Thinking Effort from the Command Palette, or use the Chat header brain icon. Choose a model, then one of its named effort levels. The model list shows the name and effective effort. The effort list contains each value once, with Default in gray secondary text beside the catalog's default, for example High — Default.
The default write scope is User, except when that model already has a Workspace key. Switch scopes with the picker button. Selecting any row saves its actual named level, including the default row. Workspace preferences override User preferences per model. Without a saved preference, the catalog's named default is sent. To resume inheritance, remove that model's key in settings.
"vertexAiChat.thinkingEffortByModel": {
"claude-opus-5-5": "max",
"claude-sonnet-5-5": "high"
}
Preferences apply to the next public language-model invocation. Each invocation captures its configuration before asynchronous work; retries keep that snapshot. Commit-message generation uses its configured model and the catalog default, independently of Chat preferences.
A catalog can declare effort: { "values": ["medium", "high", "max"], "default": "medium" }. The default must be one of the values. Custom catalogs may declare other nonempty strings: the adapter maps them to its API, and the API validates model support. Saved choices outside the current catalog are reported before inference.
Older catalog entries without effort metadata still support suffix aliases: Claude -low, -medium, -high, -xhigh, and -max; Gemini -high; and Grok 4.6 -low, -medium, and -high. For example, version: "claude-opus-5-5-max" routes to claude-opus-5-5 with Max effort. These entries keep a fixed effort and must be present in the active catalog. Explicit effort metadata takes precedence and keeps version literal.
Bundled defaults follow the documented model defaults: Medium for Claude Opus 5.5, Haiku 5.5, Gemini 4 Argon and Gemini 3.7/3.8 Flash; High for the other configured Claude models, Gemini 3 Flash preview and Grok 4.6. Sources: Claude effort, Gemini thinking, Argon guide, Grok reasoning. Grok's named default follows xAI documentation; Vertex omission behavior is not independently documented here.
Proxy catalogs remain authoritative for models and effort choices. Optional effort metadata is accepted directly after catalog validation, without a capability-negotiation header or acknowledgement. The extension never imports bundled choices into a server catalog. See the proxy contract, provider contracts, and verification.
In direct mode, models are discovered for your project and region. In proxy mode, only models in the server's approved catalog appear in the picker.
| Provider | Current catalog | Details |
|---|---|---|
| Gemini 4 Argon; Gemini 3 Flash Preview; Gemini 3.7 and 3.8 Flash; Gemini 3.1 Pro | Gemini model documentation | |
| Anthropic | Claude Fable 5.1 and 5; Opus 5.5, 5, and 4.8; Sonnet 5.5, 5, and 4.6; Haiku 5.5 | Claude on Google Cloud |
| Grok | Grok 4.6 | Grok 4.6 documentation |
Claude Fable 5 and 5.1 require Model Garden access and are subject to Google's Advanced AI Safety Addendum. Review the Fable 5.1 documentation before enabling it.
In direct mode, need a different model set or region order? Create a workspace .vscode/models.json with Google Agent Platform: Open Workspace models.json, or a private user catalog with Open User Models Catalog File. Both are seeded from the bundled catalog and receive JSON schema validation. A custom catalog fully replaces the bundled catalog, so include every model you want available. In proxy mode, configure the catalog on your server instead; local catalog files are ignored. See Model Discovery & Project Switching for precedence, multi-root behavior, and examples.
For a custom model, set version to the exact backend model name, and put configurable levels in effort.values with a named effort.default. For example, "effort": { "values": ["medium", "high", "max"], "default": "high" }. Model identity and effort are independent. The extension sends version literally, except for older suffix aliases without effort metadata, and leaves support validation to the backend API.
Custom files and proxy responses are checked against the catalog JSON schema when loaded. The parser also checks unique model IDs and that each effort default belongs to its choices. Malformed local definitions are reported and excluded; the remaining custom catalog stays authoritative, even when empty. Invalid JSON or an invalid catalog envelope falls back to the next local tier. A malformed proxy catalog fails discovery without a local fallback.
The local dashboard estimates spend; your Google Cloud Billing account remains the source of truth. Enable vertexAiChat.enableUserLabel and vertexAiChat.enableProjectLabel when you need cost attribution for Gemini and Claude PayGo requests.
Labels are not forwarded to Billing for Provisioned Throughput. Prefer explicit, stable, non-sensitive userLabelValue and projectLabelValue values: labels appear in billing exports and overly high-cardinality keys can be dropped. See label resolution order, the Cost Attribution Labels guide, Google's request-label documentation, and the BigQuery billing-export guide.
| Topic | Where to go |
|---|---|
| Enterprise proxy and centralized controls | Setup and implementation contract · Compatibility verification |
| Authentication and workspace settings | Setup & Configuration · Service Account Authentication |
| Usage dashboard and BigQuery reporting | Usage & Billing · Advanced Billing Reports |
| Custom model catalogs and discovery | Model Discovery & Project Switching |
| AI commit-message generation | AI Commit Message Generator |
| Diagnostics | Diagnostics & Troubleshooting |
| Architecture and provider behavior | Architecture · · |
Install dependencies with npm ci. Run npm run format to format the repository and npm run format:check to check formatting without changing files. Prettier uses four-space indentation and a 300-column wrapping target, with standard defaults explicitly recorded in .prettierrc.json. The multiline arrays plugin places each item on its own line in TypeScript, JavaScript, and JSON arrays with two or more items. Empty and single-item arrays are not forced to wrap; existing multiline arrays keep their layout. Generated output, the npm lockfile, the vendored chart library, and AGENTS.md (written for agents and kept unpadded) are excluded. .editorconfig shares indentation and whitespace settings across editors; .gitattributes keeps text files on LF line endings across operating systems.
VS Code recommends Prettier - Code formatter and formats supported files on save using the repository configuration. npm run lint checks TypeScript source using the recommended ESLint and TypeScript rules plus type-aware checks for unhandled and misused promises, including VS Code thenables. The lint command requires zero warnings. SDK payload types remain dynamic while those boundaries are migrated separately.
npm test compiles and runs the tests. The compiler enables strict checking, unused-local detection, checked array/object indexing, and exact optional-property types. Internal state that can be cleared declares undefined explicitly; optional object properties represent values that may be omitted.
The pre-commit hook stays fast: lint-staged checks formatting only for staged files, respecting the repository's formatting exclusions and ignoring unsupported file types. Partially staged files are checked with their unstaged changes temporarily hidden and then restored. Compilation, lint, and tests run at pre-push through npm run check, which runs npm run format:check && npm run lint && npm test for the whole repository. TypeScript compiles once as part of npm test. Hooks report failures without automatically formatting files and block the commit or push when a check fails. npm ci installs the Husky hooks through the prepare script. Version checks and CI workflows also check formatting and compile/lint.
| Current Google Cloud pricing | Agent Platform generative AI pricing |