stacklok / stacklok/mecatl

feat: Add Vertex AI provider for Claude models via Google ADC

Open
#1,653 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
152
Forks
16
Avg merge
14h 48m
Merged PRs (30d)
536

Description

Problem

mecatl cannot use Claude models hosted on Google Vertex AI. Vertex AI serves Claude via the Anthropic Messages API but requires Google Application Default Credentials (ADC) instead of an Anthropic API key, and routes through Vertex-specific endpoints (publishers/anthropic/models/{model}) rather than api.anthropic.com.

Attempting to use a Claude model on Vertex AI today requires a workaround outside mecatl because the existing anthropic provider only supports direct Anthropic API key authentication.

Proposed approach

The anthropic-sdk-go already ships vertex.WithGoogleAuth() and vertex.WithCredentials() (source), which handle ADC token injection and URL path rewriting (/v1/messages → Vertex-specific endpoints) transparently. The implementation adds a new registry entry that constructs the existing provider/anthropic adapter with Vertex options — no new wire-protocol translation needed.

Changes
  1. provider/anthropic/ — add Vertex construction Options wrapping anthropic-sdk-go/vertex (WithGoogleAuth + WithCredentials). The Vertex options are adapter-construction-time only, consistent with the existing pattern where provider-private knobs are Options, not LLMRequest fields.
  2. internal/app/registry.go — new vertexai-anthropic registry entry, constructed when GOOGLE_CLOUD_PROJECT is set. Reuses the Anthropic adapter with Vertex options.
  3. internal/cliconfig/ — wire GOOGLE_CLOUD_PROJECT and GOOGLE_CLOUD_LOCATION (default us-central1) environment variables into ProviderCredentials.
Authentication

Standard Google ADC — the same credential chain used by all Google Cloud SDKs:

  • Local development: gcloud auth application-default login
  • GKE/Cloud Run: workload identity (automatic)
  • Elsewhere: GOOGLE_APPLICATION_CREDENTIALS env var pointing to a service account key

No API key required.

Usage
--model vertexai-anthropic:claude-sonnet-4-6
Out of scope (initial)

Non-Claude Vertex AI models (Gemini, Llama, Mistral, etc.) use different wire protocols (Google generateContent API or OpenAI-compatible Chat Completions). These can follow as separate providers in future work.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reading provider/anthropic/, internal/app/registry.go, and internal/cliconfig/ to trace provider construction and credential wiring. Check the anthropic-sdk-go vertex options and existing provider Option patterns before implementing the adapter construction. Done means vertexai-anthropic accepts Claude model names, uses Google ADC, and reads GOOGLE_CLOUD_PROJECT plus GOOGLE_CLOUD_LOCATION with the stated default.

Written by the indexing model from the issue text.

Assessment

Tech stack
go, google-cloud
Domain
backend, cli, cloud
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.