graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs
Python
anthropic: the model list authenticates a Console sign-in with Bearer too
justrach215fec6baaa9
diff --git a/src/anthropic_profile.zig b/src/anthropic_profile.zigindex 3fcbab12..f7c2060a 100644--- a/src/anthropic_profile.zig+++ b/src/anthropic_profile.zig@@ -310,4 +310,9 @@ test "an expiring Console token is refreshed through ant, and sent as a bearer ttry testing.expectEqual(provider_mod.Provider.Auth.bearer, p.auth);const api_key = keys.build(provider_mod.specFor("anthropic").?, "sk-ant-api03-k", "claude-opus-5-5");try testing.expectEqual(provider_mod.Provider.Auth.x_api_key, api_key.auth);+ // The model list (router_catalog) authenticates the same way.+ var hb: [4]std.http.Header = undefined;+ const hs = @import("router_catalog.zig").catalogHeaders(a, provider_mod.specFor("anthropic").?, "sk-ant-oat01-new", .login, &hb).?;+ try testing.expectEqualStrings("Authorization", hs[1].name);+ try testing.expectEqualStrings("Bearer sk-ant-oat01-new", hs[1].value);}diff --git a/src/router_catalog.zig b/src/router_catalog.zigindex ee20805d..a8ca909c 100644--- a/src/router_catalog.zig+++ b/src/router_catalog.zig@@ -225,14 +225,14 @@ pub fn parseModels(arena: Allocator, provider_id: []const u8, data: []const u8)};}-/// Catalog GET auth mirrors the provider's chat auth: OpenAI-style routers-/// take a bearer token; Anthropic's /v1/models wants the same x-api-key +-/// anthropic-version pair as the Messages endpoint itself. xAI OAuth user-/// tokens also need X-XAI-Token-Auth (same as chat — GrokAuthCredentials).+/// Catalog GET auth mirrors chat auth: Bearer for OpenAI-style routers and an+/// Anthropic Console sign-in (ADR 0281); an Anthropic API key sends x-api-key ++/// anthropic-version. xAI OAuth user tokens also need X-XAI-Token-Auth.pub fn catalogHeaders(arena: Allocator, spec: provider.ProviderSpec, key: []const u8, source: provider.Keys.CredentialSource, buf: *[4]std.http.Header) ?[]const std.http.Header {buf[0] = .{ .name = "Accept", .value = "application/json" };if (spec.auth == .x_api_key) {- buf[1] = .{ .name = "x-api-key", .value = key };+ const console = @import("anthropic_profile.zig").bearerToken(spec.id, key);+ buf[1] = if (console) .{ .name = "Authorization", .value = std.fmt.allocPrint(arena, "Bearer {s}", .{key}) catch return null } else .{ .name = "x-api-key", .value = key };buf[2] = .{ .name = "anthropic-version", .value = root.anthropic_version };return buf[0..3];}