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:"4096"
Default maximum tokens for completions. Can be overridden per request.

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, and image input for the model ID. See the Anthropic model capabilities section for their semantics.

Examples

Basic chat

Streaming

Provider-specific options and reasoning

Provider options are namespaced under anthropic in providerOptions, matching @core-ai/anthropic:
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