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:
Paul O'Reilly
2026-04-23 18:33:39 +12:00
parent ff6228e7ad
commit 4cd9757abc
3 changed files with 30 additions and 2 deletions

View File

@@ -199,6 +199,7 @@ assert_contains "chat default provider is anthropic-haiku" "Provider: ant
assert_contains "chat default model ID is haiku" "Model ID: claude-haiku-4-5-20251001" "$out"
# === Test 14: --preset + --provider mutual exclusion ===
echo
echo "Test 14: error path — --preset + --provider mutual exclusion"
out=$(run --dryrun --preset whatever --provider minimax-sonnet)
@@ -206,6 +207,23 @@ rc=$?
assert_exit_code "preset+provider exits 1" 1 "$rc"
assert_contains "preset+provider error message" "mutually exclusive" "$out"
# === Test 15: OAuth credentials warning fires for non-Anthropic provider ===
echo
echo "Test 15: OAuth credentials warning"
out=$(run --dryrun oreillyit --mode quick --provider minimax-sonnet)
rc=$?
assert_exit_code "credentials warning dryrun exits 0" 0 "$rc"
assert_contains "warning mentions stored credentials" ".credentials.json" "$out"
assert_contains "warning names the provider" "minimax-sonnet" "$out"
# === Test 16: No warning when profile has no OAuth credentials ===
echo
echo "Test 16: no warning for credentials-free profile"
out=$(run --dryrun minimax --mode quick --provider minimax-sonnet)
rc=$?
assert_exit_code "no-credentials dryrun exits 0" 0 "$rc"
assert_not_contains "no credentials warning" ".credentials.json" "$out"
# === Summary ===
echo
echo "================================"