← Back to PRs

#13407: feat: add Anthropic Vertex AI provider extension

by roccolangeweg open 2026-02-10 13:41 View on GitHub →
docs agents stale
## Summary Adds support for Anthropic Claude models (Opus 4.6, Sonnet 4.5) via Google Cloud Vertex AI as an OpenClaw extension plugin. **Problem**: OpenClaw supports Claude via direct Anthropic API and Gemini via Vertex AI, but not Claude via Vertex AI. Using Claude through a GCP project with service account authentication avoids requiring direct Anthropic API keys. **Solution**: A new extension plugin (`vertex-anthropic-auth`) that: - Registers a custom `anthropic-vertex-messages` API type with streaming functions adapted from pi-ai's Anthropic provider - Uses `@anthropic-ai/vertex-sdk` (`AnthropicVertex`) for Vertex AI endpoint routing and Google Cloud OAuth - Authenticates via `google-auth-library` supporting service account keys, `GOOGLE_APPLICATION_CREDENTIALS`, and gcloud ADC - Bridges plugin-registered providers into the model resolution pipeline (`models-config.ts`) and the pi-ai API registry **Core changes to OpenClaw** (beyond the extension): - `src/agents/models-config.ts`: Plugin providers are now integrated into `ensureOpenClawModelsJson`, including registering custom API streaming providers from the ESM context (solving the jiti/ESM module instance mismatch) - `src/plugins/types.ts`: Added optional `apiProvider` field to `ProviderPlugin` for carrying stream functions ## Test plan - [x] Direct streaming test: `streamAnthropicVertex` with Sonnet text response - [x] Direct streaming test: `streamSimpleAnthropicVertex` with Opus thinking/reasoning - [x] `openclaw agent --local` with `vertex-anthropic/claude-sonnet-4-5@20250929` - text response - [x] `openclaw agent --local` with `--thinking medium` - reasoning mode - [x] Auth profile resolution via auth-profiles.json (token type with `vertex-ai-managed` placeholder) - [ ] Service account key file authentication (`SERVICE_ACCOUNT_KEY_FILE`) - [ ] Token auto-refresh (google-auth-library handles internally)

Most Similar PRs