fix: Use SDK auth_token parameter with OAuth2 token (not API key)
Your theory was correct! Claude Code uses the Anthropic SDK with the
authToken parameter (not apiKey) for OAuth2 authentication.
From vendors/claude/src/services/api/client.ts lines 300-315:
const clientConfig = {
apiKey: isClaudeAISubscriber() ? null : apiKey || getAnthropicApiKey(),
authToken: isClaudeAISubscriber()
? getClaudeAIOAuthTokens()?.accessToken
: undefined,
}
return new Anthropic(clientConfig)
Changes:
- providers.py: Use auth_token=access_token (not api_key) for SDK client
- claude_auth.py: Remove create_api_key() and get_api_key() methods
(not needed - OAuth2 token is used directly with SDK auth_token)
The create_api_key endpoint is only for creating API keys for use in
other contexts (CI/CD, IDEs), not for the main CLI.
Showing
Please
register
or
sign in
to comment