Skip to content

Allow Claude model requests to route through Google Vertex AI#23985

Merged
vincentkoc merged 11 commits intoopenclaw:mainfrom
sallyom:vertex-anthropic
Feb 23, 2026
Merged

Allow Claude model requests to route through Google Vertex AI#23985
vincentkoc merged 11 commits intoopenclaw:mainfrom
sallyom:vertex-anthropic

Conversation

@sallyom
Copy link
Contributor

@sallyom sallyom commented Feb 22, 2026

Summary

Describe the problem and fix in 2–5 bullets:

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

User-visible / Behavior Changes

  1. New provider: anthropic-vertex — Users can now route Claude model requests through Google Vertex AI instead of the direct Anthropic API. This lets
    organizations bill Claude usage through their existing GCP projects/agreements.
  2. Auto-discovery — When GOOGLE_CLOUD_PROJECT and GOOGLE_CLOUD_LOCATION env vars are set, three Claude models automatically appear in the model catalog:
    Claude Sonnet 4.5, Claude Opus 4.5, and Claude Haiku 3.5. No manual config needed.
  3. New model ref format — Users can set "primary": "anthropic-vertex/claude-sonnet-4-5" in their agent config to target Claude via Vertex.
  4. GCP ADC authentication — Auth resolves via Google Application Default Credentials (service account JSON), same mechanism as the existing google-vertex
    (Gemini) provider. Supports GOOGLE_APPLICATION_CREDENTIALS, ANTHROPIC_VERTEX_PROJECT_ID, and CLOUD_ML_REGION env vars.
  5. Full streaming support — Text, extended thinking/reasoning, and tool use all stream token-by-token (not buffered).
  6. Version pinning — Users can pin Vertex model snapshots via @yyyymmdd suffixes (e.g., claude-sonnet-4-5@20250929) in manual provider config.
  7. New docs page — docs/providers/anthropic-vertex.md with setup instructions, added to the provider index.

No breaking changes. The new provider is additive and only activates when GCP env vars are present.
List user-visible changes (including defaults/config).
If none, write None.

Security Impact (required)

  • New permissions/capabilities? (Yes)
  • Secrets/tokens handling changed? (Yes)
  • New/changed network calls? (Yes)
  • Command/tool execution surface changed? (No)
  • Data access scope changed? (No)
  • If any Yes, explain risk + mitigation:

New network calls are made to https://{region}-aiplatform.googleapis.com via the @anthropic-ai/vertex-sdk. The SDK handles GCP access token acquisition and refresh internally through Application Default Credentials (reads the service account JSON at GOOGLE_APPLICATION_CREDENTIALS). No tokens are stored, logged, or passed through OpenClaw code — the SDK manages the full auth lifecycle. The risk profile is identical to the existing google-vertex (Gemini) and amazon-bedrock providers, which follow the same pattern of delegating cloud auth to their respective SDKs. The provider only activates when both GOOGLE_CLOUD_PROJECT and GOOGLE_CLOUD_LOCATION are explicitly set.

Repro + Verification

Configuration

Set two environment variables and authenticate with Google Cloud:

export GOOGLE_CLOUD_PROJECT=your-gcp-project-id
export GOOGLE_CLOUD_LOCATION=global

Authenticate via one of:

gcloud auth application-default login
export GOOGLE_APPLICATION_CREDENTIALS=/path/to/sa-key.json

The provider is automatically detected — no changes to openclaw.json are needed. Run openclaw models list to verify. To set it as the default model:

{ "agents": { "defaults": { "model": { "primary": "anthropic-vertex/claude-sonnet-4-6" } } } }

Note: Latest models (Opus 4.6, Sonnet 4.6) use plain IDs on Vertex AI. Only older models require @yyyymmdd date suffixes. I tested with claude-sonnet-4-5@20250929

Environment

  • OS: Linux
  • Runtime/container: container (CRI-O, K8s)
  • Model/provider: anthropic-vertex/claude-sonnet-4-5@20250929 (up through 4.5 need to include yyyymmdd with google-vertex/anthropic model ID)
  • Integration/channel (if any):
  • Relevant config (redacted):

Evidence

Attach at least one:

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Human Verification (required)

What you personally verified (not just CI), and how:

  • Verified scenarios:
    Set creds.json as a secret in a K8s deployment, mounted and accepted by openclaw's FS

  • What you did not verify: I only verified with the single claude-sonnet-4.5 and note: need to use the google-vertex/anthropic model ID with any model prior to 4.6

Compatibility / Migration

  • Backward compatible? (Yes)
  • Config/env changes? (Yes)
  • Migration needed? (No)
  • If yes, exact upgrade steps:
Screenshot 2026-02-22 at 5 40 23 PM Screenshot 2026-02-22 at 5 48 45 PM

Greptile Summary

