Skip to content

🐛 api.anthropic.com also reads OAuth tokens #595

Closed

Description

@esnible

Describe the bug

Consumer subscription accounts such as Claude Pro use OAuth tokens, but mocactl Add Credential refuses to accept them, saying api.anthropic.com reads API keys from x-api-key: choose kind api-key

Note that getting the Anthropic OAuth token can be tricky on macOS. https://code.claude.com/docs/en/authentication documents the CLAUDE_CODE_OAUTH_TOKEN env var and setting, and the ~/.claude/.credentials.json file, but on the Mac that file isn't used for keyboard (non-SSH) users. The OAuth key is stored in the keychain, and many web sites suggest using security find-generic-password -s 'Claude Code-credentials' -w to extract it. On my machine I had two keys,

  • Claude Code-credentials-854ee35a
  • Claude Code-credentials-28e0d61e

... and I had to list system keychain entries to find those.

Steps To Reproduce

  1. mocactl, /credentials, a`
  2. Enter the credential:
Add credential
  Name: claude-pro
  Kind: oauth2-token
  Consumer: inference
  Destination hosts: api.anthropic.com
  Gateway endpoint: https://api.anthropic.com
› Access token: ••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••
••••••••••••••••▌
api.anthropic.com reads API keys from x-api-key: choose kind api-key

Expected Behavior

kind oauth2-token should be allowed for api.anthropic.com

Rossoctl Version

dev

Additional Context

No response

Activity

  1. added a commit that references this issue on Oct 29, 2026
    2e4881a
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions