graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs
0281. Anthropic Console sign-in reads the SDK's profile
Status: accepted 2026-10-11
Context
Claude models on graff needed ANTHROPIC_API_KEY. Users with an Anthropic
Console account wanted to sign in instead and spend that account's API credits.
Anthropic does not allow third-party products to offer a claude.ai
(subscription) login, so that credential is out of scope. A Console sign-in
is offered through Anthropic's own CLI (ant auth login). It writes a
user_oauth profile that Anthropic's SDKs read as a credential.
Decision
- graff reads the same profile the SDKs read, in their order. The directory
is
ANTHROPIC_CONFIG_DIR, then%APPDATA%\Anthropic, then$XDG_CONFIG_HOME/anthropic, then~/.config/anthropic. The profile isANTHROPIC_PROFILE, thenactive_config, thendefault. - Only
user_oauthprofiles for the default API host are used. Federation profiles and profiles that set anotherbase_urlare left alone. - Precedence:
ANTHROPIC_API_KEYwins and profiles are not read (the SDK's rule). A profile named byANTHROPIC_PROFILEoutranks a key stored withgraff key. The active profile fills in only when nothing else did. - The token is sent as
Authorization: Bearer; API keys keepx-api-key. - graff never runs Anthropic's OAuth client itself. Before each request it
re-reads the credentials file. Within two minutes of expiry, or after an
auth error, it runs
ant auth print-credentials --access-token, which refreshes and rewrites the file.graff login anthropicrunsant auth login, or prints how to installant. - Billing is metered: the sign-in spends the workspace's API credits, not a flat-rate plan.
Consequences
A Console account works without creating a key, and a sign-in made for the
SDK or Claude Code is picked up by graff too. Refresh needs ant on PATH.
Without it, an expired token fails with the provider's auth error until
ant auth login is run again.