feat(claude-profile): warn when non-Anthropic provider used with OAuth profile
Add a warning when ANTHROPIC_BASE_URL would be set but the active profile's .credentials.json would override ANTHROPIC_API_KEY with subscription OAuth, routing requests to Anthropic instead of the intended provider. Fixes the MiniMax routing issue: use --profile minimax (~/.claude-minimax/, no stored credentials) for non-Anthropic providers. Update presets example to use profile: minimax for quick-minimax preset. 63 tests passing. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -425,6 +425,16 @@ PROVIDER_API_KEY_FILE=$(parse_provider_field "$provider_file" api_key_file)
|
||||
|
||||
[[ -n "$MODEL_ID" ]] || err "Provider file $provider_file is missing required field: model_id"
|
||||
|
||||
# Warn when a non-Anthropic provider is selected but the profile has stored OAuth credentials.
|
||||
# Claude Code uses .credentials.json for auth before checking ANTHROPIC_API_KEY, which
|
||||
# routes requests to Anthropic regardless of ANTHROPIC_BASE_URL.
|
||||
if [[ -n "$PROVIDER_BASE_URL" && -f "$target/.credentials.json" ]]; then
|
||||
echo "Warning: profile '$PROFILE' has stored OAuth credentials ($target/.credentials.json)." >&2
|
||||
echo " These take precedence over ANTHROPIC_API_KEY and will route requests to Anthropic," >&2
|
||||
echo " not $PROVIDER. Use a profile without .credentials.json for non-Anthropic providers." >&2
|
||||
echo " See: claude-profile --help" >&2
|
||||
fi
|
||||
|
||||
# === Phase 3: Launch ===
|
||||
|
||||
# Validate context-load exists
|
||||
|
||||
Reference in New Issue
Block a user