From 1568c97b199d44dc6794f3ce7ba0e82caf4310ec Mon Sep 17 00:00:00 2001 From: Calum Murray Date: Wed, 18 Mar 2026 13:45:15 -0400 Subject: [PATCH] fix(anthropic): anthropic with vertex works with service account json keys (#157) Signed-off-by: Calum Murray --- providers/anthropic/anthropic.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/providers/anthropic/anthropic.go b/providers/anthropic/anthropic.go index 1a7004205dff6fee51fbcfe930de854e78ca80b5..b1bcee24cd40d6751c73dab9317e6c30c97037ed 100644 --- a/providers/anthropic/anthropic.go +++ b/providers/anthropic/anthropic.go @@ -30,6 +30,8 @@ const ( Name = "anthropic" // DefaultURL is the default URL for the Anthropic API. DefaultURL = "https://api.anthropic.com" + // VertexAuthScope is the auth scope required for vertex auth if using a Service Account JSON file (e.g. GOOGLE_APPLICATION_CREDENTIALS). + VertexAuthScope = "https://www.googleapis.com/auth/cloud-platform" ) type options struct { @@ -171,7 +173,7 @@ func (a *provider) LanguageModel(ctx context.Context, modelID string) (fantasy.L credentials = &google.Credentials{TokenSource: &googleDummyTokenSource{}} } else { var err error - credentials, err = google.FindDefaultCredentials(ctx) + credentials, err = google.FindDefaultCredentials(ctx, VertexAuthScope) if err != nil { return nil, err }