Skip to content

Accept CLAUDE_CODE_OAUTH_TOKEN for anthropic provider auth#40

Open
ChasLui wants to merge 1 commit into
sentient-agi:mainfrom
ChasLui:fix/oauth-token-support
Open

Accept CLAUDE_CODE_OAUTH_TOKEN for anthropic provider auth#40
ChasLui wants to merge 1 commit into
sentient-agi:mainfrom
ChasLui:fix/oauth-token-support

Conversation

@ChasLui

@ChasLui ChasLui commented May 11, 2026

Copy link
Copy Markdown

Summary

  • Adds CLAUDE_CODE_OAUTH_TOKEN to the anthropic provider's accepted env var list in src/harness/provider_auth.py
  • Lets Anthropic Pro/Max subscribers run the Claude harness using their existing OAuth credentials, without provisioning a separate API key

Motivation

claude-agent-sdk already reads CLAUDE_CODE_OAUTH_TOKEN internally (see claude_agent_sdk/_internal/session_resume.py), and the bundled claude CLI binary picks up subscription credentials from ~/.claude/.credentials.json. The only thing blocking subscription users was EvoSkill's own pre-flight ensure_provider_api_key("anthropic") check, which hard-required ANTHROPIC_API_KEY.

Scope

This change only touches the anthropic entry. Other harnesses (codex / opencode / goose / openhands) bind api_key directly into SDK constructors (e.g. Codex({"api_key": api_key}), llm_kwargs["api_key"] = ...), so OAuth-style credentials don't flow through there — those harnesses are intentionally left unchanged.

Test plan

  • evoskill --help still loads after install
  • evoskill init → select claude harness → evoskill run with only CLAUDE_CODE_OAUTH_TOKEN exported (no ANTHROPIC_API_KEY)
  • Verify subscription rate limits are observed (vs API metered billing)

Anthropic Pro/Max subscribers authenticate via OAuth (CLAUDE_CODE_OAUTH_TOKEN)
rather than ANTHROPIC_API_KEY. claude-agent-sdk already supports this env var
internally — extending the harness allowlist lets subscription users run the
Claude harness without provisioning an API key.

Other harnesses (codex/opencode/goose/openhands) bind api_key into SDK
constructors directly, so OAuth flow is not applicable there and they remain
unchanged.
@namanvats-dev

Copy link
Copy Markdown
Collaborator

@ChasLui Can you attach some terminal logs of it working with CLAUDE_CODE_OAUTH_TOKEN

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants