modified
--- a/google-vertex-ai.md +++ b/google-vertex-ai.md @@ -123,7 +123,7 @@ Pin specific model versions when deploying to multiple users. Without pinning, model aliases such as `sonnet` and `opus` resolve to Claude Code’s built-in default for Google Cloud’s Agent Platform, which can lag the newest release and may not yet be enabled in your project. Claude Code falls back to an earlier or lower-tier model at startup when the default is unavailable, but pinning lets you control when your users move to a new model. -Set these environment variables to specific Google Cloud’s Agent Platform model IDs. Without `ANTHROPIC_DEFAULT_OPUS_MODEL`, the `opus` alias on Google Cloud’s Agent Platform resolves to Opus 5.5, and without `ANTHROPIC_DEFAULT_SONNET_MODEL`, the `sonnet` alias resolves to Sonnet 4.5. This example pins each alias to a specific version: +Set these environment variables to specific Google Cloud’s Agent Platform model IDs. Without `ANTHROPIC_DEFAULT_OPUS_MODEL`, the `opus` alias on Google Cloud’s Agent Platform resolves to Opus 5.5, and without `ANTHROPIC_DEFAULT_SONNET_MODEL`, the `sonnet` alias resolves to Sonnet 5.5. This example pins each alias to a specific version: export ANTHROPIC_DEFAULT_OPUS_MODEL='claude-opus-4-8' export ANTHROPIC_DEFAULT_SONNET_MODEL='claude-sonnet-5' @@ -134,14 +134,14 @@ Model type| Default value ---|--- Primary model| `claude-opus-5-5` -Small/fast model| `claude-sonnet-4-5@20250929` - -Before v2.1.280, the primary model on Google Cloud’s Agent Platform defaulted to Opus 5 and the `opus` alias resolved to Opus 5 from v2.1.219. Background tasks such as session title generation use the small/fast model, normally a Haiku-class model. On Google Cloud’s Agent Platform, Claude Code uses the default Sonnet model for background tasks because Haiku may not be enabled in every project or region. Two selections change which model carries them: +Small/fast model| `claude-sonnet-5-5` + +Before v2.1.280, the primary model on Google Cloud’s Agent Platform defaulted to Opus 5 and the `opus` alias resolved to Opus 5 from v2.1.219. Before v2.1.332, the `sonnet` alias and the small/fast model on Google Cloud’s Agent Platform were Sonnet 4.5. Background tasks such as session title generation use the small/fast model, normally a Haiku-class model. On Google Cloud’s Agent Platform, Claude Code uses the default Sonnet model for background tasks because Haiku may not be enabled in every project or region. Two selections change which model carries them: * When you select a primary model with `--model`, `ANTHROPIC_MODEL`, or the `model` setting, background tasks use that model. When Claude Code starts the session on the model you set with [`ANTHROPIC_DEFAULT_MODEL`](</docs/en/model-config#set-a-default-model-for-new-sessions>), background tasks use that model too. Setting `ANTHROPIC_DEFAULT_OPUS_MODEL` without `ANTHROPIC_DEFAULT_SONNET_MODEL` also counts as a selection, because the built-in Sonnet model may not be enabled in a project that steers its own Opus. * To use Haiku for background tasks, set `ANTHROPIC_DEFAULT_HAIKU_MODEL` to a model ID that is available in your project. -Opus models have a higher per-token price than Sonnet models, so if you don’t pin a primary model, you’re billed at the Opus rate. To use Sonnet 4.5 as the primary model, set `ANTHROPIC_MODEL` to its full model ID. A deployment that steers the default with `ANTHROPIC_DEFAULT_SONNET_MODEL` and doesn’t set `ANTHROPIC_DEFAULT_OPUS_MODEL` keeps its steered Sonnet model as the default. +Opus models have a higher per-token price than Sonnet models, so if you don’t pin a primary model, you’re billed at the Opus rate. To use Sonnet 5 as the primary model, set `ANTHROPIC_MODEL` to its full model ID. A deployment that steers the default with `ANTHROPIC_DEFAULT_SONNET_MODEL` and doesn’t set `ANTHROPIC_DEFAULT_OPUS_MODEL` keeps its steered Sonnet model as the default, unless [`enforceAvailableModels`](</docs/en/model-config#enforce-the-allowlist-for-the-default-model>) is on. To customize models further: @@ -171,10 +171,10 @@ ### When your organization enforces a model allowlist -If you set [`enforceAvailableModels`](</docs/en/model-config#enforce-the-allowlist-for-the-default-model>) in managed settings, the startup model checks use only models your `availableModels` list permits. This requires Claude Code v2.1.287 or later. A list without `enforceAvailableModels` doesn’t restrict these checks. The checks compare each entry with the model ID they would send to Agent Platform, so write the list in those IDs. This example permits Opus 4.8 and Sonnet 4.5: +To limit the startup model checks and their fallback to models your `availableModels` list permits, set [`enforceAvailableModels`](</docs/en/model-config#enforce-the-allowlist-for-the-default-model>) in managed settings. This requires Claude Code v2.1.287 or later. The checks compare each entry with the model ID they would send to Agent Platform, so write the list in those IDs. This example permits Opus 4.8 and Sonnet 4.6: { - "availableModels": ["claude-opus-4-8", "claude-sonnet-4-5@20250929"], + "availableModels": ["claude-opus-4-8", "claude-sonnet-4-6"], "enforceAvailableModels": true }
modified
--- a/google-vertex-ai.md +++ b/google-vertex-ai.md @@ -1,4 +1,11 @@ -This page covers one of the two ways to use Claude through your Google Cloud project: Google Cloud’s Agent Platform, formerly Vertex AI, which Google manages. If you use Claude Models on Google Cloud (Anthropic managed), follow [its Claude Code setup page](</docs/en/claude-models-on-google-cloud-anthropic-managed>) instead. To find out which one you use, see [Which offering are you using?](<https://platform.claude.com/docs/en/build-with-claude/claude-models-on-google-cloud/overview#which-offering-are-you-using>) +This page covers one of the two ways to use Claude through your Google Cloud project: Google Cloud’s Agent Platform, formerly Vertex AI, which Google manages. + +Use a different page in these cases: + + * **Claude Models on Google Cloud (Anthropic managed)** : follow [its Claude Code setup page](</docs/en/claude-models-on-google-cloud-anthropic-managed>) + * **Not sure which Google Cloud offering you use** : see [Which offering are you using?](<https://platform.claude.com/docs/en/build-with-claude/claude-models-on-google-cloud/overview#which-offering-are-you-using>) + * **Code tab, when your organization installed the Claude Desktop app** : ask your administrator to [configure the app for Agent Platform](<https://claude.com/docs/third-party/claude-desktop/vertex>) + * **Code tab, when you install the Claude Desktop app yourself** : follow the [single-machine setup steps](<https://claude.com/docs/third-party/claude-desktop/installation#single-machine-setup>) and enter the [connection and model values for Agent Platform](<https://claude.com/docs/third-party/claude-desktop/vertex#configure-the-app>) ## Prerequisites
modified
--- a/google-vertex-ai.md +++ b/google-vertex-ai.md @@ -97,8 +97,8 @@ # export ANTHROPIC_VERTEX_BASE_URL=https://aiplatform.googleapis.com # When CLOUD_ML_REGION=global, override region for models that don't support global endpoints - export VERTEX_REGION_CLAUDE_HAIKU_4_5=us-east5 - export VERTEX_REGION_CLAUDE_4_6_SONNET=europe-west1 + # export VERTEX_REGION_CLAUDE_HAIKU_4_5=us-east5 + # export VERTEX_REGION_CLAUDE_4_6_SONNET=europe-west1 Most model versions have a corresponding `VERTEX_REGION_CLAUDE_*` variable. See the [Environment variables reference](</docs/en/env-vars#variables>) for the full list. Check [Google Cloud’s Agent Platform Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) to determine which models support global endpoints versus regional only. If a region value isn’t shaped like a region or location name, Claude Code treats it as unset. For example, Claude Code treats a value containing a slash, dot, or space as unset. Claude Code falls back to a different source for each variable:
modified
--- a/google-vertex-ai.md +++ b/google-vertex-ai.md @@ -1,3 +1,5 @@ +This page covers one of the two ways to use Claude through your Google Cloud project: Google Cloud’s Agent Platform, formerly Vertex AI, which Google manages. If you use Claude Models on Google Cloud (Anthropic managed), follow [its Claude Code setup page](</docs/en/claude-models-on-google-cloud-anthropic-managed>) instead. To find out which one you use, see [Which offering are you using?](<https://platform.claude.com/docs/en/build-with-claude/claude-models-on-google-cloud/overview#which-offering-are-you-using>) + ## Prerequisites Before configuring Claude Code with Google Cloud’s Agent Platform, formerly Vertex AI, ensure you have:
modified
Show diff (239 lines)
--- a/google-vertex-ai.md +++ b/google-vertex-ai.md @@ -1,8 +1,4 @@ -## - -​ - -Prerequisites +## Prerequisites Before configuring Claude Code with Google Cloud’s Agent Platform, formerly Vertex AI, ensure you have: @@ -14,11 +10,7 @@ To sign in with your own Google Cloud’s Agent Platform credentials, follow Sign in with Google Cloud’s Agent Platform below. To deploy Claude Code across a team, use the manual setup steps and pin your model versions before rolling out. -## - -​ - -Sign in with Agent Platform +## Sign in with Agent Platform If you have Google Cloud credentials and want to start using Claude Code through Google Cloud’s Agent Platform, the login wizard walks you through it. You complete the GCP-side prerequisites once per project; the wizard handles the Claude Code side. @@ -42,29 +34,17 @@ After you’ve signed in, run `/setup-vertex` any time to reopen the wizard and change your credentials, project, region, or model pins. The model pin step starts from your currently pinned models. The wizard writes to `~/.claude/settings.json`, or to `$CLAUDE_CONFIG_DIR/settings.json` when [`CLAUDE_CONFIG_DIR`](</docs/en/env-vars#variables>) is set. -## - -​ - -Region configuration +## Region configuration Claude Code supports Google Cloud’s Agent Platform [global](<https://cloud.google.com/blog/products/ai-machine-learning/global-endpoint-for-claude-models-generally-available-on-vertex-ai>), multi-region, and regional endpoints. Set `CLOUD_ML_REGION` to `global`, a multi-region location such as `eu` or `us`, or a specific region such as `us-east5`. Claude Code selects the correct Google Cloud’s Agent Platform hostname for each form, including the `aiplatform.eu.rep.googleapis.com` and `aiplatform.us.rep.googleapis.com` hosts for multi-region locations. Google Cloud’s Agent Platform may not support the Claude Code default models on every endpoint type. Model availability varies across [specific regions](<https://cloud.google.com/vertex-ai/generative-ai/docs/learn/locations#genai-partner-models>), multi-region locations, and [global endpoints](<https://cloud.google.com/vertex-ai/generative-ai/docs/partner-models/use-partner-models#supported_models>). You may need to switch to a supported location or specify a supported model. -## - -​ - -Set up manually +## Set up manually To configure Google Cloud’s Agent Platform through environment variables instead of the wizard, for example in CI or a scripted enterprise rollout, follow the steps below. -### - -​ - -1\. Enable Agent Platform API +### 1\. Enable Agent Platform API Enable Google Cloud’s Agent Platform API in your GCP project. Replace `YOUR-PROJECT-ID` with your GCP project ID here and in the configuration step below: @@ -74,11 +54,7 @@ # Enable Agent Platform API gcloud services enable aiplatform.googleapis.com -### - -​ - -2\. Request model access +### 2\. Request model access Request access to Claude models in Google Cloud’s Agent Platform: @@ -87,21 +63,13 @@ 3. Request access to desired Claude models (for example, Claude Sonnet 4.6) 4. Wait for approval (may take 24-48 hours) -### - -​ - -3\. Configure GCP credentials +### 3\. Configure GCP credentials Claude Code uses standard Google Cloud authentication. For more information, see [Google Cloud authentication documentation](<https://cloud.google.com/docs/authentication>). Claude Code supports [X.509 certificate-based Workload Identity Federation](<https://cloud.google.com/iam/docs/workload-identity-federation-with-x509-certificates>) through the same Application Default Credentials chain. Set `GOOGLE_APPLICATION_CREDENTIALS` to the path of your credential configuration file. Claude Code addresses Google Cloud’s Agent Platform requests to the project in `ANTHROPIC_VERTEX_PROJECT_ID`, even when `GCLOUD_PROJECT`, `GOOGLE_CLOUD_PROJECT`, or the credential file referenced by `GOOGLE_APPLICATION_CREDENTIALS` carries a different project. -#### - -​ - -Advanced credential configuration +#### Advanced credential configuration Claude Code supports automatic credential refresh for GCP through the `gcpAuthRefresh` setting. Add it to your Claude Code [settings file](</docs/en/settings>), for example `~/.claude/settings.json`. When Claude Code detects that your GCP credentials are expired or cannot be loaded, it runs the configured command to obtain new credentials before retrying the request. @@ -114,11 +82,7 @@ Before running the command, Claude Code requests an access token with your current credentials to confirm they’re actually expired, and skips the command when they still work. If the check doesn’t finish within five seconds, Claude Code also skips the command and runs it only after a request fails with a credential error. Before v2.1.261, a check that timed out counted as an expired credential, so the command could open your browser at startup even though your credentials were still valid. Claude Code shows you the command’s output, but can’t send the command interactive input. This works well for browser-based authentication flows where the CLI shows a URL and you complete authentication in the browser. The refresh command times out after three minutes if authentication does not complete. If you set `gcpAuthRefresh` in project settings such as `.claude/settings.json`, Claude Code runs it under the same [workspace trust rule as hooks in settings files](</docs/en/permissions#what-runs-before-you-trust-a-folder>), which includes `-p` sessions in folders you’ve never trusted. -### - -​ - -4\. Configure Claude Code +### 4\. Configure Claude Code Set the following environment variables: @@ -146,11 +110,7 @@ Set `ENABLE_TOOL_SEARCH=false` to disable tool search on every model. -### - -​ - -5\. Pin model versions +### 5\. Pin model versions Pin specific model versions when deploying to multiple users. Without pinning, model aliases such as `sonnet` and `opus` resolve to Claude Code’s built-in default for Google Cloud’s Agent Platform, which can lag the newest release and may not yet be enabled in your project. Claude Code falls back to an earlier or lower-tier model at startup when the default is unavailable, but pinning lets you control when your users move to a new model. @@ -179,19 +139,11 @@ export ANTHROPIC_MODEL='claude-opus-4-8' export ANTHROPIC_DEFAULT_HAIKU_MODEL='claude-haiku-4-5@20251001' -### - -​ - -6\. Verify your configuration +### 6\. Verify your configuration Start Claude Code and run `/status` to confirm the setup. The `API provider` line shows `Google Vertex AI`, and the `GCP project`, `Default region`, and `Model` lines show your project ID, region, and resolved model. If the provider line is missing, the environment variables aren’t reaching the process. Confirm they are exported in the shell where you launched `claude`, or set them in the `env` block of your [settings file](</docs/en/settings>). -## - -​ - -Startup model checks +## Startup model checks When Claude Code starts with Google Cloud’s Agent Platform configured, it verifies that the models it intends to use are accessible in your project. You may have pinned a model version that is older than the current Claude Code default. If your project can invoke the newer version, Claude Code prompts you to update the pin: @@ -200,27 +152,15 @@ For a pin in the `env` block of [managed settings](</docs/en/managed-settings>), Claude Code runs no check and shows no prompt. If the update prompt still appears for this pin, update Claude Code to v2.1.314 or later. Before v2.1.314, the managed pin stayed in effect after you accepted, so the prompt came back at the next start. If you have not pinned a model and the current default is unavailable in your project, Claude Code falls back for the current session and shows a notice. It tries earlier versions of the default model first and, when the default is an Opus model and no Opus version is available, falls back to the default Sonnet model. The fallback is not persisted. Enable the newer model in [Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) or pin a version to make the choice permanent. -### - -​ - -Start a session on a specific model +### Start a session on a specific model When you start the session on a specific Sonnet or Opus version, for example with `--model`, `ANTHROPIC_MODEL`, or the [`model` setting](</docs/en/settings-reference#model>), that version acts as the session’s pinned default for the matching `sonnet` or `opus` alias. Claude Code skips the availability check for the built-in default your model replaces and starts on the model you configured, with no fallback notice. When you start a session on a model alias such as `opus` or on a model ID Claude Code doesn’t recognize, that value doesn’t act as a pin. -### - -​ - -Remembered model refusals +### Remembered model refusals When the startup model checks find a model your project can’t invoke, Claude Code can remember the refusal on this machine for up to a day. Once ten minutes have passed since the last check, Claude Code checks a remembered refusal of a current default model again at launch. A default your administrator re-enables then comes back. To turn the memory off, set [`CLAUDE_CODE_SKIP_MODEL_ACCESS_MEMORY=1`](</docs/en/env-vars>). -### - -​ - -When your organization enforces a model allowlist +### When your organization enforces a model allowlist If you set [`enforceAvailableModels`](</docs/en/model-config#enforce-the-allowlist-for-the-default-model>) in managed settings, the startup model checks use only models your `availableModels` list permits. This requires Claude Code v2.1.287 or later. A list without `enforceAvailableModels` doesn’t restrict these checks. The checks compare each entry with the model ID they would send to Agent Platform, so write the list in those IDs. This example permits Opus 4.8 and Sonnet 4.5: @@ -231,19 +171,16 @@ For aliases, version prefixes, and `modelOverrides` entries, see [Pin models for third-party deployments](</docs/en/model-config#pin-models-for-third-party-deployments>). -### - -​ - -When a model is disabled mid-session - -If your project loses access to the model your session is running on, for example because an administrator disables it in [Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>), Claude Code switches the session to another model instead of failing each request, and shows `Switched to <fallback> because <model> is not available`. It tries the same models as the startup fallback: earlier versions of the same tier first and, for an Opus session with no Opus version available, the default Sonnet model. The switch applies only to a tier you haven’t pinned, the same condition as the startup fallback. A session on a specific version you picked keeps its model and, without a fallback model chain, the request fails instead. In [auto mode](</docs/en/permission-modes#enable-auto-mode-on-bedrock-agent-platform-or-foundry>), Claude Code switches only to a model auto mode supports on Agent Platform. If none of those models is available either, the request fails. A [fallback model chain](</docs/en/model-config#fallback-model-chains>) you configure replaces the tier switch: on these refusals Claude Code switches to your configured fallback instead. To have refused requests fail rather than switch, set [`CLAUDE_CODE_DISABLE_MODEL_ACCESS_FALLBACK=1`](</docs/en/env-vars>). A fallback chain you configured still switches on these refusals; remove the chain as well if you want every refused request to fail. - -## - -​ - -IAM configuration +### When a model is disabled mid-session + +When Agent Platform rejects your session’s model as unavailable in your project or region, Claude Code switches your session to another model, and you can keep working. You see a message that starts with `Switched to <fallback> because <model> is not available`. This happens, for example, when an administrator disables the model in [Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) or it isn’t served in your region. If you configured a [fallback model chain](</docs/en/model-config#fallback-model-chains>), Claude Code switches to your configured fallback instead. Without a chain, the request fails in cases such as these: + + * Your session is on a pinned model or a specific version you picked + * None of the models Claude Code tries is available. In [auto mode](</docs/en/permission-modes#enable-auto-mode-on-bedrock-agent-platform-or-foundry>), Claude Code only switches to a model auto mode supports on Agent Platform. + +To keep working, run `/model` in the session and press `s` on a model available in your project and region, which leaves your default unchanged. To have rejected requests fail instead of switching, set [`CLAUDE_CODE_DISABLE_MODEL_ACCESS_FALLBACK=1`](</docs/en/env-vars>). If you configured a fallback model chain, remove it as well, because Claude Code still moves to that fallback. + +## IAM configuration Assign the `roles/aiplatform.user` role, which includes the required permissions: @@ -253,19 +190,11 @@ Create a dedicated GCP project for Claude Code to simplify cost tracking and access control. -## - -​ - -1M token context window +## 1M token context window Fable models, Sonnet 5 and later, and Opus 4.7 and later run with the [1M token context window](<https://platform.claude.com/docs/en/build-with-claude/context-windows#context-window-sizes-by-model>) by default on Google Cloud’s Agent Platform, with no `[1m]` suffix needed. To keep a 200K window instead, set [`CLAUDE_CODE_DISABLE_1M_CONTEXT=1`](</docs/en/model-config#turn-off-1m-context>). Opus 4.6 and Sonnet 4.6 reach the 1M window when you select their `[1m]` variant. The setup wizard offers a 1M context option when it pins models. To enable it for a manually pinned model instead, append `[1m]` to the model ID. See [Pin models for third-party deployments](</docs/en/model-config#pin-models-for-third-party-deployments>) for details, including how to use the 1M window without changing the pin. Before v2.1.287, the Fable models and Opus 4.7 and later ran with a 200K window by default on Google Cloud’s Agent Platform and reached the 1M window through a `[1m]` suffix. -## - -​ - -Troubleshooting +## Troubleshooting If you encounter “Could not load the default credentials” errors: @@ -290,11 +219,7 @@ * For regional endpoints, ensure the primary model and small/fast model are supported in your selected region * Consider switching to `CLOUD_ML_REGION=global` for better availability -## - -​ - -Additional resources +## Additional resources * [Google Cloud’s Agent Platform documentation](<https://cloud.google.com/vertex-ai/docs>) * [Google Cloud’s Agent Platform pricing](<https://cloud.google.com/vertex-ai/pricing>)
modified
--- a/google-vertex-ai.md +++ b/google-vertex-ai.md @@ -144,7 +144,7 @@ * **Claude Opus 4.5, Sonnet 4.5, Haiku 4.5, and later** : Claude Code enables tool search by default. * **Earlier models** : Claude Code loads MCP tool definitions upfront, because their Agent Platform serving stacks reject the required beta header. Setting `ENABLE_TOOL_SEARCH=true` doesn’t override this. -Set `ENABLE_TOOL_SEARCH=false` to disable tool search on every model. Before v2.1.221, Claude Code disabled tool search for all models on Google Cloud’s Agent Platform unless you set `ENABLE_TOOL_SEARCH=true`. +Set `ENABLE_TOOL_SEARCH=false` to disable tool search on every model. ###
modified
--- a/google-vertex-ai.md +++ b/google-vertex-ai.md @@ -193,7 +193,28 @@ Startup model checks -When Claude Code starts with Google Cloud’s Agent Platform configured, it verifies that the models it intends to use are accessible in your project. If you have pinned a model version that is older than the current Claude Code default, and your project can invoke the newer version, Claude Code prompts you to update the pin. Accepting writes the new model ID to your [user settings file](</docs/en/settings>) and restarts Claude Code. Declining is remembered until the next default version change. If you have not pinned a model and the current default is unavailable in your project, Claude Code falls back for the current session and shows a notice. It tries earlier versions of the default model first and, when the default is an Opus model and no Opus version is available, falls back to the default Sonnet model. The fallback is not persisted. Enable the newer model in [Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) or pin a version to make the choice permanent. When you start the session on a specific Sonnet or Opus version, for example with `--model`, `ANTHROPIC_MODEL`, or the [`model` setting](</docs/en/settings-reference#model>), that version acts as the session’s pinned default for the matching `sonnet` or `opus` alias. Claude Code skips the availability check for the built-in default your model replaces and starts on the model you configured, with no fallback notice. Model aliases such as `opus` don’t act as pins, and neither does a model ID Claude Code doesn’t recognize. When these checks find a model your project can’t invoke, Claude Code remembers the refusal on this machine for up to a day, and launches during that time skip the remembered model without asking Agent Platform again. Claude Code checks a remembered refusal of a current default model again at launch once ten minutes have passed since the last check, so a default your administrator re-enables comes back. To turn the memory off, set [`CLAUDE_CODE_SKIP_MODEL_ACCESS_MEMORY=1`](</docs/en/env-vars>). +When Claude Code starts with Google Cloud’s Agent Platform configured, it verifies that the models it intends to use are accessible in your project. You may have pinned a model version that is older than the current Claude Code default. If your project can invoke the newer version, Claude Code prompts you to update the pin: + + * **If you accept** : Claude Code writes the new model ID to your [user settings file](</docs/en/settings>) and restarts + * **If you decline** : Claude Code remembers your choice until the next default version change + +For a pin in the `env` block of [managed settings](</docs/en/managed-settings>), Claude Code runs no check and shows no prompt. If the update prompt still appears for this pin, update Claude Code to v2.1.314 or later. Before v2.1.314, the managed pin stayed in effect after you accepted, so the prompt came back at the next start. If you have not pinned a model and the current default is unavailable in your project, Claude Code falls back for the current session and shows a notice. It tries earlier versions of the default model first and, when the default is an Opus model and no Opus version is available, falls back to the default Sonnet model. The fallback is not persisted. Enable the newer model in [Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) or pin a version to make the choice permanent. + +### + +​ + +Start a session on a specific model + +When you start the session on a specific Sonnet or Opus version, for example with `--model`, `ANTHROPIC_MODEL`, or the [`model` setting](</docs/en/settings-reference#model>), that version acts as the session’s pinned default for the matching `sonnet` or `opus` alias. Claude Code skips the availability check for the built-in default your model replaces and starts on the model you configured, with no fallback notice. When you start a session on a model alias such as `opus` or on a model ID Claude Code doesn’t recognize, that value doesn’t act as a pin. + +### + +​ + +Remembered model refusals + +When the startup model checks find a model your project can’t invoke, Claude Code can remember the refusal on this machine for up to a day. Once ten minutes have passed since the last check, Claude Code checks a remembered refusal of a current default model again at launch. A default your administrator re-enables then comes back. To turn the memory off, set [`CLAUDE_CODE_SKIP_MODEL_ACCESS_MEMORY=1`](</docs/en/env-vars>). ###
modified
--- a/google-vertex-ai.md +++ b/google-vertex-ai.md @@ -167,14 +167,14 @@ Primary model| `claude-opus-5-5` Small/fast model| `claude-sonnet-4-5@20250929` -Background tasks such as session title generation use the small/fast model, normally a Haiku-class model. On Google Cloud’s Agent Platform, Claude Code uses the default Sonnet model for background tasks because Haiku may not be enabled in every project or region. Two selections change which model carries them: +Before v2.1.280, the primary model on Google Cloud’s Agent Platform defaulted to Opus 5 and the `opus` alias resolved to Opus 5 from v2.1.219. Background tasks such as session title generation use the small/fast model, normally a Haiku-class model. On Google Cloud’s Agent Platform, Claude Code uses the default Sonnet model for background tasks because Haiku may not be enabled in every project or region. Two selections change which model carries them: * When you select a primary model with `--model`, `ANTHROPIC_MODEL`, or the `model` setting, background tasks use that model. When Claude Code starts the session on the model you set with [`ANTHROPIC_DEFAULT_MODEL`](</docs/en/model-config#set-a-default-model-for-new-sessions>), background tasks use that model too. Setting `ANTHROPIC_DEFAULT_OPUS_MODEL` without `ANTHROPIC_DEFAULT_SONNET_MODEL` also counts as a selection, because the built-in Sonnet model may not be enabled in a project that steers its own Opus. * To use Haiku for background tasks, set `ANTHROPIC_DEFAULT_HAIKU_MODEL` to a model ID that is available in your project. Opus models have a higher per-token price than Sonnet models, so if you don’t pin a primary model, you’re billed at the Opus rate. To use Sonnet 4.5 as the primary model, set `ANTHROPIC_MODEL` to its full model ID. A deployment that steers the default with `ANTHROPIC_DEFAULT_SONNET_MODEL` and doesn’t set `ANTHROPIC_DEFAULT_OPUS_MODEL` keeps its steered Sonnet model as the default. -Before v2.1.280, the primary model on Google Cloud’s Agent Platform defaulted to Opus 5 and the `opus` alias resolved to Opus 5 from v2.1.219. On v2.1.207 through v2.1.218, the primary model on Google Cloud’s Agent Platform defaulted to Opus 4.8 and the `opus` alias resolved to Opus 4.8. To customize models further: +To customize models further: export ANTHROPIC_MODEL='claude-opus-4-8' export ANTHROPIC_DEFAULT_HAIKU_MODEL='claude-haiku-4-5@20251001'
modified
--- a/google-vertex-ai.md +++ b/google-vertex-ai.md @@ -172,9 +172,9 @@ * When you select a primary model with `--model`, `ANTHROPIC_MODEL`, or the `model` setting, background tasks use that model. When Claude Code starts the session on the model you set with [`ANTHROPIC_DEFAULT_MODEL`](</docs/en/model-config#set-a-default-model-for-new-sessions>), background tasks use that model too. Setting `ANTHROPIC_DEFAULT_OPUS_MODEL` without `ANTHROPIC_DEFAULT_SONNET_MODEL` also counts as a selection, because the built-in Sonnet model may not be enabled in a project that steers its own Opus. * To use Haiku for background tasks, set `ANTHROPIC_DEFAULT_HAIKU_MODEL` to a model ID that is available in your project. -Opus models have a higher per-token price than Sonnet models, so a deployment that doesn’t pin a primary model is billed at the Opus rate once it updates to v2.1.207 or later. To keep Sonnet 4.5 as the primary model, set `ANTHROPIC_MODEL` to its full model ID. A deployment that steers the default with `ANTHROPIC_DEFAULT_SONNET_MODEL` and doesn’t set `ANTHROPIC_DEFAULT_OPUS_MODEL` keeps its steered Sonnet model as the default. - -Before v2.1.280, the primary model on Google Cloud’s Agent Platform defaulted to Opus 5 and the `opus` alias resolved to Opus 5 from v2.1.219. On v2.1.207 through v2.1.218, the primary model on Google Cloud’s Agent Platform defaulted to Opus 4.8 and the `opus` alias resolved to Opus 4.8. Before v2.1.207, the primary model defaulted to Sonnet 4.5, the `opus` alias resolved to Opus 4.6, and background tasks always used the primary model. To customize models further: +Opus models have a higher per-token price than Sonnet models, so if you don’t pin a primary model, you’re billed at the Opus rate. To use Sonnet 4.5 as the primary model, set `ANTHROPIC_MODEL` to its full model ID. A deployment that steers the default with `ANTHROPIC_DEFAULT_SONNET_MODEL` and doesn’t set `ANTHROPIC_DEFAULT_OPUS_MODEL` keeps its steered Sonnet model as the default. + +Before v2.1.280, the primary model on Google Cloud’s Agent Platform defaulted to Opus 5 and the `opus` alias resolved to Opus 5 from v2.1.219. On v2.1.207 through v2.1.218, the primary model on Google Cloud’s Agent Platform defaulted to Opus 4.8 and the `opus` alias resolved to Opus 4.8. To customize models further: export ANTHROPIC_MODEL='claude-opus-4-8' export ANTHROPIC_DEFAULT_HAIKU_MODEL='claude-haiku-4-5@20251001'
modified
--- a/google-vertex-ai.md +++ b/google-vertex-ai.md @@ -142,7 +142,7 @@ [Prompt caching](</docs/en/prompt-caching>) is enabled automatically. To disable it, set `DISABLE_PROMPT_CACHING=1`. To request a 1-hour cache TTL instead of the 5-minute default, set `ENABLE_PROMPT_CACHING_1H=1`; cache writes with a 1-hour TTL are billed at a higher rate. To set different TTLs for your main conversation and for the requests Claude Code makes outside it, [choose the TTL yourself](</docs/en/prompt-caching#choose-the-ttl-yourself>). To raise your rate limits, contact Google Cloud support. When using Google Cloud’s Agent Platform, the `/logout` command is unavailable since authentication is handled through Google Cloud credentials. Claude Code decides between [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>) and upfront loading by model generation: * **Claude Opus 4.5, Sonnet 4.5, Haiku 4.5, and later** : Claude Code enables tool search by default. - * **Earlier models, including all Claude 3.x models** : Claude Code loads MCP tool definitions upfront, because their Agent Platform serving stacks reject the required beta header. Setting `ENABLE_TOOL_SEARCH=true` doesn’t override this. + * **Earlier models** : Claude Code loads MCP tool definitions upfront, because their Agent Platform serving stacks reject the required beta header. Setting `ENABLE_TOOL_SEARCH=true` doesn’t override this. Set `ENABLE_TOOL_SEARCH=false` to disable tool search on every model. Before v2.1.221, Claude Code disabled tool search for all models on Google Cloud’s Agent Platform unless you set `ENABLE_TOOL_SEARCH=true`.
modified
--- a/google-vertex-ai.md +++ b/google-vertex-ai.md @@ -238,7 +238,7 @@ 1M token context window -Claude Sonnet 5, Opus 4.6 and later, and Sonnet 4.6 support the [1M token context window](<https://platform.claude.com/docs/en/build-with-claude/context-windows#context-window-sizes-by-model>) on Google Cloud’s Agent Platform. Sonnet 5 always runs with the 1M window, with no `[1m]` variant to select. For the other models, Claude Code automatically enables the extended context window when you select a 1M model variant. The setup wizard offers a 1M context option when it pins models. To enable it for a manually pinned model instead, append `[1m]` to the model ID. See [Pin models for third-party deployments](</docs/en/model-config#pin-models-for-third-party-deployments>) for details, including how to use the 1M window without changing the pin. +Fable models, Sonnet 5 and later, and Opus 4.7 and later run with the [1M token context window](<https://platform.claude.com/docs/en/build-with-claude/context-windows#context-window-sizes-by-model>) by default on Google Cloud’s Agent Platform, with no `[1m]` suffix needed. To keep a 200K window instead, set [`CLAUDE_CODE_DISABLE_1M_CONTEXT=1`](</docs/en/model-config#turn-off-1m-context>). Opus 4.6 and Sonnet 4.6 reach the 1M window when you select their `[1m]` variant. The setup wizard offers a 1M context option when it pins models. To enable it for a manually pinned model instead, append `[1m]` to the model ID. See [Pin models for third-party deployments](</docs/en/model-config#pin-models-for-third-party-deployments>) for details, including how to use the 1M window without changing the pin. Before v2.1.287, the Fable models and Opus 4.7 and later ran with a 200K window by default on Google Cloud’s Agent Platform and reached the 1M window through a `[1m]` suffix. ##
modified
--- a/google-vertex-ai.md +++ b/google-vertex-ai.md @@ -134,7 +134,7 @@ export VERTEX_REGION_CLAUDE_HAIKU_4_5=us-east5 export VERTEX_REGION_CLAUDE_4_6_SONNET=europe-west1 -Most model versions have a corresponding `VERTEX_REGION_CLAUDE_*` variable. See the [Environment variables reference](</docs/en/env-vars>) for the full list. Check [Google Cloud’s Agent Platform Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) to determine which models support global endpoints versus regional only. If a region value isn’t shaped like a region or location name, Claude Code treats it as unset. For example, Claude Code treats a value containing a slash, dot, or space as unset. Claude Code falls back to a different source for each variable: +Most model versions have a corresponding `VERTEX_REGION_CLAUDE_*` variable. See the [Environment variables reference](</docs/en/env-vars#variables>) for the full list. Check [Google Cloud’s Agent Platform Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) to determine which models support global endpoints versus regional only. If a region value isn’t shaped like a region or location name, Claude Code treats it as unset. For example, Claude Code treats a value containing a slash, dot, or space as unset. Claude Code falls back to a different source for each variable: * `VERTEX_REGION_CLAUDE_*`: Claude Code falls back to `CLOUD_ML_REGION`. * `CLOUD_ML_REGION`: Claude Code falls back to `us-east5`. @@ -262,7 +262,7 @@ * Verify the model is available in the location you specified. Some models are offered only on `global` or multi-region locations such as `eu` and `us`, not in specific regions * If using `CLOUD_ML_REGION=global`, check that your models support global endpoints in [Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) under “Supported features”. For models that don’t support global endpoints, either: * Specify a supported model via `ANTHROPIC_MODEL` or `ANTHROPIC_DEFAULT_HAIKU_MODEL`, or - * Set a region or multi-region location using `VERTEX_REGION_<MODEL_NAME>` environment variables + * Set a region or multi-region location using the model’s `VERTEX_REGION_CLAUDE_*` variable, listed in the [environment variables reference](</docs/en/env-vars#variables>) If you encounter 429 errors:
modified
--- a/google-vertex-ai.md +++ b/google-vertex-ai.md @@ -199,6 +199,21 @@ ​ +When your organization enforces a model allowlist + +If you set [`enforceAvailableModels`](</docs/en/model-config#enforce-the-allowlist-for-the-default-model>) in managed settings, the startup model checks use only models your `availableModels` list permits. This requires Claude Code v2.1.287 or later. A list without `enforceAvailableModels` doesn’t restrict these checks. The checks compare each entry with the model ID they would send to Agent Platform, so write the list in those IDs. This example permits Opus 4.8 and Sonnet 4.5: + + { + "availableModels": ["claude-opus-4-8", "claude-sonnet-4-5@20250929"], + "enforceAvailableModels": true + } + +For aliases, version prefixes, and `modelOverrides` entries, see [Pin models for third-party deployments](</docs/en/model-config#pin-models-for-third-party-deployments>). + +### + +​ + When a model is disabled mid-session If your project loses access to the model your session is running on, for example because an administrator disables it in [Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>), Claude Code switches the session to another model instead of failing each request, and shows `Switched to <fallback> because <model> is not available`. It tries the same models as the startup fallback: earlier versions of the same tier first and, for an Opus session with no Opus version available, the default Sonnet model. The switch applies only to a tier you haven’t pinned, the same condition as the startup fallback. A session on a specific version you picked keeps its model and, without a fallback model chain, the request fails instead. In [auto mode](</docs/en/permission-modes#enable-auto-mode-on-bedrock-agent-platform-or-foundry>), Claude Code switches only to a model auto mode supports on Agent Platform. If none of those models is available either, the request fails. A [fallback model chain](</docs/en/model-config#fallback-model-chains>) you configure replaces the tier switch: on these refusals Claude Code switches to your configured fallback instead. To have refused requests fail rather than switch, set [`CLAUDE_CODE_DISABLE_MODEL_ACCESS_FALLBACK=1`](</docs/en/env-vars>). A fallback chain you configured still switches on these refusals; remove the chain as well if you want every refused request to fail.
modified
--- a/google-vertex-ai.md +++ b/google-vertex-ai.md @@ -193,7 +193,15 @@ Startup model checks -When Claude Code starts with Google Cloud’s Agent Platform configured, it verifies that the models it intends to use are accessible in your project. If you have pinned a model version that is older than the current Claude Code default, and your project can invoke the newer version, Claude Code prompts you to update the pin. Accepting writes the new model ID to your [user settings file](</docs/en/settings>) and restarts Claude Code. Declining is remembered until the next default version change. If you have not pinned a model and the current default is unavailable in your project, Claude Code falls back for the current session and shows a notice. It tries earlier versions of the default model first and, when the default is an Opus model and no Opus version is available, falls back to the default Sonnet model. The fallback is not persisted. Enable the newer model in [Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) or pin a version to make the choice permanent. When you start the session on a specific Sonnet or Opus version, for example with `--model`, `ANTHROPIC_MODEL`, or the [`model` setting](</docs/en/settings-reference#model>), that version acts as the session’s pinned default for the matching `sonnet` or `opus` alias. Claude Code skips the availability check for the built-in default your model replaces and starts on the model you configured, with no fallback notice. Model aliases such as `opus` don’t act as pins, and neither does a model ID Claude Code doesn’t recognize. +When Claude Code starts with Google Cloud’s Agent Platform configured, it verifies that the models it intends to use are accessible in your project. If you have pinned a model version that is older than the current Claude Code default, and your project can invoke the newer version, Claude Code prompts you to update the pin. Accepting writes the new model ID to your [user settings file](</docs/en/settings>) and restarts Claude Code. Declining is remembered until the next default version change. If you have not pinned a model and the current default is unavailable in your project, Claude Code falls back for the current session and shows a notice. It tries earlier versions of the default model first and, when the default is an Opus model and no Opus version is available, falls back to the default Sonnet model. The fallback is not persisted. Enable the newer model in [Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) or pin a version to make the choice permanent. When you start the session on a specific Sonnet or Opus version, for example with `--model`, `ANTHROPIC_MODEL`, or the [`model` setting](</docs/en/settings-reference#model>), that version acts as the session’s pinned default for the matching `sonnet` or `opus` alias. Claude Code skips the availability check for the built-in default your model replaces and starts on the model you configured, with no fallback notice. Model aliases such as `opus` don’t act as pins, and neither does a model ID Claude Code doesn’t recognize. When these checks find a model your project can’t invoke, Claude Code remembers the refusal on this machine for up to a day, and launches during that time skip the remembered model without asking Agent Platform again. Claude Code checks a remembered refusal of a current default model again at launch once ten minutes have passed since the last check, so a default your administrator re-enables comes back. To turn the memory off, set [`CLAUDE_CODE_SKIP_MODEL_ACCESS_MEMORY=1`](</docs/en/env-vars>). + +### + +​ + +When a model is disabled mid-session + +If your project loses access to the model your session is running on, for example because an administrator disables it in [Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>), Claude Code switches the session to another model instead of failing each request, and shows `Switched to <fallback> because <model> is not available`. It tries the same models as the startup fallback: earlier versions of the same tier first and, for an Opus session with no Opus version available, the default Sonnet model. The switch applies only to a tier you haven’t pinned, the same condition as the startup fallback. A session on a specific version you picked keeps its model and, without a fallback model chain, the request fails instead. In [auto mode](</docs/en/permission-modes#enable-auto-mode-on-bedrock-agent-platform-or-foundry>), Claude Code switches only to a model auto mode supports on Agent Platform. If none of those models is available either, the request fails. A [fallback model chain](</docs/en/model-config#fallback-model-chains>) you configure replaces the tier switch: on these refusals Claude Code switches to your configured fallback instead. To have refused requests fail rather than switch, set [`CLAUDE_CODE_DISABLE_MODEL_ACCESS_FALLBACK=1`](</docs/en/env-vars>). A fallback chain you configured still switches on these refusals; remove the chain as well if you want every refused request to fail. ##
modified
--- a/google-vertex-ai.md +++ b/google-vertex-ai.md @@ -215,7 +215,7 @@ 1M token context window -Claude Sonnet 5, Opus 4.6 and later, and Sonnet 4.6 support the [1M token context window](<https://platform.claude.com/docs/en/build-with-claude/context-windows#context-window-sizes-by-model>) on Google Cloud’s Agent Platform. Sonnet 5 always runs with the 1M window, with no `[1m]` variant to select. For the other models, Claude Code automatically enables the extended context window when you select a 1M model variant. The setup wizard offers a 1M context option when it pins models. To enable it for a manually pinned model instead, append `[1m]` to the model ID. See [Pin models for third-party deployments](</docs/en/model-config#pin-models-for-third-party-deployments>) for details. +Claude Sonnet 5, Opus 4.6 and later, and Sonnet 4.6 support the [1M token context window](<https://platform.claude.com/docs/en/build-with-claude/context-windows#context-window-sizes-by-model>) on Google Cloud’s Agent Platform. Sonnet 5 always runs with the 1M window, with no `[1m]` variant to select. For the other models, Claude Code automatically enables the extended context window when you select a 1M model variant. The setup wizard offers a 1M context option when it pins models. To enable it for a manually pinned model instead, append `[1m]` to the model ID. See [Pin models for third-party deployments](</docs/en/model-config#pin-models-for-third-party-deployments>) for details, including how to use the 1M window without changing the pin. ##
modified
--- a/google-vertex-ai.md +++ b/google-vertex-ai.md @@ -154,7 +154,7 @@ Pin specific model versions when deploying to multiple users. Without pinning, model aliases such as `sonnet` and `opus` resolve to Claude Code’s built-in default for Google Cloud’s Agent Platform, which can lag the newest release and may not yet be enabled in your project. Claude Code falls back to an earlier or lower-tier model at startup when the default is unavailable, but pinning lets you control when your users move to a new model. -Set these environment variables to specific Google Cloud’s Agent Platform model IDs. Without `ANTHROPIC_DEFAULT_OPUS_MODEL`, the `opus` alias on Google Cloud’s Agent Platform resolves to Opus 5, and without `ANTHROPIC_DEFAULT_SONNET_MODEL`, the `sonnet` alias resolves to Sonnet 4.5. This example pins each alias to a specific version: +Set these environment variables to specific Google Cloud’s Agent Platform model IDs. Without `ANTHROPIC_DEFAULT_OPUS_MODEL`, the `opus` alias on Google Cloud’s Agent Platform resolves to Opus 5.5, and without `ANTHROPIC_DEFAULT_SONNET_MODEL`, the `sonnet` alias resolves to Sonnet 4.5. This example pins each alias to a specific version: export ANTHROPIC_DEFAULT_OPUS_MODEL='claude-opus-4-8' export ANTHROPIC_DEFAULT_SONNET_MODEL='claude-sonnet-5' @@ -164,7 +164,7 @@ Model type| Default value ---|--- -Primary model| `claude-opus-5` +Primary model| `claude-opus-5-5` Small/fast model| `claude-sonnet-4-5@20250929` Background tasks such as session title generation use the small/fast model, normally a Haiku-class model. On Google Cloud’s Agent Platform, Claude Code uses the default Sonnet model for background tasks because Haiku may not be enabled in every project or region. Two selections change which model carries them: @@ -174,7 +174,7 @@ Opus models have a higher per-token price than Sonnet models, so a deployment that doesn’t pin a primary model is billed at the Opus rate once it updates to v2.1.207 or later. To keep Sonnet 4.5 as the primary model, set `ANTHROPIC_MODEL` to its full model ID. A deployment that steers the default with `ANTHROPIC_DEFAULT_SONNET_MODEL` and doesn’t set `ANTHROPIC_DEFAULT_OPUS_MODEL` keeps its steered Sonnet model as the default. -On v2.1.207 through v2.1.218, the primary model on Google Cloud’s Agent Platform defaulted to Opus 4.8 and the `opus` alias resolved to Opus 4.8. Before v2.1.207, the primary model defaulted to Sonnet 4.5, the `opus` alias resolved to Opus 4.6, and background tasks always used the primary model. To customize models further: +Before v2.1.280, the primary model on Google Cloud’s Agent Platform defaulted to Opus 5 and the `opus` alias resolved to Opus 5 from v2.1.219. On v2.1.207 through v2.1.218, the primary model on Google Cloud’s Agent Platform defaulted to Opus 4.8 and the `opus` alias resolved to Opus 4.8. Before v2.1.207, the primary model defaulted to Sonnet 4.5, the `opus` alias resolved to Opus 4.6, and background tasks always used the primary model. To customize models further: export ANTHROPIC_MODEL='claude-opus-4-8' export ANTHROPIC_DEFAULT_HAIKU_MODEL='claude-haiku-4-5@20251001'
modified
--- a/google-vertex-ai.md +++ b/google-vertex-ai.md @@ -82,7 +82,7 @@ Request access to Claude models in Google Cloud’s Agent Platform: - 1. Navigate to the [Google Cloud’s Agent Platform Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) + 1. Go to the [Google Cloud’s Agent Platform Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) 2. Search for “Claude” models 3. Request access to desired Claude models (for example, Claude Sonnet 4.6) 4. Wait for approval (may take 24-48 hours)
modified
--- a/google-vertex-ai.md +++ b/google-vertex-ai.md @@ -38,7 +38,7 @@ Follow the wizard prompts -Choose how you authenticate to Google Cloud: Application Default Credentials from `gcloud`, a service account key file, or credentials already in your environment. The wizard detects your project and region, verifies which Claude models your project can invoke, and lets you pin them. It saves the result to the `env` block of your [user settings file](</docs/en/settings>), so you don’t need to export environment variables yourself. +Choose how you authenticate to Google Cloud: Application Default Credentials from `gcloud`, a service account key file, or credentials already in your environment. The wizard asks for your project and region, verifies which Claude models your project can invoke, and lets you pin them. It saves the result to the `env` block of your [user settings file](</docs/en/settings>), so you don’t need to export environment variables yourself. After you’ve signed in, run `/setup-vertex` any time to reopen the wizard and change your credentials, project, region, or model pins. The model pin step starts from your currently pinned models. The wizard writes to `~/.claude/settings.json`, or to `$CLAUDE_CONFIG_DIR/settings.json` when [`CLAUDE_CONFIG_DIR`](</docs/en/env-vars#variables>) is set.
modified
--- a/google-vertex-ai.md +++ b/google-vertex-ai.md @@ -95,7 +95,7 @@ Claude Code uses standard Google Cloud authentication. For more information, see [Google Cloud authentication documentation](<https://cloud.google.com/docs/authentication>). Claude Code supports [X.509 certificate-based Workload Identity Federation](<https://cloud.google.com/iam/docs/workload-identity-federation-with-x509-certificates>) through the same Application Default Credentials chain. Set `GOOGLE_APPLICATION_CREDENTIALS` to the path of your credential configuration file. -Claude Code uses `ANTHROPIC_VERTEX_PROJECT_ID` as the project ID for Google Cloud’s Agent Platform requests. The `GCLOUD_PROJECT` and `GOOGLE_CLOUD_PROJECT` environment variables and the credential file referenced by `GOOGLE_APPLICATION_CREDENTIALS` take precedence over it. If none of these are set, the project ID is resolved from your `gcloud` configuration or the attached service account. +Claude Code addresses Google Cloud’s Agent Platform requests to the project in `ANTHROPIC_VERTEX_PROJECT_ID`, even when `GCLOUD_PROJECT`, `GOOGLE_CLOUD_PROJECT`, or the credential file referenced by `GOOGLE_APPLICATION_CREDENTIALS` carries a different project. #### @@ -112,7 +112,7 @@ } } -Claude Code shows you the command’s output, but can’t send the command interactive input. This works well for browser-based authentication flows where the CLI shows a URL and you complete authentication in the browser. The refresh command times out after three minutes if authentication does not complete. If you set `gcpAuthRefresh` in project settings such as `.claude/settings.json`, Claude Code runs it under the same [workspace trust rule as hooks in settings files](</docs/en/permissions#what-runs-before-you-trust-a-folder>), which includes `-p` sessions in folders you’ve never trusted. +Before running the command, Claude Code requests an access token with your current credentials to confirm they’re actually expired, and skips the command when they still work. If the check doesn’t finish within five seconds, Claude Code also skips the command and runs it only after a request fails with a credential error. Before v2.1.261, a check that timed out counted as an expired credential, so the command could open your browser at startup even though your credentials were still valid. Claude Code shows you the command’s output, but can’t send the command interactive input. This works well for browser-based authentication flows where the CLI shows a URL and you complete authentication in the browser. The refresh command times out after three minutes if authentication does not complete. If you set `gcpAuthRefresh` in project settings such as `.claude/settings.json`, Claude Code runs it under the same [workspace trust rule as hooks in settings files](</docs/en/permissions#what-runs-before-you-trust-a-folder>), which includes `-p` sessions in folders you’ve never trusted. ###
modified
--- a/google-vertex-ai.md +++ b/google-vertex-ai.md @@ -139,7 +139,7 @@ * `VERTEX_REGION_CLAUDE_*`: Claude Code falls back to `CLOUD_ML_REGION`. * `CLOUD_ML_REGION`: Claude Code falls back to `us-east5`. -[Prompt caching](</docs/en/prompt-caching>) is enabled automatically. To disable it, set `DISABLE_PROMPT_CACHING=1`. To request a 1-hour cache TTL instead of the 5-minute default, set `ENABLE_PROMPT_CACHING_1H=1`; cache writes with a 1-hour TTL are billed at a higher rate. For heightened rate limits, contact Google Cloud support. When using Google Cloud’s Agent Platform, the `/logout` command is unavailable since authentication is handled through Google Cloud credentials. Claude Code decides between [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>) and upfront loading by model generation: +[Prompt caching](</docs/en/prompt-caching>) is enabled automatically. To disable it, set `DISABLE_PROMPT_CACHING=1`. To request a 1-hour cache TTL instead of the 5-minute default, set `ENABLE_PROMPT_CACHING_1H=1`; cache writes with a 1-hour TTL are billed at a higher rate. To set different TTLs for your main conversation and for the requests Claude Code makes outside it, [choose the TTL yourself](</docs/en/prompt-caching#choose-the-ttl-yourself>). To raise your rate limits, contact Google Cloud support. When using Google Cloud’s Agent Platform, the `/logout` command is unavailable since authentication is handled through Google Cloud credentials. Claude Code decides between [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>) and upfront loading by model generation: * **Claude Opus 4.5, Sonnet 4.5, Haiku 4.5, and later** : Claude Code enables tool search by default. * **Earlier models, including all Claude 3.x models** : Claude Code loads MCP tool definitions upfront, because their Agent Platform serving stacks reject the required beta header. Setting `ENABLE_TOOL_SEARCH=true` doesn’t override this.
modified
--- a/google-vertex-ai.md +++ b/google-vertex-ai.md @@ -193,7 +193,7 @@ Startup model checks -When Claude Code starts with Google Cloud’s Agent Platform configured, it verifies that the models it intends to use are accessible in your project. If you have pinned a model version that is older than the current Claude Code default, and your project can invoke the newer version, Claude Code prompts you to update the pin. Accepting writes the new model ID to your [user settings file](</docs/en/settings>) and restarts Claude Code. Declining is remembered until the next default version change. If you have not pinned a model and the current default is unavailable in your project, Claude Code falls back for the current session and shows a notice. It tries earlier versions of the default model first and, when the default is an Opus model and no Opus version is available, falls back to the default Sonnet model. The fallback is not persisted. Enable the newer model in [Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) or pin a version to make the choice permanent. When you start the session on a specific Sonnet or Opus version, for example with `--model`, `ANTHROPIC_MODEL`, or the [`model` setting](</docs/en/settings>), that version acts as the session’s pinned default for the matching `sonnet` or `opus` alias. Claude Code skips the availability check for the built-in default your model replaces and starts on the model you configured, with no fallback notice. Model aliases such as `opus` don’t act as pins, and neither does a model ID Claude Code doesn’t recognize. +When Claude Code starts with Google Cloud’s Agent Platform configured, it verifies that the models it intends to use are accessible in your project. If you have pinned a model version that is older than the current Claude Code default, and your project can invoke the newer version, Claude Code prompts you to update the pin. Accepting writes the new model ID to your [user settings file](</docs/en/settings>) and restarts Claude Code. Declining is remembered until the next default version change. If you have not pinned a model and the current default is unavailable in your project, Claude Code falls back for the current session and shows a notice. It tries earlier versions of the default model first and, when the default is an Opus model and no Opus version is available, falls back to the default Sonnet model. The fallback is not persisted. Enable the newer model in [Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) or pin a version to make the choice permanent. When you start the session on a specific Sonnet or Opus version, for example with `--model`, `ANTHROPIC_MODEL`, or the [`model` setting](</docs/en/settings-reference#model>), that version acts as the session’s pinned default for the matching `sonnet` or `opus` alias. Claude Code skips the availability check for the built-in default your model replaces and starts on the model you configured, with no fallback notice. Model aliases such as `opus` don’t act as pins, and neither does a model ID Claude Code doesn’t recognize. ##
modified
--- a/google-vertex-ai.md +++ b/google-vertex-ai.md @@ -169,7 +169,7 @@ Background tasks such as session title generation use the small/fast model, normally a Haiku-class model. On Google Cloud’s Agent Platform, Claude Code uses the default Sonnet model for background tasks because Haiku may not be enabled in every project or region. Two selections change which model carries them: - * When you select a primary model with `--model`, `ANTHROPIC_MODEL`, or the `model` setting, background tasks use that model. Setting `ANTHROPIC_DEFAULT_OPUS_MODEL` without `ANTHROPIC_DEFAULT_SONNET_MODEL` counts as a selection too, because the built-in Sonnet model may not be enabled in a project that steers its own Opus. + * When you select a primary model with `--model`, `ANTHROPIC_MODEL`, or the `model` setting, background tasks use that model. When Claude Code starts the session on the model you set with [`ANTHROPIC_DEFAULT_MODEL`](</docs/en/model-config#set-a-default-model-for-new-sessions>), background tasks use that model too. Setting `ANTHROPIC_DEFAULT_OPUS_MODEL` without `ANTHROPIC_DEFAULT_SONNET_MODEL` also counts as a selection, because the built-in Sonnet model may not be enabled in a project that steers its own Opus. * To use Haiku for background tasks, set `ANTHROPIC_DEFAULT_HAIKU_MODEL` to a model ID that is available in your project. Opus models have a higher per-token price than Sonnet models, so a deployment that doesn’t pin a primary model is billed at the Opus rate once it updates to v2.1.207 or later. To keep Sonnet 4.5 as the primary model, set `ANTHROPIC_MODEL` to its full model ID. A deployment that steers the default with `ANTHROPIC_DEFAULT_SONNET_MODEL` and doesn’t set `ANTHROPIC_DEFAULT_OPUS_MODEL` keeps its steered Sonnet model as the default. @@ -193,7 +193,7 @@ Startup model checks -When Claude Code starts with Google Cloud’s Agent Platform configured, it verifies that the models it intends to use are accessible in your project. If you have pinned a model version that is older than the current Claude Code default, and your project can invoke the newer version, Claude Code prompts you to update the pin. Accepting writes the new model ID to your [user settings file](</docs/en/settings>) and restarts Claude Code. Declining is remembered until the next default version change. If you have not pinned a model and the current default is unavailable in your project, Claude Code falls back for the current session and shows a notice. It tries earlier versions of the default model first and, when the default is an Opus model and no Opus version is available, falls back to the default Sonnet model. The fallback is not persisted. Enable the newer model in [Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) or pin a version to make the choice permanent. When you start the session on a specific Sonnet or Opus version, with `--model`, `ANTHROPIC_MODEL`, or the [`model` setting](</docs/en/settings>), that version acts as the session’s pinned default for the matching `sonnet` or `opus` alias. Claude Code skips the availability check for the built-in default your model replaces and starts on the model you configured, with no fallback notice. Model aliases such as `opus` don’t act as pins, and neither does a model ID Claude Code doesn’t recognize. +When Claude Code starts with Google Cloud’s Agent Platform configured, it verifies that the models it intends to use are accessible in your project. If you have pinned a model version that is older than the current Claude Code default, and your project can invoke the newer version, Claude Code prompts you to update the pin. Accepting writes the new model ID to your [user settings file](</docs/en/settings>) and restarts Claude Code. Declining is remembered until the next default version change. If you have not pinned a model and the current default is unavailable in your project, Claude Code falls back for the current session and shows a notice. It tries earlier versions of the default model first and, when the default is an Opus model and no Opus version is available, falls back to the default Sonnet model. The fallback is not persisted. Enable the newer model in [Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) or pin a version to make the choice permanent. When you start the session on a specific Sonnet or Opus version, for example with `--model`, `ANTHROPIC_MODEL`, or the [`model` setting](</docs/en/settings>), that version acts as the session’s pinned default for the matching `sonnet` or `opus` alias. Claude Code skips the availability check for the built-in default your model replaces and starts on the model you configured, with no fallback notice. Model aliases such as `opus` don’t act as pins, and neither does a model ID Claude Code doesn’t recognize. ##
modified
--- a/google-vertex-ai.md +++ b/google-vertex-ai.md @@ -134,7 +134,12 @@ export VERTEX_REGION_CLAUDE_HAIKU_4_5=us-east5 export VERTEX_REGION_CLAUDE_4_6_SONNET=europe-west1 -Most model versions have a corresponding `VERTEX_REGION_CLAUDE_*` variable. See the [Environment variables reference](</docs/en/env-vars>) for the full list. Check [Google Cloud’s Agent Platform Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) to determine which models support global endpoints versus regional only. [Prompt caching](</docs/en/prompt-caching>) is enabled automatically. To disable it, set `DISABLE_PROMPT_CACHING=1`. To request a 1-hour cache TTL instead of the 5-minute default, set `ENABLE_PROMPT_CACHING_1H=1`; cache writes with a 1-hour TTL are billed at a higher rate. For heightened rate limits, contact Google Cloud support. When using Google Cloud’s Agent Platform, the `/logout` command is unavailable since authentication is handled through Google Cloud credentials. Claude Code decides between [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>) and upfront loading by model generation: +Most model versions have a corresponding `VERTEX_REGION_CLAUDE_*` variable. See the [Environment variables reference](</docs/en/env-vars>) for the full list. Check [Google Cloud’s Agent Platform Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) to determine which models support global endpoints versus regional only. If a region value isn’t shaped like a region or location name, Claude Code treats it as unset. For example, Claude Code treats a value containing a slash, dot, or space as unset. Claude Code falls back to a different source for each variable: + + * `VERTEX_REGION_CLAUDE_*`: Claude Code falls back to `CLOUD_ML_REGION`. + * `CLOUD_ML_REGION`: Claude Code falls back to `us-east5`. + +[Prompt caching](</docs/en/prompt-caching>) is enabled automatically. To disable it, set `DISABLE_PROMPT_CACHING=1`. To request a 1-hour cache TTL instead of the 5-minute default, set `ENABLE_PROMPT_CACHING_1H=1`; cache writes with a 1-hour TTL are billed at a higher rate. For heightened rate limits, contact Google Cloud support. When using Google Cloud’s Agent Platform, the `/logout` command is unavailable since authentication is handled through Google Cloud credentials. Claude Code decides between [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>) and upfront loading by model generation: * **Claude Opus 4.5, Sonnet 4.5, Haiku 4.5, and later** : Claude Code enables tool search by default. * **Earlier models, including all Claude 3.x models** : Claude Code loads MCP tool definitions upfront, because their Agent Platform serving stacks reject the required beta header. Setting `ENABLE_TOOL_SEARCH=true` doesn’t override this.
modified
--- a/google-vertex-ai.md +++ b/google-vertex-ai.md @@ -112,7 +112,7 @@ } } -Claude Code shows you the command’s output, but can’t send the command interactive input. This works well for browser-based authentication flows where the CLI shows a URL and you complete authentication in the browser. The refresh command times out after three minutes if authentication does not complete. If you set `gcpAuthRefresh` in project settings such as `.claude/settings.json`, the command runs only after you accept the workspace trust prompt. +Claude Code shows you the command’s output, but can’t send the command interactive input. This works well for browser-based authentication flows where the CLI shows a URL and you complete authentication in the browser. The refresh command times out after three minutes if authentication does not complete. If you set `gcpAuthRefresh` in project settings such as `.claude/settings.json`, Claude Code runs it under the same [workspace trust rule as hooks in settings files](</docs/en/permissions#what-runs-before-you-trust-a-folder>), which includes `-p` sessions in folders you’ve never trusted. ###
modified
--- a/google-vertex-ai.md +++ b/google-vertex-ai.md @@ -130,12 +130,6 @@ # Optional: Override the Agent Platform endpoint URL for custom endpoints or gateways # export ANTHROPIC_VERTEX_BASE_URL=https://aiplatform.googleapis.com - # Optional: Disable prompt caching if needed - # export DISABLE_PROMPT_CACHING=1 - - # Optional: Request 1-hour prompt cache TTL instead of the 5-minute default - # export ENABLE_PROMPT_CACHING_1H=1 - # When CLOUD_ML_REGION=global, override region for models that don't support global endpoints export VERTEX_REGION_CLAUDE_HAIKU_4_5=us-east5 export VERTEX_REGION_CLAUDE_4_6_SONNET=europe-west1 @@ -196,15 +190,13 @@ When Claude Code starts with Google Cloud’s Agent Platform configured, it verifies that the models it intends to use are accessible in your project. If you have pinned a model version that is older than the current Claude Code default, and your project can invoke the newer version, Claude Code prompts you to update the pin. Accepting writes the new model ID to your [user settings file](</docs/en/settings>) and restarts Claude Code. Declining is remembered until the next default version change. If you have not pinned a model and the current default is unavailable in your project, Claude Code falls back for the current session and shows a notice. It tries earlier versions of the default model first and, when the default is an Opus model and no Opus version is available, falls back to the default Sonnet model. The fallback is not persisted. Enable the newer model in [Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) or pin a version to make the choice permanent. When you start the session on a specific Sonnet or Opus version, with `--model`, `ANTHROPIC_MODEL`, or the [`model` setting](</docs/en/settings>), that version acts as the session’s pinned default for the matching `sonnet` or `opus` alias. Claude Code skips the availability check for the built-in default your model replaces and starts on the model you configured, with no fallback notice. Model aliases such as `opus` don’t act as pins, and neither does a model ID Claude Code doesn’t recognize. -Before v2.1.211, Claude Code checked the default model’s availability even when a session model was explicitly configured, and could show a fallback notice for a default the session didn’t use. - ## ​ IAM configuration -Assign the required IAM permissions: The `roles/aiplatform.user` role includes the required permissions: +Assign the `roles/aiplatform.user` role, which includes the required permissions: * `aiplatform.endpoints.predict` \- Required for model invocation and token counting
modified
--- a/google-vertex-ai.md +++ b/google-vertex-ai.md @@ -93,7 +93,7 @@ 3\. Configure GCP credentials -Claude Code uses standard Google Cloud authentication. For more information, see [Google Cloud authentication documentation](<https://cloud.google.com/docs/authentication>). Claude Code v2.1.121 or later supports [X.509 certificate-based Workload Identity Federation](<https://cloud.google.com/iam/docs/workload-identity-federation-with-x509-certificates>) through the same Application Default Credentials chain. Set `GOOGLE_APPLICATION_CREDENTIALS` to the path of your credential configuration file. +Claude Code uses standard Google Cloud authentication. For more information, see [Google Cloud authentication documentation](<https://cloud.google.com/docs/authentication>). Claude Code supports [X.509 certificate-based Workload Identity Federation](<https://cloud.google.com/iam/docs/workload-identity-federation-with-x509-certificates>) through the same Application Default Credentials chain. Set `GOOGLE_APPLICATION_CREDENTIALS` to the path of your credential configuration file. Claude Code uses `ANTHROPIC_VERTEX_PROJECT_ID` as the project ID for Google Cloud’s Agent Platform requests. The `GCLOUD_PROJECT` and `GOOGLE_CLOUD_PROJECT` environment variables and the credential file referenced by `GOOGLE_APPLICATION_CREDENTIALS` take precedence over it. If none of these are set, the project ID is resolved from your `gcloud` configuration or the attached service account.
modified
--- a/google-vertex-ai.md +++ b/google-vertex-ai.md @@ -140,7 +140,12 @@ export VERTEX_REGION_CLAUDE_HAIKU_4_5=us-east5 export VERTEX_REGION_CLAUDE_4_6_SONNET=europe-west1 -Most model versions have a corresponding `VERTEX_REGION_CLAUDE_*` variable. See the [Environment variables reference](</docs/en/env-vars>) for the full list. Check [Google Cloud’s Agent Platform Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) to determine which models support global endpoints versus regional only. [Prompt caching](</docs/en/prompt-caching>) is enabled automatically. To disable it, set `DISABLE_PROMPT_CACHING=1`. To request a 1-hour cache TTL instead of the 5-minute default, set `ENABLE_PROMPT_CACHING_1H=1`; cache writes with a 1-hour TTL are billed at a higher rate. For heightened rate limits, contact Google Cloud support. When using Google Cloud’s Agent Platform, the `/logout` command is unavailable since authentication is handled through Google Cloud credentials. Claude Code disables [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>) by default on Google Cloud’s Agent Platform, so MCP tool definitions load upfront. Google Cloud’s Agent Platform supports tool search for Claude Sonnet 4.5 and later and Claude Opus 4.5 and later. Set `ENABLE_TOOL_SEARCH=true` to enable it on those models. Earlier models on Google Cloud’s Agent Platform do not accept the required beta header, and requests fail if you enable tool search with them. +Most model versions have a corresponding `VERTEX_REGION_CLAUDE_*` variable. See the [Environment variables reference](</docs/en/env-vars>) for the full list. Check [Google Cloud’s Agent Platform Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) to determine which models support global endpoints versus regional only. [Prompt caching](</docs/en/prompt-caching>) is enabled automatically. To disable it, set `DISABLE_PROMPT_CACHING=1`. To request a 1-hour cache TTL instead of the 5-minute default, set `ENABLE_PROMPT_CACHING_1H=1`; cache writes with a 1-hour TTL are billed at a higher rate. For heightened rate limits, contact Google Cloud support. When using Google Cloud’s Agent Platform, the `/logout` command is unavailable since authentication is handled through Google Cloud credentials. Claude Code decides between [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>) and upfront loading by model generation: + + * **Claude Opus 4.5, Sonnet 4.5, Haiku 4.5, and later** : Claude Code enables tool search by default. + * **Earlier models, including all Claude 3.x models** : Claude Code loads MCP tool definitions upfront, because their Agent Platform serving stacks reject the required beta header. Setting `ENABLE_TOOL_SEARCH=true` doesn’t override this. + +Set `ENABLE_TOOL_SEARCH=false` to disable tool search on every model. Before v2.1.221, Claude Code disabled tool search for all models on Google Cloud’s Agent Platform unless you set `ENABLE_TOOL_SEARCH=true`. ###
modified
--- a/google-vertex-ai.md +++ b/google-vertex-ai.md @@ -112,7 +112,7 @@ } } -The command’s output is displayed to the user, but interactive input isn’t supported. This works well for browser-based authentication flows where the CLI shows a URL and you complete authentication in the browser. The refresh command times out after three minutes if authentication does not complete. If you set `gcpAuthRefresh` in project settings such as `.claude/settings.json`, the command runs only after you accept the workspace trust prompt. +Claude Code shows you the command’s output, but can’t send the command interactive input. This works well for browser-based authentication flows where the CLI shows a URL and you complete authentication in the browser. The refresh command times out after three minutes if authentication does not complete. If you set `gcpAuthRefresh` in project settings such as `.claude/settings.json`, the command runs only after you accept the workspace trust prompt. ###
modified
--- a/google-vertex-ai.md +++ b/google-vertex-ai.md @@ -150,7 +150,7 @@ Pin specific model versions when deploying to multiple users. Without pinning, model aliases such as `sonnet` and `opus` resolve to Claude Code’s built-in default for Google Cloud’s Agent Platform, which can lag the newest release and may not yet be enabled in your project. Claude Code falls back to an earlier or lower-tier model at startup when the default is unavailable, but pinning lets you control when your users move to a new model. -Set these environment variables to specific Google Cloud’s Agent Platform model IDs. Without `ANTHROPIC_DEFAULT_OPUS_MODEL`, the `opus` alias on Google Cloud’s Agent Platform resolves to Opus 4.8, and without `ANTHROPIC_DEFAULT_SONNET_MODEL`, the `sonnet` alias resolves to Sonnet 4.5. This example pins each alias to a specific version: +Set these environment variables to specific Google Cloud’s Agent Platform model IDs. Without `ANTHROPIC_DEFAULT_OPUS_MODEL`, the `opus` alias on Google Cloud’s Agent Platform resolves to Opus 5, and without `ANTHROPIC_DEFAULT_SONNET_MODEL`, the `sonnet` alias resolves to Sonnet 4.5. This example pins each alias to a specific version: export ANTHROPIC_DEFAULT_OPUS_MODEL='claude-opus-4-8' export ANTHROPIC_DEFAULT_SONNET_MODEL='claude-sonnet-5' @@ -160,7 +160,7 @@ Model type| Default value ---|--- -Primary model| `claude-opus-4-8` +Primary model| `claude-opus-5` Small/fast model| `claude-sonnet-4-5@20250929` Background tasks such as session title generation use the small/fast model, normally a Haiku-class model. On Google Cloud’s Agent Platform, Claude Code uses the default Sonnet model for background tasks because Haiku may not be enabled in every project or region. Two selections change which model carries them: @@ -170,7 +170,7 @@ Opus models have a higher per-token price than Sonnet models, so a deployment that doesn’t pin a primary model is billed at the Opus rate once it updates to v2.1.207 or later. To keep Sonnet 4.5 as the primary model, set `ANTHROPIC_MODEL` to its full model ID. A deployment that steers the default with `ANTHROPIC_DEFAULT_SONNET_MODEL` and doesn’t set `ANTHROPIC_DEFAULT_OPUS_MODEL` keeps its steered Sonnet model as the default. -Before v2.1.207, the primary model on Google Cloud’s Agent Platform defaulted to Sonnet 4.5, the `opus` alias resolved to Opus 4.6, and background tasks always used the primary model. To customize models further: +On v2.1.207 through v2.1.218, the primary model on Google Cloud’s Agent Platform defaulted to Opus 4.8 and the `opus` alias resolved to Opus 4.8. Before v2.1.207, the primary model defaulted to Sonnet 4.5, the `opus` alias resolved to Opus 4.6, and background tasks always used the primary model. To customize models further: export ANTHROPIC_MODEL='claude-opus-4-8' export ANTHROPIC_DEFAULT_HAIKU_MODEL='claude-haiku-4-5@20251001'
modified
--- a/google-vertex-ai.md +++ b/google-vertex-ai.md @@ -32,7 +32,7 @@ Start Claude Code and choose Google Cloud's Agent Platform -Run `claude`. At the login prompt, select **3rd-party platform** , then **Google Vertex AI** , the label the login prompt still uses for Google Cloud’s Agent Platform. +Run `claude`. At the login prompt, select **3rd-party platform** , then **Google Vertex AI** , the label the login prompt still uses for Google Cloud’s Agent Platform. If you’re already signed in, run `/login` to open the same menu. 3 @@ -66,7 +66,7 @@ 1\. Enable Agent Platform API -Enable Google Cloud’s Agent Platform API in your GCP project: +Enable Google Cloud’s Agent Platform API in your GCP project. Replace `YOUR-PROJECT-ID` with your GCP project ID here and in the configuration step below: # Set your project ID gcloud config set project YOUR-PROJECT-ID @@ -103,7 +103,7 @@ Advanced credential configuration -Claude Code supports automatic credential refresh for GCP through the `gcpAuthRefresh` setting. When Claude Code detects that your GCP credentials are expired or cannot be loaded, it runs the configured command to obtain new credentials before retrying the request. +Claude Code supports automatic credential refresh for GCP through the `gcpAuthRefresh` setting. Add it to your Claude Code [settings file](</docs/en/settings>), for example `~/.claude/settings.json`. When Claude Code detects that your GCP credentials are expired or cannot be loaded, it runs the configured command to obtain new credentials before retrying the request. { "gcpAuthRefresh": "gcloud auth application-default login", @@ -131,10 +131,10 @@ # export ANTHROPIC_VERTEX_BASE_URL=https://aiplatform.googleapis.com # Optional: Disable prompt caching if needed - export DISABLE_PROMPT_CACHING=1 + # export DISABLE_PROMPT_CACHING=1 # Optional: Request 1-hour prompt cache TTL instead of the 5-minute default - export ENABLE_PROMPT_CACHING_1H=1 + # export ENABLE_PROMPT_CACHING_1H=1 # When CLOUD_ML_REGION=global, override region for models that don't support global endpoints export VERTEX_REGION_CLAUDE_HAIKU_4_5=us-east5 @@ -175,13 +175,23 @@ export ANTHROPIC_MODEL='claude-opus-4-8' export ANTHROPIC_DEFAULT_HAIKU_MODEL='claude-haiku-4-5@20251001' +### + +​ + +6\. Verify your configuration + +Start Claude Code and run `/status` to confirm the setup. The `API provider` line shows `Google Vertex AI`, and the `GCP project`, `Default region`, and `Model` lines show your project ID, region, and resolved model. If the provider line is missing, the environment variables aren’t reaching the process. Confirm they are exported in the shell where you launched `claude`, or set them in the `env` block of your [settings file](</docs/en/settings>). + ## ​ Startup model checks -When Claude Code starts with Google Cloud’s Agent Platform configured, it verifies that the models it intends to use are accessible in your project. If you have pinned a model version that is older than the current Claude Code default, and your project can invoke the newer version, Claude Code prompts you to update the pin. Accepting writes the new model ID to your [user settings file](</docs/en/settings>) and restarts Claude Code. Declining is remembered until the next default version change. If you have not pinned a model and the current default is unavailable in your project, Claude Code falls back for the current session and shows a notice. It tries earlier versions of the default model first and, when the default is an Opus model and no Opus version is available, falls back to the default Sonnet model. The fallback is not persisted. Enable the newer model in [Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) or pin a version to make the choice permanent. +When Claude Code starts with Google Cloud’s Agent Platform configured, it verifies that the models it intends to use are accessible in your project. If you have pinned a model version that is older than the current Claude Code default, and your project can invoke the newer version, Claude Code prompts you to update the pin. Accepting writes the new model ID to your [user settings file](</docs/en/settings>) and restarts Claude Code. Declining is remembered until the next default version change. If you have not pinned a model and the current default is unavailable in your project, Claude Code falls back for the current session and shows a notice. It tries earlier versions of the default model first and, when the default is an Opus model and no Opus version is available, falls back to the default Sonnet model. The fallback is not persisted. Enable the newer model in [Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) or pin a version to make the choice permanent. When you start the session on a specific Sonnet or Opus version, with `--model`, `ANTHROPIC_MODEL`, or the [`model` setting](</docs/en/settings>), that version acts as the session’s pinned default for the matching `sonnet` or `opus` alias. Claude Code skips the availability check for the built-in default your model replaces and starts on the model you configured, with no fallback notice. Model aliases such as `opus` don’t act as pins, and neither does a model ID Claude Code doesn’t recognize. + +Before v2.1.211, Claude Code checked the default model’s availability even when a session model was explicitly configured, and could show a fallback notice for a default the session didn’t use. ##
modified
--- a/google-vertex-ai.md +++ b/google-vertex-ai.md @@ -40,7 +40,7 @@ Choose how you authenticate to Google Cloud: Application Default Credentials from `gcloud`, a service account key file, or credentials already in your environment. The wizard detects your project and region, verifies which Claude models your project can invoke, and lets you pin them. It saves the result to the `env` block of your [user settings file](</docs/en/settings>), so you don’t need to export environment variables yourself. -After you’ve signed in, run `/setup-vertex` any time to reopen the wizard and change your credentials, project, region, or model pins. +After you’ve signed in, run `/setup-vertex` any time to reopen the wizard and change your credentials, project, region, or model pins. The model pin step starts from your currently pinned models. The wizard writes to `~/.claude/settings.json`, or to `$CLAUDE_CONFIG_DIR/settings.json` when [`CLAUDE_CONFIG_DIR`](</docs/en/env-vars#variables>) is set. ##
modified
--- a/google-vertex-ai.md +++ b/google-vertex-ai.md @@ -21,8 +21,6 @@ Sign in with Agent Platform If you have Google Cloud credentials and want to start using Claude Code through Google Cloud’s Agent Platform, the login wizard walks you through it. You complete the GCP-side prerequisites once per project; the wizard handles the Claude Code side. - -The Google Cloud’s Agent Platform setup wizard requires Claude Code v2.1.98 or later. Run `claude --version` to check. 1 @@ -150,9 +148,9 @@ 5\. Pin model versions -Pin specific model versions when deploying to multiple users. Without pinning, model aliases such as `sonnet` and `opus` resolve to Claude Code’s built-in default for Google Cloud’s Agent Platform, which can lag the newest release and may not yet be enabled in your project. Claude Code falls back to the previous version at startup when the default is unavailable, but pinning lets you control when your users move to a new model. - -Set these environment variables to specific Google Cloud’s Agent Platform model IDs. Without these variables, the `opus` alias on Google Cloud’s Agent Platform resolves to Opus 4.8 and the `sonnet` alias resolves to Sonnet 4.5. Set each variable to pin its alias to a specific version: +Pin specific model versions when deploying to multiple users. Without pinning, model aliases such as `sonnet` and `opus` resolve to Claude Code’s built-in default for Google Cloud’s Agent Platform, which can lag the newest release and may not yet be enabled in your project. Claude Code falls back to an earlier or lower-tier model at startup when the default is unavailable, but pinning lets you control when your users move to a new model. + +Set these environment variables to specific Google Cloud’s Agent Platform model IDs. Without `ANTHROPIC_DEFAULT_OPUS_MODEL`, the `opus` alias on Google Cloud’s Agent Platform resolves to Opus 4.8, and without `ANTHROPIC_DEFAULT_SONNET_MODEL`, the `sonnet` alias resolves to Sonnet 4.5. This example pins each alias to a specific version: export ANTHROPIC_DEFAULT_OPUS_MODEL='claude-opus-4-8' export ANTHROPIC_DEFAULT_SONNET_MODEL='claude-sonnet-5' @@ -163,9 +161,16 @@ Model type| Default value ---|--- Primary model| `claude-opus-4-8` -Small/fast model| Same as primary model - -Background tasks such as session title generation use the small/fast model, normally a Haiku-class model. On Google Cloud’s Agent Platform, Claude Code defaults this to the primary model because Haiku may not be enabled in every project or region. To use Haiku for background tasks, set `ANTHROPIC_DEFAULT_HAIKU_MODEL` to a model ID that is available in your project. To customize models further: +Small/fast model| `claude-sonnet-4-5@20250929` + +Background tasks such as session title generation use the small/fast model, normally a Haiku-class model. On Google Cloud’s Agent Platform, Claude Code uses the default Sonnet model for background tasks because Haiku may not be enabled in every project or region. Two selections change which model carries them: + + * When you select a primary model with `--model`, `ANTHROPIC_MODEL`, or the `model` setting, background tasks use that model. Setting `ANTHROPIC_DEFAULT_OPUS_MODEL` without `ANTHROPIC_DEFAULT_SONNET_MODEL` counts as a selection too, because the built-in Sonnet model may not be enabled in a project that steers its own Opus. + * To use Haiku for background tasks, set `ANTHROPIC_DEFAULT_HAIKU_MODEL` to a model ID that is available in your project. + +Opus models have a higher per-token price than Sonnet models, so a deployment that doesn’t pin a primary model is billed at the Opus rate once it updates to v2.1.207 or later. To keep Sonnet 4.5 as the primary model, set `ANTHROPIC_MODEL` to its full model ID. A deployment that steers the default with `ANTHROPIC_DEFAULT_SONNET_MODEL` and doesn’t set `ANTHROPIC_DEFAULT_OPUS_MODEL` keeps its steered Sonnet model as the default. + +Before v2.1.207, the primary model on Google Cloud’s Agent Platform defaulted to Sonnet 4.5, the `opus` alias resolved to Opus 4.6, and background tasks always used the primary model. To customize models further: export ANTHROPIC_MODEL='claude-opus-4-8' export ANTHROPIC_DEFAULT_HAIKU_MODEL='claude-haiku-4-5@20251001' @@ -176,7 +181,7 @@ Startup model checks -When Claude Code starts with Google Cloud’s Agent Platform configured, it verifies that the models it intends to use are accessible in your project. This check requires Claude Code v2.1.98 or later. If you have pinned a model version that is older than the current Claude Code default, and your project can invoke the newer version, Claude Code prompts you to update the pin. Accepting writes the new model ID to your [user settings file](</docs/en/settings>) and restarts Claude Code. Declining is remembered until the next default version change. If you have not pinned a model and the current default is unavailable in your project, Claude Code falls back to the previous version for the current session and shows a notice. The fallback is not persisted. Enable the newer model in [Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) or pin a version to make the choice permanent. +When Claude Code starts with Google Cloud’s Agent Platform configured, it verifies that the models it intends to use are accessible in your project. If you have pinned a model version that is older than the current Claude Code default, and your project can invoke the newer version, Claude Code prompts you to update the pin. Accepting writes the new model ID to your [user settings file](</docs/en/settings>) and restarts Claude Code. Declining is remembered until the next default version change. If you have not pinned a model and the current default is unavailable in your project, Claude Code falls back for the current session and shows a notice. It tries earlier versions of the default model first and, when the default is an Opus model and no Opus version is available, falls back to the default Sonnet model. The fallback is not persisted. Enable the newer model in [Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) or pin a version to make the choice permanent. ## @@ -198,7 +203,7 @@ 1M token context window -Claude Sonnet 5, Opus 4.6 and later, and Sonnet 4.6 support the [1M token context window](<https://platform.claude.com/docs/en/build-with-claude/context-windows#1m-token-context-window>) on Google Cloud’s Agent Platform. Sonnet 5 always runs with the 1M window, with no `[1m]` variant to select. For the other models, Claude Code automatically enables the extended context window when you select a 1M model variant. The setup wizard offers a 1M context option when it pins models. To enable it for a manually pinned model instead, append `[1m]` to the model ID. See [Pin models for third-party deployments](</docs/en/model-config#pin-models-for-third-party-deployments>) for details. +Claude Sonnet 5, Opus 4.6 and later, and Sonnet 4.6 support the [1M token context window](<https://platform.claude.com/docs/en/build-with-claude/context-windows#context-window-sizes-by-model>) on Google Cloud’s Agent Platform. Sonnet 5 always runs with the 1M window, with no `[1m]` variant to select. For the other models, Claude Code automatically enables the extended context window when you select a 1M model variant. The setup wizard offers a 1M context option when it pins models. To enable it for a manually pinned model instead, append `[1m]` to the model ID. See [Pin models for third-party deployments](</docs/en/model-config#pin-models-for-third-party-deployments>) for details. ##
modified
--- a/google-vertex-ai.md +++ b/google-vertex-ai.md @@ -152,7 +152,7 @@ Pin specific model versions when deploying to multiple users. Without pinning, model aliases such as `sonnet` and `opus` resolve to Claude Code’s built-in default for Google Cloud’s Agent Platform, which can lag the newest release and may not yet be enabled in your project. Claude Code falls back to the previous version at startup when the default is unavailable, but pinning lets you control when your users move to a new model. -Set these environment variables to specific Google Cloud’s Agent Platform model IDs. Without `ANTHROPIC_DEFAULT_OPUS_MODEL`, the `opus` alias on Google Cloud’s Agent Platform resolves to Opus 4.6. Set it to the Opus 4.8 ID to use the latest model: +Set these environment variables to specific Google Cloud’s Agent Platform model IDs. Without these variables, the `opus` alias on Google Cloud’s Agent Platform resolves to Opus 4.8 and the `sonnet` alias resolves to Sonnet 4.5. Set each variable to pin its alias to a specific version: export ANTHROPIC_DEFAULT_OPUS_MODEL='claude-opus-4-8' export ANTHROPIC_DEFAULT_SONNET_MODEL='claude-sonnet-5' @@ -162,7 +162,7 @@ Model type| Default value ---|--- -Primary model| `claude-sonnet-4-5@20250929` +Primary model| `claude-opus-4-8` Small/fast model| Same as primary model Background tasks such as session title generation use the small/fast model, normally a Haiku-class model. On Google Cloud’s Agent Platform, Claude Code defaults this to the primary model because Haiku may not be enabled in every project or region. To use Haiku for background tasks, set `ANTHROPIC_DEFAULT_HAIKU_MODEL` to a model ID that is available in your project. To customize models further:
modified
Show diff (206 lines)
--- a/google-vertex-ai.md +++ b/google-vertex-ai.md @@ -4,37 +4,37 @@ Prerequisites -Before configuring Claude Code with Vertex AI, ensure you have: +Before configuring Claude Code with Google Cloud’s Agent Platform, formerly Vertex AI, ensure you have: * A Google Cloud Platform (GCP) account with billing enabled - * A GCP project with Vertex AI API enabled + * A GCP project with Google Cloud’s Agent Platform API enabled * Access to desired Claude models (for example, Claude Sonnet 4.6) * Google Cloud SDK (`gcloud`) installed and configured * Quota allocated in desired GCP region -To sign in with your own Vertex AI credentials, follow Sign in with Vertex AI below. To deploy Claude Code across a team, use the manual setup steps and pin your model versions before rolling out. - -## - -​ - -Sign in with Vertex AI - -If you have Google Cloud credentials and want to start using Claude Code through Vertex AI, the login wizard walks you through it. You complete the GCP-side prerequisites once per project; the wizard handles the Claude Code side. - -The Vertex AI setup wizard requires Claude Code v2.1.98 or later. Run `claude --version` to check. +To sign in with your own Google Cloud’s Agent Platform credentials, follow Sign in with Google Cloud’s Agent Platform below. To deploy Claude Code across a team, use the manual setup steps and pin your model versions before rolling out. + +## + +​ + +Sign in with Agent Platform + +If you have Google Cloud credentials and want to start using Claude Code through Google Cloud’s Agent Platform, the login wizard walks you through it. You complete the GCP-side prerequisites once per project; the wizard handles the Claude Code side. + +The Google Cloud’s Agent Platform setup wizard requires Claude Code v2.1.98 or later. Run `claude --version` to check. 1 Enable Claude models in your GCP project -Enable the Vertex AI API for your project, then request access to the Claude models you want in the [Vertex AI Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>). See IAM configuration for the permissions your account needs. +Enable Google Cloud’s Agent Platform API for your project, then request access to the Claude models you want in the [Google Cloud’s Agent Platform Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>). See IAM configuration for the permissions your account needs. 2 -Start Claude Code and choose Vertex AI - -Run `claude`. At the login prompt, select **3rd-party platform** , then **Google Vertex AI**. +Start Claude Code and choose Google Cloud's Agent Platform + +Run `claude`. At the login prompt, select **3rd-party platform** , then **Google Vertex AI** , the label the login prompt still uses for Google Cloud’s Agent Platform. 3 @@ -50,9 +50,9 @@ Region configuration -Claude Code supports Vertex AI [global](<https://cloud.google.com/blog/products/ai-machine-learning/global-endpoint-for-claude-models-generally-available-on-vertex-ai>), multi-region, and regional endpoints. Set `CLOUD_ML_REGION` to `global`, a multi-region location such as `eu` or `us`, or a specific region such as `us-east5`. Claude Code selects the correct Vertex AI hostname for each form, including the `aiplatform.eu.rep.googleapis.com` and `aiplatform.us.rep.googleapis.com` hosts for multi-region locations. - -Vertex AI may not support the Claude Code default models on every endpoint type. Model availability varies across [specific regions](<https://cloud.google.com/vertex-ai/generative-ai/docs/learn/locations#genai-partner-models>), multi-region locations, and [global endpoints](<https://cloud.google.com/vertex-ai/generative-ai/docs/partner-models/use-partner-models#supported_models>). You may need to switch to a supported location or specify a supported model. +Claude Code supports Google Cloud’s Agent Platform [global](<https://cloud.google.com/blog/products/ai-machine-learning/global-endpoint-for-claude-models-generally-available-on-vertex-ai>), multi-region, and regional endpoints. Set `CLOUD_ML_REGION` to `global`, a multi-region location such as `eu` or `us`, or a specific region such as `us-east5`. Claude Code selects the correct Google Cloud’s Agent Platform hostname for each form, including the `aiplatform.eu.rep.googleapis.com` and `aiplatform.us.rep.googleapis.com` hosts for multi-region locations. + +Google Cloud’s Agent Platform may not support the Claude Code default models on every endpoint type. Model availability varies across [specific regions](<https://cloud.google.com/vertex-ai/generative-ai/docs/learn/locations#genai-partner-models>), multi-region locations, and [global endpoints](<https://cloud.google.com/vertex-ai/generative-ai/docs/partner-models/use-partner-models#supported_models>). You may need to switch to a supported location or specify a supported model. ## @@ -60,20 +60,20 @@ Set up manually -To configure Vertex AI through environment variables instead of the wizard, for example in CI or a scripted enterprise rollout, follow the steps below. - -### - -​ - -1\. Enable Vertex AI API - -Enable the Vertex AI API in your GCP project: +To configure Google Cloud’s Agent Platform through environment variables instead of the wizard, for example in CI or a scripted enterprise rollout, follow the steps below. + +### + +​ + +1\. Enable Agent Platform API + +Enable Google Cloud’s Agent Platform API in your GCP project: # Set your project ID gcloud config set project YOUR-PROJECT-ID - # Enable Vertex AI API + # Enable Agent Platform API gcloud services enable aiplatform.googleapis.com ### @@ -82,9 +82,9 @@ 2\. Request model access -Request access to Claude models in Vertex AI: - - 1. Navigate to the [Vertex AI Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) +Request access to Claude models in Google Cloud’s Agent Platform: + + 1. Navigate to the [Google Cloud’s Agent Platform Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) 2. Search for “Claude” models 3. Request access to desired Claude models (for example, Claude Sonnet 4.6) 4. Wait for approval (may take 24-48 hours) @@ -97,7 +97,7 @@ Claude Code uses standard Google Cloud authentication. For more information, see [Google Cloud authentication documentation](<https://cloud.google.com/docs/authentication>). Claude Code v2.1.121 or later supports [X.509 certificate-based Workload Identity Federation](<https://cloud.google.com/iam/docs/workload-identity-federation-with-x509-certificates>) through the same Application Default Credentials chain. Set `GOOGLE_APPLICATION_CREDENTIALS` to the path of your credential configuration file. -Claude Code uses `ANTHROPIC_VERTEX_PROJECT_ID` as the project ID for Vertex AI requests. The `GCLOUD_PROJECT` and `GOOGLE_CLOUD_PROJECT` environment variables and the credential file referenced by `GOOGLE_APPLICATION_CREDENTIALS` take precedence over it. If none of these are set, the project ID is resolved from your `gcloud` configuration or the attached service account. +Claude Code uses `ANTHROPIC_VERTEX_PROJECT_ID` as the project ID for Google Cloud’s Agent Platform requests. The `GCLOUD_PROJECT` and `GOOGLE_CLOUD_PROJECT` environment variables and the credential file referenced by `GOOGLE_APPLICATION_CREDENTIALS` take precedence over it. If none of these are set, the project ID is resolved from your `gcloud` configuration or the attached service account. #### @@ -124,12 +124,12 @@ Set the following environment variables: - # Enable Vertex AI integration + # Enable Agent Platform integration export CLAUDE_CODE_USE_VERTEX=1 export CLOUD_ML_REGION=global export ANTHROPIC_VERTEX_PROJECT_ID=YOUR-PROJECT-ID - # Optional: Override the Vertex endpoint URL for custom endpoints or gateways + # Optional: Override the Agent Platform endpoint URL for custom endpoints or gateways # export ANTHROPIC_VERTEX_BASE_URL=https://aiplatform.googleapis.com # Optional: Disable prompt caching if needed @@ -142,7 +142,7 @@ export VERTEX_REGION_CLAUDE_HAIKU_4_5=us-east5 export VERTEX_REGION_CLAUDE_4_6_SONNET=europe-west1 -Most model versions have a corresponding `VERTEX_REGION_CLAUDE_*` variable. See the [Environment variables reference](</docs/en/env-vars>) for the full list. Check [Vertex Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) to determine which models support global endpoints versus regional only. [Prompt caching](</docs/en/prompt-caching>) is enabled automatically. To disable it, set `DISABLE_PROMPT_CACHING=1`. To request a 1-hour cache TTL instead of the 5-minute default, set `ENABLE_PROMPT_CACHING_1H=1`; cache writes with a 1-hour TTL are billed at a higher rate. For heightened rate limits, contact Google Cloud support. When using Vertex AI, the `/logout` command is unavailable since authentication is handled through Google Cloud credentials. Claude Code disables [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>) by default on Vertex AI, so MCP tool definitions load upfront. Vertex AI supports tool search for Claude Sonnet 4.5 and later and Claude Opus 4.5 and later. Set `ENABLE_TOOL_SEARCH=true` to enable it on those models. Earlier models on Vertex AI do not accept the required beta header, and requests fail if you enable tool search with them. +Most model versions have a corresponding `VERTEX_REGION_CLAUDE_*` variable. See the [Environment variables reference](</docs/en/env-vars>) for the full list. Check [Google Cloud’s Agent Platform Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) to determine which models support global endpoints versus regional only. [Prompt caching](</docs/en/prompt-caching>) is enabled automatically. To disable it, set `DISABLE_PROMPT_CACHING=1`. To request a 1-hour cache TTL instead of the 5-minute default, set `ENABLE_PROMPT_CACHING_1H=1`; cache writes with a 1-hour TTL are billed at a higher rate. For heightened rate limits, contact Google Cloud support. When using Google Cloud’s Agent Platform, the `/logout` command is unavailable since authentication is handled through Google Cloud credentials. Claude Code disables [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>) by default on Google Cloud’s Agent Platform, so MCP tool definitions load upfront. Google Cloud’s Agent Platform supports tool search for Claude Sonnet 4.5 and later and Claude Opus 4.5 and later. Set `ENABLE_TOOL_SEARCH=true` to enable it on those models. Earlier models on Google Cloud’s Agent Platform do not accept the required beta header, and requests fail if you enable tool search with them. ### @@ -150,9 +150,9 @@ 5\. Pin model versions -Pin specific model versions when deploying to multiple users. Without pinning, model aliases such as `sonnet` and `opus` resolve to Claude Code’s built-in default for Vertex AI, which can lag the newest release and may not yet be enabled in your project. Claude Code falls back to the previous version at startup when the default is unavailable, but pinning lets you control when your users move to a new model. - -Set these environment variables to specific Vertex AI model IDs. Without `ANTHROPIC_DEFAULT_OPUS_MODEL`, the `opus` alias on Vertex resolves to Opus 4.6. Set it to the Opus 4.8 ID to use the latest model: +Pin specific model versions when deploying to multiple users. Without pinning, model aliases such as `sonnet` and `opus` resolve to Claude Code’s built-in default for Google Cloud’s Agent Platform, which can lag the newest release and may not yet be enabled in your project. Claude Code falls back to the previous version at startup when the default is unavailable, but pinning lets you control when your users move to a new model. + +Set these environment variables to specific Google Cloud’s Agent Platform model IDs. Without `ANTHROPIC_DEFAULT_OPUS_MODEL`, the `opus` alias on Google Cloud’s Agent Platform resolves to Opus 4.6. Set it to the Opus 4.8 ID to use the latest model: export ANTHROPIC_DEFAULT_OPUS_MODEL='claude-opus-4-8' export ANTHROPIC_DEFAULT_SONNET_MODEL='claude-sonnet-5' @@ -165,7 +165,7 @@ Primary model| `claude-sonnet-4-5@20250929` Small/fast model| Same as primary model -Background tasks such as session title generation use the small/fast model, normally a Haiku-class model. On Vertex AI, Claude Code defaults this to the primary model because Haiku may not be enabled in every project or region. To use Haiku for background tasks, set `ANTHROPIC_DEFAULT_HAIKU_MODEL` to a model ID that is available in your project. To customize models further: +Background tasks such as session title generation use the small/fast model, normally a Haiku-class model. On Google Cloud’s Agent Platform, Claude Code defaults this to the primary model because Haiku may not be enabled in every project or region. To use Haiku for background tasks, set `ANTHROPIC_DEFAULT_HAIKU_MODEL` to a model ID that is available in your project. To customize models further: export ANTHROPIC_MODEL='claude-opus-4-8' export ANTHROPIC_DEFAULT_HAIKU_MODEL='claude-haiku-4-5@20251001' @@ -176,7 +176,7 @@ Startup model checks -When Claude Code starts with Vertex AI configured, it verifies that the models it intends to use are accessible in your project. This check requires Claude Code v2.1.98 or later. If you have pinned a model version that is older than the current Claude Code default, and your project can invoke the newer version, Claude Code prompts you to update the pin. Accepting writes the new model ID to your [user settings file](</docs/en/settings>) and restarts Claude Code. Declining is remembered until the next default version change. If you have not pinned a model and the current default is unavailable in your project, Claude Code falls back to the previous version for the current session and shows a notice. The fallback is not persisted. Enable the newer model in [Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) or pin a version to make the choice permanent. +When Claude Code starts with Google Cloud’s Agent Platform configured, it verifies that the models it intends to use are accessible in your project. This check requires Claude Code v2.1.98 or later. If you have pinned a model version that is older than the current Claude Code default, and your project can invoke the newer version, Claude Code prompts you to update the pin. Accepting writes the new model ID to your [user settings file](</docs/en/settings>) and restarts Claude Code. Declining is remembered until the next default version change. If you have not pinned a model and the current default is unavailable in your project, Claude Code falls back to the previous version for the current session and shows a notice. The fallback is not persisted. Enable the newer model in [Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) or pin a version to make the choice permanent. ## @@ -188,7 +188,7 @@ * `aiplatform.endpoints.predict` \- Required for model invocation and token counting -For more restrictive permissions, create a custom role with only the permissions above. For details, see [Vertex IAM documentation](<https://cloud.google.com/vertex-ai/docs/general/access-control>). +For more restrictive permissions, create a custom role with only the permissions above. For details, see [Google Cloud’s Agent Platform IAM documentation](<https://cloud.google.com/vertex-ai/docs/general/access-control>). Create a dedicated GCP project for Claude Code to simplify cost tracking and access control. @@ -198,7 +198,7 @@ 1M token context window -Claude Sonnet 5, Opus 4.6 and later, and Sonnet 4.6 support the [1M token context window](<https://platform.claude.com/docs/en/build-with-claude/context-windows#1m-token-context-window>) on Vertex AI. Sonnet 5 always runs with the 1M window, with no `[1m]` variant to select. For the other models, Claude Code automatically enables the extended context window when you select a 1M model variant. The setup wizard offers a 1M context option when it pins models. To enable it for a manually pinned model instead, append `[1m]` to the model ID. See [Pin models for third-party deployments](</docs/en/model-config#pin-models-for-third-party-deployments>) for details. +Claude Sonnet 5, Opus 4.6 and later, and Sonnet 4.6 support the [1M token context window](<https://platform.claude.com/docs/en/build-with-claude/context-windows#1m-token-context-window>) on Google Cloud’s Agent Platform. Sonnet 5 always runs with the 1M window, with no `[1m]` variant to select. For the other models, Claude Code automatically enables the extended context window when you select a 1M model variant. The setup wizard offers a 1M context option when it pins models. To enable it for a manually pinned model instead, append `[1m]` to the model ID. See [Pin models for third-party deployments](</docs/en/model-config#pin-models-for-third-party-deployments>) for details. ## @@ -235,6 +235,6 @@ Additional resources - * [Vertex AI documentation](<https://cloud.google.com/vertex-ai/docs>) - * [Vertex AI pricing](<https://cloud.google.com/vertex-ai/pricing>) - * [Vertex AI quotas and limits](<https://cloud.google.com/vertex-ai/docs/quotas>) + * [Google Cloud’s Agent Platform documentation](<https://cloud.google.com/vertex-ai/docs>) + * [Google Cloud’s Agent Platform pricing](<https://cloud.google.com/vertex-ai/pricing>) + * [Google Cloud’s Agent Platform quotas and limits](<https://cloud.google.com/vertex-ai/docs/quotas>)
modified
--- a/google-vertex-ai.md +++ b/google-vertex-ai.md @@ -155,7 +155,7 @@ Set these environment variables to specific Vertex AI model IDs. Without `ANTHROPIC_DEFAULT_OPUS_MODEL`, the `opus` alias on Vertex resolves to Opus 4.6. Set it to the Opus 4.8 ID to use the latest model: export ANTHROPIC_DEFAULT_OPUS_MODEL='claude-opus-4-8' - export ANTHROPIC_DEFAULT_SONNET_MODEL='claude-sonnet-4-6' + export ANTHROPIC_DEFAULT_SONNET_MODEL='claude-sonnet-5' export ANTHROPIC_DEFAULT_HAIKU_MODEL='claude-haiku-4-5@20251001' For current and legacy model IDs, see [Models overview](<https://platform.claude.com/docs/en/about-claude/models/overview>). See [Model configuration](</docs/en/model-config#pin-models-for-third-party-deployments>) for the full list of environment variables. Claude Code uses these default models when no pinning variables are set: @@ -198,7 +198,7 @@ 1M token context window -Claude Opus 4.6 and later, and Sonnet 4.6, support the [1M token context window](<https://platform.claude.com/docs/en/build-with-claude/context-windows#1m-token-context-window>) on Vertex AI. Claude Code automatically enables the extended context window when you select a 1M model variant. The setup wizard offers a 1M context option when it pins models. To enable it for a manually pinned model instead, append `[1m]` to the model ID. See [Pin models for third-party deployments](</docs/en/model-config#pin-models-for-third-party-deployments>) for details. +Claude Sonnet 5, Opus 4.6 and later, and Sonnet 4.6 support the [1M token context window](<https://platform.claude.com/docs/en/build-with-claude/context-windows#1m-token-context-window>) on Vertex AI. Sonnet 5 always runs with the 1M window, with no `[1m]` variant to select. For the other models, Claude Code automatically enables the extended context window when you select a 1M model variant. The setup wizard offers a 1M context option when it pins models. To enable it for a manually pinned model instead, append `[1m]` to the model ID. See [Pin models for third-party deployments](</docs/en/model-config#pin-models-for-third-party-deployments>) for details. ##
modified
--- a/google-vertex-ai.md +++ b/google-vertex-ai.md @@ -150,7 +150,7 @@ 5\. Pin model versions -Pin specific model versions when deploying to multiple users. Without pinning, model aliases such as `sonnet` and `opus` resolve to the latest version, which may not yet be enabled in your Vertex AI project when Anthropic releases an update. Claude Code falls back to the previous version at startup when the latest is unavailable, but pinning lets you control when your users move to a new model. +Pin specific model versions when deploying to multiple users. Without pinning, model aliases such as `sonnet` and `opus` resolve to Claude Code’s built-in default for Vertex AI, which can lag the newest release and may not yet be enabled in your project. Claude Code falls back to the previous version at startup when the default is unavailable, but pinning lets you control when your users move to a new model. Set these environment variables to specific Vertex AI model IDs. Without `ANTHROPIC_DEFAULT_OPUS_MODEL`, the `opus` alias on Vertex resolves to Opus 4.6. Set it to the Opus 4.8 ID to use the latest model:
modified
--- a/google-vertex-ai.md +++ b/google-vertex-ai.md @@ -1,9 +1,3 @@ -> ## Documentation Index -> -> Fetch the complete documentation index at: <https://code.claude.com/docs/llms.txt> -> -> Use this file to discover all available pages before exploring further. - ## ​
modified
--- a/google-vertex-ai.md +++ b/google-vertex-ai.md @@ -158,9 +158,9 @@ Pin specific model versions when deploying to multiple users. Without pinning, model aliases such as `sonnet` and `opus` resolve to the latest version, which may not yet be enabled in your Vertex AI project when Anthropic releases an update. Claude Code falls back to the previous version at startup when the latest is unavailable, but pinning lets you control when your users move to a new model. -Set these environment variables to specific Vertex AI model IDs. Without `ANTHROPIC_DEFAULT_OPUS_MODEL`, the `opus` alias on Vertex resolves to Opus 4.6. Set it to the Opus 4.7 ID to use the latest model: - - export ANTHROPIC_DEFAULT_OPUS_MODEL='claude-opus-4-7' +Set these environment variables to specific Vertex AI model IDs. Without `ANTHROPIC_DEFAULT_OPUS_MODEL`, the `opus` alias on Vertex resolves to Opus 4.6. Set it to the Opus 4.8 ID to use the latest model: + + export ANTHROPIC_DEFAULT_OPUS_MODEL='claude-opus-4-8' export ANTHROPIC_DEFAULT_SONNET_MODEL='claude-sonnet-4-6' export ANTHROPIC_DEFAULT_HAIKU_MODEL='claude-haiku-4-5@20251001' @@ -173,7 +173,7 @@ Background tasks such as session title generation use the small/fast model, normally a Haiku-class model. On Vertex AI, Claude Code defaults this to the primary model because Haiku may not be enabled in every project or region. To use Haiku for background tasks, set `ANTHROPIC_DEFAULT_HAIKU_MODEL` to a model ID that is available in your project. To customize models further: - export ANTHROPIC_MODEL='claude-opus-4-7' + export ANTHROPIC_MODEL='claude-opus-4-8' export ANTHROPIC_DEFAULT_HAIKU_MODEL='claude-haiku-4-5@20251001' ## @@ -204,7 +204,7 @@ 1M token context window -Claude Opus 4.7, Opus 4.6, and Sonnet 4.6 support the [1M token context window](<https://platform.claude.com/docs/en/build-with-claude/context-windows#1m-token-context-window>) on Vertex AI. Claude Code automatically enables the extended context window when you select a 1M model variant. The setup wizard offers a 1M context option when it pins models. To enable it for a manually pinned model instead, append `[1m]` to the model ID. See [Pin models for third-party deployments](</docs/en/model-config#pin-models-for-third-party-deployments>) for details. +Claude Opus 4.6 and later, and Sonnet 4.6, support the [1M token context window](<https://platform.claude.com/docs/en/build-with-claude/context-windows#1m-token-context-window>) on Vertex AI. Claude Code automatically enables the extended context window when you select a 1M model variant. The setup wizard offers a 1M context option when it pins models. To enable it for a manually pinned model instead, append `[1m]` to the model ID. See [Pin models for third-party deployments](</docs/en/model-config#pin-models-for-third-party-deployments>) for details. ##
modified
--- a/google-vertex-ai.md +++ b/google-vertex-ai.md @@ -148,7 +148,7 @@ export VERTEX_REGION_CLAUDE_HAIKU_4_5=us-east5 export VERTEX_REGION_CLAUDE_4_6_SONNET=europe-west1 -Most model versions have a corresponding `VERTEX_REGION_CLAUDE_*` variable. See the [Environment variables reference](</docs/en/env-vars>) for the full list. Check [Vertex Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) to determine which models support global endpoints versus regional only. [Prompt caching](</docs/en/prompt-caching>) is enabled automatically. To disable it, set `DISABLE_PROMPT_CACHING=1`. To request a 1-hour cache TTL instead of the 5-minute default, set `ENABLE_PROMPT_CACHING_1H=1`; cache writes with a 1-hour TTL are billed at a higher rate. For heightened rate limits, contact Google Cloud support. When using Vertex AI, the `/login` and `/logout` commands are disabled since authentication is handled through Google Cloud credentials. Claude Code disables [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>) by default on Vertex AI, so MCP tool definitions load upfront. Vertex AI supports tool search for Claude Sonnet 4.5 and later and Claude Opus 4.5 and later. Set `ENABLE_TOOL_SEARCH=true` to enable it on those models. Earlier models on Vertex AI do not accept the required beta header, and requests fail if you enable tool search with them. +Most model versions have a corresponding `VERTEX_REGION_CLAUDE_*` variable. See the [Environment variables reference](</docs/en/env-vars>) for the full list. Check [Vertex Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) to determine which models support global endpoints versus regional only. [Prompt caching](</docs/en/prompt-caching>) is enabled automatically. To disable it, set `DISABLE_PROMPT_CACHING=1`. To request a 1-hour cache TTL instead of the 5-minute default, set `ENABLE_PROMPT_CACHING_1H=1`; cache writes with a 1-hour TTL are billed at a higher rate. For heightened rate limits, contact Google Cloud support. When using Vertex AI, the `/logout` command is unavailable since authentication is handled through Google Cloud credentials. Claude Code disables [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>) by default on Vertex AI, so MCP tool definitions load upfront. Vertex AI supports tool search for Claude Sonnet 4.5 and later and Claude Opus 4.5 and later. Set `ENABLE_TOOL_SEARCH=true` to enable it on those models. Earlier models on Vertex AI do not accept the required beta header, and requests fail if you enable tool search with them. ###
modified
--- a/google-vertex-ai.md +++ b/google-vertex-ai.md @@ -148,7 +148,7 @@ export VERTEX_REGION_CLAUDE_HAIKU_4_5=us-east5 export VERTEX_REGION_CLAUDE_4_6_SONNET=europe-west1 -Most model versions have a corresponding `VERTEX_REGION_CLAUDE_*` variable. See the [Environment variables reference](</docs/en/env-vars>) for the full list. Check [Vertex Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) to determine which models support global endpoints versus regional only. [Prompt caching](<https://platform.claude.com/docs/en/build-with-claude/prompt-caching>) is enabled automatically. To disable it, set `DISABLE_PROMPT_CACHING=1`. To request a 1-hour cache TTL instead of the 5-minute default, set `ENABLE_PROMPT_CACHING_1H=1`; cache writes with a 1-hour TTL are billed at a higher rate. For heightened rate limits, contact Google Cloud support. When using Vertex AI, the `/login` and `/logout` commands are disabled since authentication is handled through Google Cloud credentials. Claude Code disables [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>) by default on Vertex AI, so MCP tool definitions load upfront. Vertex AI supports tool search for Claude Sonnet 4.5 and later and Claude Opus 4.5 and later. Set `ENABLE_TOOL_SEARCH=true` to enable it on those models. Earlier models on Vertex AI do not accept the required beta header, and requests fail if you enable tool search with them. +Most model versions have a corresponding `VERTEX_REGION_CLAUDE_*` variable. See the [Environment variables reference](</docs/en/env-vars>) for the full list. Check [Vertex Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) to determine which models support global endpoints versus regional only. [Prompt caching](</docs/en/prompt-caching>) is enabled automatically. To disable it, set `DISABLE_PROMPT_CACHING=1`. To request a 1-hour cache TTL instead of the 5-minute default, set `ENABLE_PROMPT_CACHING_1H=1`; cache writes with a 1-hour TTL are billed at a higher rate. For heightened rate limits, contact Google Cloud support. When using Vertex AI, the `/login` and `/logout` commands are disabled since authentication is handled through Google Cloud credentials. Claude Code disables [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>) by default on Vertex AI, so MCP tool definitions load upfront. Vertex AI supports tool search for Claude Sonnet 4.5 and later and Claude Opus 4.5 and later. Set `ENABLE_TOOL_SEARCH=true` to enable it on those models. Earlier models on Vertex AI do not accept the required beta header, and requests fail if you enable tool search with them. ###
modified
--- a/google-vertex-ai.md +++ b/google-vertex-ai.md @@ -148,7 +148,7 @@ export VERTEX_REGION_CLAUDE_HAIKU_4_5=us-east5 export VERTEX_REGION_CLAUDE_4_6_SONNET=europe-west1 -Most model versions have a corresponding `VERTEX_REGION_CLAUDE_*` variable. See the [Environment variables reference](</docs/en/env-vars>) for the full list. Check [Vertex Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) to determine which models support global endpoints versus regional only. [Prompt caching](<https://platform.claude.com/docs/en/build-with-claude/prompt-caching>) is enabled automatically. To disable it, set `DISABLE_PROMPT_CACHING=1`. To request a 1-hour cache TTL instead of the 5-minute default, set `ENABLE_PROMPT_CACHING_1H=1`; cache writes with a 1-hour TTL are billed at a higher rate. For heightened rate limits, contact Google Cloud support. When using Vertex AI, the `/login` and `/logout` commands are disabled since authentication is handled through Google Cloud credentials. [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>) is disabled by default on Vertex AI because the endpoint does not accept the required beta header. All MCP tool definitions load upfront instead. Setting `ENABLE_TOOL_SEARCH=true` forces Claude Code to send the header anyway, which causes Vertex AI to reject requests. +Most model versions have a corresponding `VERTEX_REGION_CLAUDE_*` variable. See the [Environment variables reference](</docs/en/env-vars>) for the full list. Check [Vertex Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) to determine which models support global endpoints versus regional only. [Prompt caching](<https://platform.claude.com/docs/en/build-with-claude/prompt-caching>) is enabled automatically. To disable it, set `DISABLE_PROMPT_CACHING=1`. To request a 1-hour cache TTL instead of the 5-minute default, set `ENABLE_PROMPT_CACHING_1H=1`; cache writes with a 1-hour TTL are billed at a higher rate. For heightened rate limits, contact Google Cloud support. When using Vertex AI, the `/login` and `/logout` commands are disabled since authentication is handled through Google Cloud credentials. Claude Code disables [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>) by default on Vertex AI, so MCP tool definitions load upfront. Vertex AI supports tool search for Claude Sonnet 4.5 and later and Claude Opus 4.5 and later. Set `ENABLE_TOOL_SEARCH=true` to enable it on those models. Earlier models on Vertex AI do not accept the required beta header, and requests fail if you enable tool search with them. ### @@ -169,9 +169,9 @@ Model type| Default value ---|--- Primary model| `claude-sonnet-4-5@20250929` -Small/fast model| `claude-haiku-4-5@20251001` - -To customize models further: +Small/fast model| Same as primary model + +Background tasks such as session title generation use the small/fast model, normally a Haiku-class model. On Vertex AI, Claude Code defaults this to the primary model because Haiku may not be enabled in every project or region. To use Haiku for background tasks, set `ANTHROPIC_DEFAULT_HAIKU_MODEL` to a model ID that is available in your project. To customize models further: export ANTHROPIC_MODEL='claude-opus-4-7' export ANTHROPIC_DEFAULT_HAIKU_MODEL='claude-haiku-4-5@20251001'
modified
--- a/google-vertex-ai.md +++ b/google-vertex-ai.md @@ -148,7 +148,7 @@ export VERTEX_REGION_CLAUDE_HAIKU_4_5=us-east5 export VERTEX_REGION_CLAUDE_4_6_SONNET=europe-west1 -Most model versions have a corresponding `VERTEX_REGION_CLAUDE_*` variable. See the [Environment variables reference](</docs/en/env-vars>) for the full list. Check [Vertex Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) to determine which models support global endpoints versus regional only. [Prompt caching](<https://platform.claude.com/docs/en/build-with-claude/prompt-caching>) is enabled automatically. To disable it, set `DISABLE_PROMPT_CACHING=1`. To request a 1-hour cache TTL instead of the 5-minute default, set `ENABLE_PROMPT_CACHING_1H=1`; cache writes with a 1-hour TTL are billed at a higher rate. For heightened rate limits, contact Google Cloud support. When using Vertex AI, the `/login` and `/logout` commands are disabled since authentication is handled through Google Cloud credentials. [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>) is disabled by default on Vertex AI because the endpoint does not accept the required beta header. All MCP tool definitions load upfront instead. To opt in, set `ENABLE_TOOL_SEARCH=true`. +Most model versions have a corresponding `VERTEX_REGION_CLAUDE_*` variable. See the [Environment variables reference](</docs/en/env-vars>) for the full list. Check [Vertex Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) to determine which models support global endpoints versus regional only. [Prompt caching](<https://platform.claude.com/docs/en/build-with-claude/prompt-caching>) is enabled automatically. To disable it, set `DISABLE_PROMPT_CACHING=1`. To request a 1-hour cache TTL instead of the 5-minute default, set `ENABLE_PROMPT_CACHING_1H=1`; cache writes with a 1-hour TTL are billed at a higher rate. For heightened rate limits, contact Google Cloud support. When using Vertex AI, the `/login` and `/logout` commands are disabled since authentication is handled through Google Cloud credentials. [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>) is disabled by default on Vertex AI because the endpoint does not accept the required beta header. All MCP tool definitions load upfront instead. Setting `ENABLE_TOOL_SEARCH=true` forces Claude Code to send the header anyway, which causes Vertex AI to reject requests. ###
modified
--- a/google-vertex-ai.md +++ b/google-vertex-ai.md @@ -103,7 +103,24 @@ Claude Code uses standard Google Cloud authentication. For more information, see [Google Cloud authentication documentation](<https://cloud.google.com/docs/authentication>). Claude Code v2.1.121 or later supports [X.509 certificate-based Workload Identity Federation](<https://cloud.google.com/iam/docs/workload-identity-federation-with-x509-certificates>) through the same Application Default Credentials chain. Set `GOOGLE_APPLICATION_CREDENTIALS` to the path of your credential configuration file. -When authenticating, Claude Code will automatically use the project ID from the `ANTHROPIC_VERTEX_PROJECT_ID` environment variable. To override this, set one of these environment variables: `GCLOUD_PROJECT`, `GOOGLE_CLOUD_PROJECT`, or `GOOGLE_APPLICATION_CREDENTIALS`. +Claude Code uses `ANTHROPIC_VERTEX_PROJECT_ID` as the project ID for Vertex AI requests. The `GCLOUD_PROJECT` and `GOOGLE_CLOUD_PROJECT` environment variables and the credential file referenced by `GOOGLE_APPLICATION_CREDENTIALS` take precedence over it. If none of these are set, the project ID is resolved from your `gcloud` configuration or the attached service account. + +#### + +​ + +Advanced credential configuration + +Claude Code supports automatic credential refresh for GCP through the `gcpAuthRefresh` setting. When Claude Code detects that your GCP credentials are expired or cannot be loaded, it runs the configured command to obtain new credentials before retrying the request. + + { + "gcpAuthRefresh": "gcloud auth application-default login", + "env": { + "ANTHROPIC_VERTEX_PROJECT_ID": "your-project-id" + } + } + +The command’s output is displayed to the user, but interactive input isn’t supported. This works well for browser-based authentication flows where the CLI shows a URL and you complete authentication in the browser. The refresh command times out after three minutes if authentication does not complete. If you set `gcpAuthRefresh` in project settings such as `.claude/settings.json`, the command runs only after you accept the workspace trust prompt. ### @@ -194,6 +211,12 @@ ​ Troubleshooting + +If you encounter “Could not load the default credentials” errors: + + * Run `gcloud auth application-default login` to set up Application Default Credentials + * Set `GOOGLE_APPLICATION_CREDENTIALS` to a service account key file path + * See Configure GCP credentials for all options If you encounter quota issues:
modified
--- a/google-vertex-ai.md +++ b/google-vertex-ai.md @@ -1,3 +1,9 @@ +> ## Documentation Index +> +> Fetch the complete documentation index at: <https://code.claude.com/docs/llms.txt> +> +> Use this file to discover all available pages before exploring further. + ## ​
modified
--- a/google-vertex-ai.md +++ b/google-vertex-ai.md @@ -95,7 +95,7 @@ 3\. Configure GCP credentials -Claude Code uses standard Google Cloud authentication. For more information, see [Google Cloud authentication documentation](<https://cloud.google.com/docs/authentication>). +Claude Code uses standard Google Cloud authentication. For more information, see [Google Cloud authentication documentation](<https://cloud.google.com/docs/authentication>). Claude Code v2.1.121 or later supports [X.509 certificate-based Workload Identity Federation](<https://cloud.google.com/iam/docs/workload-identity-federation-with-x509-certificates>) through the same Application Default Credentials chain. Set `GOOGLE_APPLICATION_CREDENTIALS` to the path of your credential configuration file. When authenticating, Claude Code will automatically use the project ID from the `ANTHROPIC_VERTEX_PROJECT_ID` environment variable. To override this, set one of these environment variables: `GCLOUD_PROJECT`, `GOOGLE_CLOUD_PROJECT`, or `GOOGLE_APPLICATION_CREDENTIALS`.
modified
--- a/google-vertex-ai.md +++ b/google-vertex-ai.md @@ -125,7 +125,7 @@ export VERTEX_REGION_CLAUDE_HAIKU_4_5=us-east5 export VERTEX_REGION_CLAUDE_4_6_SONNET=europe-west1 -Most model versions have a corresponding `VERTEX_REGION_CLAUDE_*` variable. See the [Environment variables reference](</docs/en/env-vars>) for the full list. Check [Vertex Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) to determine which models support global endpoints versus regional only. [Prompt caching](<https://platform.claude.com/docs/en/build-with-claude/prompt-caching>) is enabled automatically. To disable it, set `DISABLE_PROMPT_CACHING=1`. To request a 1-hour cache TTL instead of the 5-minute default, set `ENABLE_PROMPT_CACHING_1H=1`; cache writes with a 1-hour TTL are billed at a higher rate. For heightened rate limits, contact Google Cloud support. When using Vertex AI, the `/login` and `/logout` commands are disabled since authentication is handled through Google Cloud credentials. +Most model versions have a corresponding `VERTEX_REGION_CLAUDE_*` variable. See the [Environment variables reference](</docs/en/env-vars>) for the full list. Check [Vertex Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) to determine which models support global endpoints versus regional only. [Prompt caching](<https://platform.claude.com/docs/en/build-with-claude/prompt-caching>) is enabled automatically. To disable it, set `DISABLE_PROMPT_CACHING=1`. To request a 1-hour cache TTL instead of the 5-minute default, set `ENABLE_PROMPT_CACHING_1H=1`; cache writes with a 1-hour TTL are billed at a higher rate. For heightened rate limits, contact Google Cloud support. When using Vertex AI, the `/login` and `/logout` commands are disabled since authentication is handled through Google Cloud credentials. [MCP tool search](</docs/en/mcp#scale-with-mcp-tool-search>) is disabled by default on Vertex AI because the endpoint does not accept the required beta header. All MCP tool definitions load upfront instead. To opt in, set `ENABLE_TOOL_SEARCH=true`. ###
modified
--- a/google-vertex-ai.md +++ b/google-vertex-ai.md @@ -118,11 +118,14 @@ # Optional: Disable prompt caching if needed export DISABLE_PROMPT_CACHING=1 + # Optional: Request 1-hour prompt cache TTL instead of the 5-minute default + export ENABLE_PROMPT_CACHING_1H=1 + # When CLOUD_ML_REGION=global, override region for models that don't support global endpoints export VERTEX_REGION_CLAUDE_HAIKU_4_5=us-east5 export VERTEX_REGION_CLAUDE_4_6_SONNET=europe-west1 -Most model versions have a corresponding `VERTEX_REGION_CLAUDE_*` variable. See the [Environment variables reference](</docs/en/env-vars>) for the full list. Check [Vertex Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) to determine which models support global endpoints versus regional only. [Prompt caching](<https://platform.claude.com/docs/en/build-with-claude/prompt-caching>) is automatically supported when you specify the `cache_control` ephemeral flag. To disable it, set `DISABLE_PROMPT_CACHING=1`. For heightened rate limits, contact Google Cloud support. When using Vertex AI, the `/login` and `/logout` commands are disabled since authentication is handled through Google Cloud credentials. +Most model versions have a corresponding `VERTEX_REGION_CLAUDE_*` variable. See the [Environment variables reference](</docs/en/env-vars>) for the full list. Check [Vertex Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) to determine which models support global endpoints versus regional only. [Prompt caching](<https://platform.claude.com/docs/en/build-with-claude/prompt-caching>) is enabled automatically. To disable it, set `DISABLE_PROMPT_CACHING=1`. To request a 1-hour cache TTL instead of the 5-minute default, set `ENABLE_PROMPT_CACHING_1H=1`; cache writes with a 1-hour TTL are billed at a higher rate. For heightened rate limits, contact Google Cloud support. When using Vertex AI, the `/login` and `/logout` commands are disabled since authentication is handled through Google Cloud credentials. ###
modified
--- a/google-vertex-ai.md +++ b/google-vertex-ai.md @@ -50,9 +50,9 @@ Region configuration -Claude Code can be used with both Vertex AI [global](<https://cloud.google.com/blog/products/ai-machine-learning/global-endpoint-for-claude-models-generally-available-on-vertex-ai>) and regional endpoints. - -Vertex AI may not support the Claude Code default models in all [regions](<https://cloud.google.com/vertex-ai/generative-ai/docs/learn/locations#genai-partner-models>) or on [global endpoints](<https://cloud.google.com/vertex-ai/generative-ai/docs/partner-models/use-partner-models#supported_models>). You may need to switch to a supported region, use a regional endpoint, or specify a supported model. +Claude Code supports Vertex AI [global](<https://cloud.google.com/blog/products/ai-machine-learning/global-endpoint-for-claude-models-generally-available-on-vertex-ai>), multi-region, and regional endpoints. Set `CLOUD_ML_REGION` to `global`, a multi-region location such as `eu` or `us`, or a specific region such as `us-east5`. Claude Code selects the correct Vertex AI hostname for each form, including the `aiplatform.eu.rep.googleapis.com` and `aiplatform.us.rep.googleapis.com` hosts for multi-region locations. + +Vertex AI may not support the Claude Code default models on every endpoint type. Model availability varies across [specific regions](<https://cloud.google.com/vertex-ai/generative-ai/docs/learn/locations#genai-partner-models>), multi-region locations, and [global endpoints](<https://cloud.google.com/vertex-ai/generative-ai/docs/partner-models/use-partner-models#supported_models>). You may need to switch to a supported location or specify a supported model. ## @@ -193,10 +193,10 @@ If you encounter “model not found” 404 errors: * Confirm model is Enabled in [Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) - * Verify you have access to the specified region + * Verify the model is available in the location you specified. Some models are offered only on `global` or multi-region locations such as `eu` and `us`, not in specific regions * If using `CLOUD_ML_REGION=global`, check that your models support global endpoints in [Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) under “Supported features”. For models that don’t support global endpoints, either: * Specify a supported model via `ANTHROPIC_MODEL` or `ANTHROPIC_DEFAULT_HAIKU_MODEL`, or - * Set a regional endpoint using `VERTEX_REGION_<MODEL_NAME>` environment variables + * Set a region or multi-region location using `VERTEX_REGION_<MODEL_NAME>` environment variables If you encounter 429 errors:
modified
--- a/google-vertex-ai.md +++ b/google-vertex-ai.md @@ -132,9 +132,9 @@ Pin specific model versions when deploying to multiple users. Without pinning, model aliases such as `sonnet` and `opus` resolve to the latest version, which may not yet be enabled in your Vertex AI project when Anthropic releases an update. Claude Code falls back to the previous version at startup when the latest is unavailable, but pinning lets you control when your users move to a new model. -Set these environment variables to specific Vertex AI model IDs: - - export ANTHROPIC_DEFAULT_OPUS_MODEL='claude-opus-4-6' +Set these environment variables to specific Vertex AI model IDs. Without `ANTHROPIC_DEFAULT_OPUS_MODEL`, the `opus` alias on Vertex resolves to Opus 4.6. Set it to the Opus 4.7 ID to use the latest model: + + export ANTHROPIC_DEFAULT_OPUS_MODEL='claude-opus-4-7' export ANTHROPIC_DEFAULT_SONNET_MODEL='claude-sonnet-4-6' export ANTHROPIC_DEFAULT_HAIKU_MODEL='claude-haiku-4-5@20251001' @@ -147,7 +147,7 @@ To customize models further: - export ANTHROPIC_MODEL='claude-opus-4-6' + export ANTHROPIC_MODEL='claude-opus-4-7' export ANTHROPIC_DEFAULT_HAIKU_MODEL='claude-haiku-4-5@20251001' ## @@ -178,7 +178,7 @@ 1M token context window -Claude Opus 4.6, Sonnet 4.6, Sonnet 4.5, and Sonnet 4 support the [1M token context window](<https://platform.claude.com/docs/en/build-with-claude/context-windows#1m-token-context-window>) on Vertex AI. Claude Code automatically enables the extended context window when you select a 1M model variant. To enable the 1M context window for your pinned model, append `[1m]` to the model ID. See [Pin models for third-party deployments](</docs/en/model-config#pin-models-for-third-party-deployments>) for details. +Claude Opus 4.7, Opus 4.6, and Sonnet 4.6 support the [1M token context window](<https://platform.claude.com/docs/en/build-with-claude/context-windows#1m-token-context-window>) on Vertex AI. Claude Code automatically enables the extended context window when you select a 1M model variant. The setup wizard offers a 1M context option when it pins models. To enable it for a manually pinned model instead, append `[1m]` to the model ID. See [Pin models for third-party deployments](</docs/en/model-config#pin-models-for-third-party-deployments>) for details. ##
modified
--- a/google-vertex-ai.md +++ b/google-vertex-ai.md @@ -12,13 +12,43 @@ * Google Cloud SDK (`gcloud`) installed and configured * Quota allocated in desired GCP region -If you are deploying Claude Code to multiple users, pin your model versions to prevent breakage when Anthropic releases new models. - -## - -​ - -Region Configuration +To sign in with your own Vertex AI credentials, follow Sign in with Vertex AI below. To deploy Claude Code across a team, use the manual setup steps and pin your model versions before rolling out. + +## + +​ + +Sign in with Vertex AI + +If you have Google Cloud credentials and want to start using Claude Code through Vertex AI, the login wizard walks you through it. You complete the GCP-side prerequisites once per project; the wizard handles the Claude Code side. + +The Vertex AI setup wizard requires Claude Code v2.1.98 or later. Run `claude --version` to check. + +1 + +Enable Claude models in your GCP project + +Enable the Vertex AI API for your project, then request access to the Claude models you want in the [Vertex AI Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>). See IAM configuration for the permissions your account needs. + +2 + +Start Claude Code and choose Vertex AI + +Run `claude`. At the login prompt, select **3rd-party platform** , then **Google Vertex AI**. + +3 + +Follow the wizard prompts + +Choose how you authenticate to Google Cloud: Application Default Credentials from `gcloud`, a service account key file, or credentials already in your environment. The wizard detects your project and region, verifies which Claude models your project can invoke, and lets you pin them. It saves the result to the `env` block of your [user settings file](</docs/en/settings>), so you don’t need to export environment variables yourself. + +After you’ve signed in, run `/setup-vertex` any time to reopen the wizard and change your credentials, project, region, or model pins. + +## + +​ + +Region configuration Claude Code can be used with both Vertex AI [global](<https://cloud.google.com/blog/products/ai-machine-learning/global-endpoint-for-claude-models-generally-available-on-vertex-ai>) and regional endpoints. @@ -28,7 +58,9 @@ ​ -Setup +Set up manually + +To configure Vertex AI through environment variables instead of the wizard, for example in CI or a scripted enterprise rollout, follow the steps below. ### @@ -98,7 +130,7 @@ 5\. Pin model versions -Pin specific model versions for every deployment. If you use model aliases (`sonnet`, `opus`, `haiku`) without pinning, Claude Code may attempt to use a newer model version that isn’t enabled in your Vertex AI project, breaking existing users when Anthropic releases updates. +Pin specific model versions when deploying to multiple users. Without pinning, model aliases such as `sonnet` and `opus` resolve to the latest version, which may not yet be enabled in your Vertex AI project when Anthropic releases an update. Claude Code falls back to the previous version at startup when the latest is unavailable, but pinning lets you control when your users move to a new model. Set these environment variables to specific Vertex AI model IDs: @@ -117,6 +149,14 @@ export ANTHROPIC_MODEL='claude-opus-4-6' export ANTHROPIC_DEFAULT_HAIKU_MODEL='claude-haiku-4-5@20251001' + +## + +​ + +Startup model checks + +When Claude Code starts with Vertex AI configured, it verifies that the models it intends to use are accessible in your project. This check requires Claude Code v2.1.98 or later. If you have pinned a model version that is older than the current Claude Code default, and your project can invoke the newer version, Claude Code prompts you to update the pin. Accepting writes the new model ID to your [user settings file](</docs/en/settings>) and restarts Claude Code. Declining is remembered until the next default version change. If you have not pinned a model and the current default is unavailable in your project, Claude Code falls back to the previous version for the current session and shows a notice. The fallback is not persisted. Enable the newer model in [Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) or pin a version to make the choice permanent. ##
modified
--- a/google-vertex-ai.md +++ b/google-vertex-ai.md @@ -90,7 +90,7 @@ export VERTEX_REGION_CLAUDE_HAIKU_4_5=us-east5 export VERTEX_REGION_CLAUDE_4_6_SONNET=europe-west1 -Each model version has its own `VERTEX_REGION_CLAUDE_*` variable. See the [Environment variables reference](</docs/en/env-vars>) for the full list. Check [Vertex Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) to determine which models support global endpoints versus regional only. [Prompt caching](<https://platform.claude.com/docs/en/build-with-claude/prompt-caching>) is automatically supported when you specify the `cache_control` ephemeral flag. To disable it, set `DISABLE_PROMPT_CACHING=1`. For heightened rate limits, contact Google Cloud support. When using Vertex AI, the `/login` and `/logout` commands are disabled since authentication is handled through Google Cloud credentials. +Most model versions have a corresponding `VERTEX_REGION_CLAUDE_*` variable. See the [Environment variables reference](</docs/en/env-vars>) for the full list. Check [Vertex Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) to determine which models support global endpoints versus regional only. [Prompt caching](<https://platform.claude.com/docs/en/build-with-claude/prompt-caching>) is automatically supported when you specify the `cache_control` ephemeral flag. To disable it, set `DISABLE_PROMPT_CACHING=1`. For heightened rate limits, contact Google Cloud support. When using Vertex AI, the `/login` and `/logout` commands are disabled since authentication is handled through Google Cloud credentials. ### @@ -110,7 +110,7 @@ Model type| Default value ---|--- -Primary model| `claude-sonnet-4-6` +Primary model| `claude-sonnet-4-5@20250929` Small/fast model| `claude-haiku-4-5@20251001` To customize models further:
modified
--- a/google-vertex-ai.md +++ b/google-vertex-ai.md @@ -80,20 +80,17 @@ export CLOUD_ML_REGION=global export ANTHROPIC_VERTEX_PROJECT_ID=YOUR-PROJECT-ID + # Optional: Override the Vertex endpoint URL for custom endpoints or gateways + # export ANTHROPIC_VERTEX_BASE_URL=https://aiplatform.googleapis.com + # Optional: Disable prompt caching if needed export DISABLE_PROMPT_CACHING=1 - # When CLOUD_ML_REGION=global, override region for unsupported models - export VERTEX_REGION_CLAUDE_3_5_HAIKU=us-east5 + # When CLOUD_ML_REGION=global, override region for models that don't support global endpoints + export VERTEX_REGION_CLAUDE_HAIKU_4_5=us-east5 + export VERTEX_REGION_CLAUDE_4_6_SONNET=europe-west1 - # Optional: Override regions for other specific models - export VERTEX_REGION_CLAUDE_3_5_SONNET=us-east5 - export VERTEX_REGION_CLAUDE_3_7_SONNET=us-east5 - export VERTEX_REGION_CLAUDE_4_0_OPUS=europe-west1 - export VERTEX_REGION_CLAUDE_4_0_SONNET=us-east5 - export VERTEX_REGION_CLAUDE_4_1_OPUS=europe-west1 - -[Prompt caching](<https://platform.claude.com/docs/en/build-with-claude/prompt-caching>) is automatically supported when you specify the `cache_control` ephemeral flag. To disable it, set `DISABLE_PROMPT_CACHING=1`. For heightened rate limits, contact Google Cloud support. When using Vertex AI, the `/login` and `/logout` commands are disabled since authentication is handled through Google Cloud credentials. +Each model version has its own `VERTEX_REGION_CLAUDE_*` variable. See the [Environment variables reference](</docs/en/env-vars>) for the full list. Check [Vertex Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) to determine which models support global endpoints versus regional only. [Prompt caching](<https://platform.claude.com/docs/en/build-with-claude/prompt-caching>) is automatically supported when you specify the `cache_control` ephemeral flag. To disable it, set `DISABLE_PROMPT_CACHING=1`. For heightened rate limits, contact Google Cloud support. When using Vertex AI, the `/login` and `/logout` commands are disabled since authentication is handled through Google Cloud credentials. ###
modified
--- a/google-vertex-ai.md +++ b/google-vertex-ai.md @@ -38,12 +38,6 @@ Enable the Vertex AI API in your GCP project: -Report incorrect code - -Copy - -Ask AI - # Set your project ID gcloud config set project YOUR-PROJECT-ID @@ -81,12 +75,6 @@ Set the following environment variables: -Report incorrect code - -Copy - -Ask AI - # Enable Vertex AI integration export CLAUDE_CODE_USE_VERTEX=1 export CLOUD_ML_REGION=global @@ -117,12 +105,6 @@ Set these environment variables to specific Vertex AI model IDs: -Report incorrect code - -Copy - -Ask AI - export ANTHROPIC_DEFAULT_OPUS_MODEL='claude-opus-4-6' export ANTHROPIC_DEFAULT_SONNET_MODEL='claude-sonnet-4-6' export ANTHROPIC_DEFAULT_HAIKU_MODEL='claude-haiku-4-5@20251001' @@ -135,12 +117,6 @@ Small/fast model| `claude-haiku-4-5@20251001` To customize models further: - -Report incorrect code - -Copy - -Ask AI export ANTHROPIC_MODEL='claude-opus-4-6' export ANTHROPIC_DEFAULT_HAIKU_MODEL='claude-haiku-4-5@20251001'
added
Show diff (204 lines)
--- a/google-vertex-ai.md +++ b/google-vertex-ai.md @@ -0,0 +1,201 @@ +## + +​ + +Prerequisites + +Before configuring Claude Code with Vertex AI, ensure you have: + + * A Google Cloud Platform (GCP) account with billing enabled + * A GCP project with Vertex AI API enabled + * Access to desired Claude models (for example, Claude Sonnet 4.6) + * Google Cloud SDK (`gcloud`) installed and configured + * Quota allocated in desired GCP region + +If you are deploying Claude Code to multiple users, pin your model versions to prevent breakage when Anthropic releases new models. + +## + +​ + +Region Configuration + +Claude Code can be used with both Vertex AI [global](<https://cloud.google.com/blog/products/ai-machine-learning/global-endpoint-for-claude-models-generally-available-on-vertex-ai>) and regional endpoints. + +Vertex AI may not support the Claude Code default models in all [regions](<https://cloud.google.com/vertex-ai/generative-ai/docs/learn/locations#genai-partner-models>) or on [global endpoints](<https://cloud.google.com/vertex-ai/generative-ai/docs/partner-models/use-partner-models#supported_models>). You may need to switch to a supported region, use a regional endpoint, or specify a supported model. + +## + +​ + +Setup + +### + +​ + +1\. Enable Vertex AI API + +Enable the Vertex AI API in your GCP project: + +Report incorrect code + +Copy + +Ask AI + + # Set your project ID + gcloud config set project YOUR-PROJECT-ID + + # Enable Vertex AI API + gcloud services enable aiplatform.googleapis.com + +### + +​ + +2\. Request model access + +Request access to Claude models in Vertex AI: + + 1. Navigate to the [Vertex AI Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) + 2. Search for “Claude” models + 3. Request access to desired Claude models (for example, Claude Sonnet 4.6) + 4. Wait for approval (may take 24-48 hours) + +### + +​ + +3\. Configure GCP credentials + +Claude Code uses standard Google Cloud authentication. For more information, see [Google Cloud authentication documentation](<https://cloud.google.com/docs/authentication>). + +When authenticating, Claude Code will automatically use the project ID from the `ANTHROPIC_VERTEX_PROJECT_ID` environment variable. To override this, set one of these environment variables: `GCLOUD_PROJECT`, `GOOGLE_CLOUD_PROJECT`, or `GOOGLE_APPLICATION_CREDENTIALS`. + +### + +​ + +4\. Configure Claude Code + +Set the following environment variables: + +Report incorrect code + +Copy + +Ask AI + + # Enable Vertex AI integration + export CLAUDE_CODE_USE_VERTEX=1 + export CLOUD_ML_REGION=global + export ANTHROPIC_VERTEX_PROJECT_ID=YOUR-PROJECT-ID + + # Optional: Disable prompt caching if needed + export DISABLE_PROMPT_CACHING=1 + + # When CLOUD_ML_REGION=global, override region for unsupported models + export VERTEX_REGION_CLAUDE_3_5_HAIKU=us-east5 + + # Optional: Override regions for other specific models + export VERTEX_REGION_CLAUDE_3_5_SONNET=us-east5 + export VERTEX_REGION_CLAUDE_3_7_SONNET=us-east5 + export VERTEX_REGION_CLAUDE_4_0_OPUS=europe-west1 + export VERTEX_REGION_CLAUDE_4_0_SONNET=us-east5 + export VERTEX_REGION_CLAUDE_4_1_OPUS=europe-west1 + +[Prompt caching](<https://platform.claude.com/docs/en/build-with-claude/prompt-caching>) is automatically supported when you specify the `cache_control` ephemeral flag. To disable it, set `DISABLE_PROMPT_CACHING=1`. For heightened rate limits, contact Google Cloud support. When using Vertex AI, the `/login` and `/logout` commands are disabled since authentication is handled through Google Cloud credentials. + +### + +​ + +5\. Pin model versions + +Pin specific model versions for every deployment. If you use model aliases (`sonnet`, `opus`, `haiku`) without pinning, Claude Code may attempt to use a newer model version that isn’t enabled in your Vertex AI project, breaking existing users when Anthropic releases updates. + +Set these environment variables to specific Vertex AI model IDs: + +Report incorrect code + +Copy + +Ask AI + + export ANTHROPIC_DEFAULT_OPUS_MODEL='claude-opus-4-6' + export ANTHROPIC_DEFAULT_SONNET_MODEL='claude-sonnet-4-6' + export ANTHROPIC_DEFAULT_HAIKU_MODEL='claude-haiku-4-5@20251001' + +For current and legacy model IDs, see [Models overview](<https://platform.claude.com/docs/en/about-claude/models/overview>). See [Model configuration](</docs/en/model-config#pin-models-for-third-party-deployments>) for the full list of environment variables. Claude Code uses these default models when no pinning variables are set: + +Model type| Default value +---|--- +Primary model| `claude-sonnet-4-6` +Small/fast model| `claude-haiku-4-5@20251001` + +To customize models further: + +Report incorrect code + +Copy + +Ask AI + + export ANTHROPIC_MODEL='claude-opus-4-6' + export ANTHROPIC_DEFAULT_HAIKU_MODEL='claude-haiku-4-5@20251001' + +## + +​ + +IAM configuration + +Assign the required IAM permissions: The `roles/aiplatform.user` role includes the required permissions: + + * `aiplatform.endpoints.predict` \- Required for model invocation and token counting + +For more restrictive permissions, create a custom role with only the permissions above. For details, see [Vertex IAM documentation](<https://cloud.google.com/vertex-ai/docs/general/access-control>). + +Create a dedicated GCP project for Claude Code to simplify cost tracking and access control. + +## + +​ + +1M token context window + +Claude Opus 4.6, Sonnet 4.6, Sonnet 4.5, and Sonnet 4 support the [1M token context window](<https://platform.claude.com/docs/en/build-with-claude/context-windows#1m-token-context-window>) on Vertex AI. Claude Code automatically enables the extended context window when you select a 1M model variant. To enable the 1M context window for your pinned model, append `[1m]` to the model ID. See [Pin models for third-party deployments](</docs/en/model-config#pin-models-for-third-party-deployments>) for details. + +## + +​ + +Troubleshooting + +If you encounter quota issues: + + * Check current quotas or request quota increase through [Cloud Console](<https://cloud.google.com/docs/quotas/view-manage>) + +If you encounter “model not found” 404 errors: + + * Confirm model is Enabled in [Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) + * Verify you have access to the specified region + * If using `CLOUD_ML_REGION=global`, check that your models support global endpoints in [Model Garden](<https://console.cloud.google.com/vertex-ai/model-garden>) under “Supported features”. For models that don’t support global endpoints, either: + * Specify a supported model via `ANTHROPIC_MODEL` or `ANTHROPIC_DEFAULT_HAIKU_MODEL`, or + * Set a regional endpoint using `VERTEX_REGION_<MODEL_NAME>` environment variables + +If you encounter 429 errors: + + * For regional endpoints, ensure the primary model and small/fast model are supported in your selected region + * Consider switching to `CLOUD_ML_REGION=global` for better availability + +## + +​ + +Additional resources + + * [Vertex AI documentation](<https://cloud.google.com/vertex-ai/docs>) + * [Vertex AI pricing](<https://cloud.google.com/vertex-ai/pricing>) + * [Vertex AI quotas and limits](<https://cloud.google.com/vertex-ai/docs/quotas>)