[FEATURE] Allow configuring authentication provider priority / override when multiple credentials are available

Resolved 💬 3 comments Opened Mar 26, 2026 by mstoliarov Closed Mar 29, 2026

Preflight Checklist

  • [x] I have searched existing requests and this feature hasn't been requested yet
  • [x] This is a single feature request (not multiple features)

Problem Statement

Currently, Claude Code uses a fixed credential priority order:

  1. Cloud provider (Bedrock/Vertex/Foundry)
  2. ANTHROPIC_AUTH_TOKEN
  3. ANTHROPIC_API_KEY
  4. apiKeyHelper
  5. Subscription OAuth

This creates a problem for users who have ANTHROPIC_API_KEY set system-wide (for other tools, scripts, or CI) but want Claude Code to use their Max/Pro subscription interactively.

Current behavior:
When ANTHROPIC_API_KEY is present in the environment, Claude Code always prefers it over subscription OAuth. The only workaround is to unset the variable before launching Claude Code.

Expected behavior:
Users should be able to explicitly choose which auth provider Claude Code uses, regardless of what credentials are present in the environment.

This way users with multiple credentials can control which one Claude Code uses without modifying their environment.

Proposed Solution

Add a setting like "authProvider" in settings.json (or a CLI flag --auth-provider) that allows overriding the default priority. For example:

{
"authProvider": "subscription"
}

Possible values: "auto" (current behavior, default), "subscription", "api-key", "bedrock", "vertex".

Alternative Solutions

_No response_

Priority

Medium - Would be very helpful

Feature Category

Configuration and settings

Use Case Example

_No response_

Additional Context

_No response_

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