This PR adds Vercel AI Gateway Claude shorthand normalization so users can write vercel-ai-gateway/claude-opus-4.6 or vercel-ai-gateway/opus-4.6 instead of the fully qualified vercel-ai-gateway/anthropic/claude-opus-4.6. The normalization reuses the existing normalizeAnthropicModelId alias resolution and only activates for model IDs that resolve to a claude-* prefix, leaving non-Claude models untouched.

  • Adds a vercel-ai-gateway branch in normalizeProviderModelId() that prepends anthropic/ to Claude shorthand refs, guarded by !model.includes("/") to avoid double-prefixing
  • Adds two unit tests covering claude-* prefixed models and alias-style shorthand (opus-4.6)
  • Documents the shorthand in docs/providers/vercel-ai-gateway.md
  • Note: The PR title and description reference Google Vertex AI routing, but the final diff only contains the Vercel AI Gateway shorthand normalization — the Vertex-specific changes were removed during the PR's evolution

Confidence Score: 4/5

  • This PR is safe to merge — small, additive normalization logic with no breaking changes.
  • The code change is minimal (7 lines of logic), follows established patterns in the codebase (mirrors the openrouter normalization block), includes unit tests, and is purely additive. The guard clause correctly prevents double-prefixing. Score is 4 rather than 5 because test coverage could be broader (e.g., testing that non-Claude models pass through unchanged, and that already-prefixed models aren't double-prefixed), and the PR description is significantly misaligned with the actual changes.
  • No files require special attention.

Last reviewed commit: b13654d

@openclaw-barnacle openclaw-barnacle bot added docs Improvements or additions to documentation agents Agent runtime and tooling size: L labels Feb 22, 2026
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

9 files reviewed, 1 comment

Edit Code Review Agent Settings | Greptile

@vincentkoc
Copy link
Member

Merge-readiness deep-dive (timeline-aware):

Current gate status:

  • CI/checks: green
  • Mergeability: CLEAN + MERGEABLE
  • Remaining blocker: one unresolved thread (empty project string will cause SDK error).

Requested final patch before merge:

  1. Validate Vertex project value before stream creation (fail fast with actionable message when empty).
  2. Add/adjust test coverage for missing project env path.
  3. Resolve the open thread after the guard lands.

Changelog/credit suggestion (when merged):

  • Changes: Providers/Vertex: add native Anthropic Vertex AI provider support for Claude models with ADC-based auth and provider config wiring. (#23985) Thanks @sallyom.
  • Attribution note in PR body/comment: Requested in #6937 by @markbooch.

If you want, I can do a final merge-gate pass immediately after the missing-project fix commit lands.

@vincentkoc
Copy link
Member

Deep-dive update complete:

  • Rebasing: branch is rebased onto latest main and force-updated.
  • Fix applied: fail-fast validation for missing Vertex project env before stream creation.
  • Review threads: all resolved.
  • Changelog: added/kept entry with contributor + reporter credit (#23985, #6937, @sallyom, @markbooch) and formatted.

Current CI note:

  • check formatting issue on CHANGELOG.md was fixed in the latest push.
  • Remaining failing job appears to be skills-python (ModuleNotFoundError: No module named 'yaml'), which looks infra/environmental and not specific to this PR diff.

@vincentkoc
Copy link
Member

Implemented now (before merge) per naming discussion:

  • Canonical provider ID is now google-vertex-claude (Google-first naming).
  • Runtime still accepts anthropic-vertex as a compatibility alias in code paths.
  • Docs were renamed/updated to Google Vertex Claude and provider index now links to /providers/google-vertex-claude.
  • Changelog wording updated accordingly.

Net effect: no post-merge migration required for the naming direction, while avoiding immediate breakage for anyone already testing with anthropic-vertex.

@openclaw-barnacle openclaw-barnacle bot added commands Command implementations size: XS and removed size: L labels Feb 23, 2026
@openclaw-barnacle openclaw-barnacle bot removed the commands Command implementations label Feb 23, 2026
@vincentkoc
Copy link
Member

@sallyom please be mindful of generating huge changes, as you can see the change required was only very very minimal.

@vincentkoc
Copy link
Member

@greptile review

@vincentkoc vincentkoc merged commit eb4ff6d into openclaw:main Feb 23, 2026
25 checks passed
jaydiamond42 pushed a commit to jaydiamond42/bloomtbot that referenced this pull request Feb 23, 2026
…aw#23985)

* feat: add anthropic-vertex provider for Claude via GCP Vertex AI

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: sallyom <somalley@redhat.com>

* docs: add anthropic-vertex provider guide

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: sallyom <somalley@redhat.com>

* Agents: validate Anthropic Vertex project env

* Changelog: format update for Vertex entry

* Providers: rename Anthropic Vertex to Google Vertex Claude

* Providers: remove Vertex Claude provider path

* Models: normalize Vercel Claude shorthand refs

* Onboarding: default Vercel model to Claude shorthand

* Changelog: add @vincentkoc credit for openclaw#23985

* Onboarding: keep canonical Vercel default model ref

* Tests: expand Vercel model normalization coverage

---------

Signed-off-by: sallyom <somalley@redhat.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
carlosrivera pushed a commit to myascendai/meshiclaw that referenced this pull request Feb 23, 2026
…aw#23985)

* feat: add anthropic-vertex provider for Claude via GCP Vertex AI

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: sallyom <somalley@redhat.com>

* docs: add anthropic-vertex provider guide

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: sallyom <somalley@redhat.com>

* Agents: validate Anthropic Vertex project env

* Changelog: format update for Vertex entry

* Providers: rename Anthropic Vertex to Google Vertex Claude

* Providers: remove Vertex Claude provider path

* Models: normalize Vercel Claude shorthand refs

* Onboarding: default Vercel model to Claude shorthand

* Changelog: add @vincentkoc credit for openclaw#23985

* Onboarding: keep canonical Vercel default model ref

* Tests: expand Vercel model normalization coverage

---------

Signed-off-by: sallyom <somalley@redhat.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
mreedr pushed a commit to mreedr/openclaw-custom that referenced this pull request Feb 24, 2026
…aw#23985)

* feat: add anthropic-vertex provider for Claude via GCP Vertex AI

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: sallyom <somalley@redhat.com>

* docs: add anthropic-vertex provider guide

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: sallyom <somalley@redhat.com>

* Agents: validate Anthropic Vertex project env

* Changelog: format update for Vertex entry

* Providers: rename Anthropic Vertex to Google Vertex Claude

* Providers: remove Vertex Claude provider path

* Models: normalize Vercel Claude shorthand refs

* Onboarding: default Vercel model to Claude shorthand

* Changelog: add @vincentkoc credit for openclaw#23985

* Onboarding: keep canonical Vercel default model ref

* Tests: expand Vercel model normalization coverage

---------

Signed-off-by: sallyom <somalley@redhat.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
@paulclarkaranz
Copy link

I'm not sure if I'm following this PR correctly, but it looks like what got merged was related to Vercel, but the initial implementation was related to Vertex AI, as are the linked issues. So I don't think this closes the linked issues.

plgs2005 pushed a commit to plgs2005/openclaw that referenced this pull request Feb 24, 2026
…aw#23985)

* feat: add anthropic-vertex provider for Claude via GCP Vertex AI

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: sallyom <somalley@redhat.com>

* docs: add anthropic-vertex provider guide

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: sallyom <somalley@redhat.com>

* Agents: validate Anthropic Vertex project env

* Changelog: format update for Vertex entry

* Providers: rename Anthropic Vertex to Google Vertex Claude

* Providers: remove Vertex Claude provider path

* Models: normalize Vercel Claude shorthand refs

* Onboarding: default Vercel model to Claude shorthand

* Changelog: add @vincentkoc credit for openclaw#23985

* Onboarding: keep canonical Vercel default model ref

* Tests: expand Vercel model normalization coverage

---------

Signed-off-by: sallyom <somalley@redhat.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
@KMilhan
Copy link

KMilhan commented Feb 24, 2026

The PR content itself is drifting inside, vertex -> vercel ... ? seems like opus confused itself haha

margulans pushed a commit to margulans/Neiron-AI-assistant that referenced this pull request Feb 25, 2026
…aw#23985)

* feat: add anthropic-vertex provider for Claude via GCP Vertex AI

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: sallyom <somalley@redhat.com>

* docs: add anthropic-vertex provider guide

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: sallyom <somalley@redhat.com>

* Agents: validate Anthropic Vertex project env

* Changelog: format update for Vertex entry

* Providers: rename Anthropic Vertex to Google Vertex Claude

* Providers: remove Vertex Claude provider path

* Models: normalize Vercel Claude shorthand refs

* Onboarding: default Vercel model to Claude shorthand

* Changelog: add @vincentkoc credit for openclaw#23985

* Onboarding: keep canonical Vercel default model ref

* Tests: expand Vercel model normalization coverage

---------

Signed-off-by: sallyom <somalley@redhat.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
@sallyom
Copy link
Contributor Author

sallyom commented Feb 25, 2026

@vincentkoc The merged PR only added Vercel AI Gateway Claude shorthand normalization (letting users write vercel-ai-gateway/claude-opus-4.6 instead of vercel-ai-gateway/anthropic/claude-opus-4.6) I actually didn't have this change in the PR. The actual Google Vertex AI provider — streaming implementation, auth wiring, provider registration, and docs — was stripped out.

This doesn't resolve the issue: #6937 - the PR solved a completely different problem than what was submitted. The Vertex provider still needs to land.

@paulclarkaranz @KMilhan I rebased against upstream/main: https://github.com/sallyom/openclaw/tree/vertex-anthropic, feel free to build off of it to test - unless I'm missing something that is what is needed to run anthropic models through google vertex ai accounts that have access to anthropic. Please confirm if possible!

brianleach pushed a commit to brianleach/openclaw that referenced this pull request Feb 26, 2026
…aw#23985)

* feat: add anthropic-vertex provider for Claude via GCP Vertex AI

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: sallyom <somalley@redhat.com>

* docs: add anthropic-vertex provider guide

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: sallyom <somalley@redhat.com>

* Agents: validate Anthropic Vertex project env

* Changelog: format update for Vertex entry

* Providers: rename Anthropic Vertex to Google Vertex Claude

* Providers: remove Vertex Claude provider path

* Models: normalize Vercel Claude shorthand refs

* Onboarding: default Vercel model to Claude shorthand

* Changelog: add @vincentkoc credit for openclaw#23985

* Onboarding: keep canonical Vercel default model ref

* Tests: expand Vercel model normalization coverage

---------

Signed-off-by: sallyom <somalley@redhat.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
@sallyom
Copy link
Contributor Author

sallyom commented Feb 26, 2026

I'll re-open the PR with my vertex-anthropic branch, here's why we still need it. @paulclarkaranz @KMilhan hopefully can confirm that I'm not missing something, ty!

[summary from Claude]
Claude on Vertex AI uses the Anthropic Messages API, not the Google Generative AI API. The existing google-vertex provider handles Gemini models only — it routes through streamSimple which speaks the Google API format. Claude models on Vertex require a separate provider that uses @anthropic-ai/vertex-sdk for authentication and implements the Anthropic Messages API streaming format (content blocks, thinking, tool_use, etc.). This is the same reason AWS Bedrock has its own dedicated provider rather than sharing one with other AWS AI services.

mylukin pushed a commit to mylukin/openclaw that referenced this pull request Feb 26, 2026
…aw#23985)

* feat: add anthropic-vertex provider for Claude via GCP Vertex AI

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: sallyom <somalley@redhat.com>

* docs: add anthropic-vertex provider guide

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: sallyom <somalley@redhat.com>

* Agents: validate Anthropic Vertex project env

* Changelog: format update for Vertex entry

* Providers: rename Anthropic Vertex to Google Vertex Claude

* Providers: remove Vertex Claude provider path

* Models: normalize Vercel Claude shorthand refs

* Onboarding: default Vercel model to Claude shorthand

* Changelog: add @vincentkoc credit for openclaw#23985

* Onboarding: keep canonical Vercel default model ref

* Tests: expand Vercel model normalization coverage

---------

Signed-off-by: sallyom <somalley@redhat.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
r4jiv007 pushed a commit to r4jiv007/openclaw that referenced this pull request Feb 28, 2026
…aw#23985)

* feat: add anthropic-vertex provider for Claude via GCP Vertex AI

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: sallyom <somalley@redhat.com>

* docs: add anthropic-vertex provider guide

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Signed-off-by: sallyom <somalley@redhat.com>

* Agents: validate Anthropic Vertex project env

* Changelog: format update for Vertex entry

* Providers: rename Anthropic Vertex to Google Vertex Claude

* Providers: remove Vertex Claude provider path

* Models: normalize Vercel Claude shorthand refs

* Onboarding: default Vercel model to Claude shorthand

* Changelog: add @vincentkoc credit for openclaw#23985

* Onboarding: keep canonical Vercel default model ref

* Tests: expand Vercel model normalization coverage

---------

Signed-off-by: sallyom <somalley@redhat.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
zooqueen pushed a commit to hanzoai/bot that referenced this pull request Mar 6, 2026
…aw#23985)

* feat: add anthropic-vertex provider for Claude via GCP Vertex AI

Signed-off-by: sallyom <somalley@redhat.com>

* docs: add anthropic-vertex provider guide

Signed-off-by: sallyom <somalley@redhat.com>

* Agents: validate Anthropic Vertex project env

* Changelog: format update for Vertex entry

* Providers: rename Anthropic Vertex to Google Vertex Claude

* Providers: remove Vertex Claude provider path

* Models: normalize Vercel Claude shorthand refs

* Onboarding: default Vercel model to Claude shorthand

* Changelog: add @vincentkoc credit for openclaw#23985

* Onboarding: keep canonical Vercel default model ref

* Tests: expand Vercel model normalization coverage

---------

Signed-off-by: sallyom <somalley@redhat.com>
Co-authored-by: Vincent Koc <vincentkoc@ieee.org>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling docs Improvements or additions to documentation size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: add anthropic-vertex provider for Claude models via Google Vertex AI [Feature]: Add Vertex AI Anthropic provider (Claude on GCP)

4 participants