🤖 feat: add Anthropic OAuth authentication for Claude Pro/Max subscription #841
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Implements OAuth 2.0 + PKCE flow for authenticating with Claude Pro/Max accounts. This allows users to use their subscription for API calls instead of per-token billing (same as Claude Code CLI).
OAuth Flow
Key Implementation Details
9d1c250a-e61b-44d9-88ed-5944d1962f5e(same as Claude Code)https://claude.ai/oauth/authorizehttps://console.anthropic.com/v1/oauth/tokenorg:create_api_key user:profile user:inference~/.mux/oauth.jsonAuthentication Priority
When using Anthropic models, authentication is checked in this order:
~/.mux/oauth.json) - uses subscriptionproviders.jsoncconfig (apiKey)ANTHROPIC_API_KEYenvironment variableANTHROPIC_AUTH_TOKENenvironment variableAPI
Note
This PR adds the backend infrastructure. A follow-up PR will add the UI for login/logout in the Settings panel.
Generated with
mux