Skip to content

feat: Add Anthropic Claude models via Google Vertex AI #91

@jgallinari

Description

@jgallinari

feat: Add Anthropic Claude models via Google Vertex AI

Summary

Add support for using Anthropic Claude models through Google Cloud Vertex AI, similar to the existing Amazon Bedrock provider (amazon-bedrock.ts).

Currently, Claude models are only available via direct Anthropic API (ANTHROPIC_API_KEY). Many organizations access Claude exclusively through Vertex AI and don't have direct Anthropic API keys.

Motivation

  • Google Vertex AI is one of the two major cloud provider channels for Claude (alongside AWS Bedrock)
  • Bedrock is already supported — Vertex AI is the missing counterpart
  • Organizations using GCP often mandate Vertex AI for compliance, billing, and access control
  • The existing google-vertex.ts provider handles Gemini models but not Anthropic models on the same platform

Proposed implementation

Based on the existing codebase patterns:

1. New provider: anthropic-vertex.ts

Similar to amazon-bedrock.ts, this would wrap the Anthropic Messages API but authenticate via Google Cloud ADC instead of ANTHROPIC_API_KEY. Could use either:

  • @anthropic-ai/vertex-sdk (official Anthropic Vertex SDK)
  • The base Anthropic SDK with the Vertex AI base URL: https://{LOCATION}-aiplatform.googleapis.com/v1/projects/{PROJECT}/locations/{LOCATION}/publishers/anthropic/

Message format and streaming events are identical to the direct Anthropic API, so most of the conversion logic from anthropic.ts can be reused.

2. New API type in stream.ts

Register e.g. anthropic-vertex-messages in the dispatch switch, bypassing API key validation (like google-vertex and amazon-bedrock already do) and calling the new streaming function.

3. Model entries in models.json

Mirror existing Anthropic model entries under a new provider (e.g. anthropic-vertex) with api: "anthropic-vertex-messages".

4. Authentication & environment variables

Reuse the same pattern as google-vertex.ts:

  • GOOGLE_CLOUD_PROJECT (or GCLOUD_PROJECT)
  • GOOGLE_CLOUD_LOCATION
  • Application Default Credentials via gcloud auth application-default login

References

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions