Skip to main content

Overview

The Vertex AI Anthropic provider connects core-ai to Claude models hosted on Google Vertex AI through the official @anthropic-ai/vertex-sdk client. It shares its request, streaming, tool-calling, structured-output, and reasoning behavior with @core-ai/anthropic — everything documented on the Anthropic Provider page applies equally here.

Installation

createAnthropicVertex()

Create a Vertex AI Anthropic provider instance.

Options

string
Your Google Cloud project id. Required unless client is provided.
string
The Vertex AI region hosting the Claude model, for example europe-west1 or eu. Required unless client is provided. A provider instance targets a single region — create separate providers if you need models hosted in different regions.
object
A parsed Google service account JSON key. When omitted, the provider falls back to Application Default Credentials (ADC).
AnthropicChatClient
Provide your own configured client (for example a custom AnthropicVertex instance).
number
Default output limit for requests that omit maxTokens. When unset, each request uses the model’s output ceiling. See Output limits.

Returns

AnthropicVertexProvider with method chatModel().

Authentication

By default, the provider uses Application Default Credentials:
To authenticate with an explicit service account instead, parse the service account JSON and pass the resulting object as credentials:
GOOGLE_APPLICATION_CREDENTIALS_JSON accepts either plain JSON or base64-encoded JSON. This is separate from Google’s standard GOOGLE_APPLICATION_CREDENTIALS env var, which points to a credentials file path for ADC.
You can also inject a preconfigured client:

Model IDs and regions

Pass the Vertex model id (as listed in the Vertex AI Model Garden) to chatModel(). Model availability and naming vary by region — some Claude models are published to Vertex AI’s eu multi-region while others are published to region-specific endpoints such as europe-west1. Since a provider instance targets a single region, create separate providers for models hosted in different regions:
Pass the unversioned Vertex model id (e.g. claude-sonnet-4-6) rather than a version-pinned id (e.g. claude-sonnet-4-6@20250929). Reasoning effort and sampling-restriction capability detection (getAnthropicModelCapabilities and friends in @core-ai/anthropic) only recognizes the unversioned form today, so a version-pinned id silently falls back to standard capabilities instead of the model’s actual ones.

Provider support

Model capabilities

Vertex-hosted Claude models use the same capability definitions as the direct Anthropic provider:
The capability fields describe reasoning effort, sampling constraints, tool choices, image input, and system message placement for the model ID. See the Anthropic model capabilities section for their semantics.

Strict tool schemas

Per-tool strict: true follows the model capabilities of the underlying Anthropic provider: Claude 4.5 and later models report { supported: true, maxStrictTools: 20, maxUnionParameters: 16 }. There is no provider-level switch — the strictToolSchemasEnabled option was removed. See Anthropic strict tool schemas and the tool-calling guide.
Vertex AI gates this feature through the Google Cloud organization policy constraints/vertexai.allowedPartnerModelFeatures. The policy must allow the structured_outputs feature for your project, or Vertex rejects requests containing strict tools with an org-policy violation error naming that constraint. Core-ai cannot detect this account-level state, so model.capabilities.tools.strictSchemas reports model support regardless of your organization policy.

Tool discovery

Vertex-hosted Claude models report tools.toolDiscovery like the direct Anthropic provider: 'native' for Claude 4.5 and later models, 'emulated' for older ones. To force emulation, set emulateToolDiscovery: true under the anthropic-vertex key:
See Anthropic tool discovery and the Tool Discovery guide.

Examples

Basic chat

Streaming

Provider-specific options and reasoning

Provider options are namespaced under anthropic-vertex in providerOptions and accept the same fields as @core-ai/anthropic. Options under the anthropic key are ignored:
System, user, tool result, and discovery result messages take their options under the same key. For example, set a per-message cache breakpoint with providerOptions: { 'anthropic-vertex': { cacheControl: { type: 'ephemeral', ttl: '1h' } } } on any of them. See the Anthropic Provider docs for the full list of available fields, reasoning restrictions, and prompt-caching behavior — they apply unchanged to Vertex-hosted Claude models.

Error handling

Errors are attributed to provider id anthropic-vertex, distinguishing them from direct @core-ai/anthropic errors (anthropic).

Anthropic Provider

Claude models via the direct Anthropic API

Google GenAI Provider

Gemini models with multimodal support

Chat Completion Guide

Learn how to use chat completion