Skip to content

fix(tui): load ANTHROPIC_API_KEY when populating Claude provider form - #228

Merged
SaladDay merged 1 commit into
SaladDay:mainfrom
thedavidweng:fix/anthropic-model-fetch-401
Jun 4, 2026
Merged

SaladDay merged 1 commit into
SaladDay:mainfrom
thedavidweng:fix/anthropic-model-fetch-401

Conversation

@thedavidweng

@thedavidweng thedavidweng commented Jun 1, 2026 •

Copy link
Copy Markdown
Contributor

Closes #227

Problem

TUI fetch-models sends no auth when editing a Claude provider whose key is stored in ANTHROPIC_API_KEY (common for configs imported from Claude Code). populate_claude_form only read ANTHROPIC_AUTH_TOKEN, leaving the form empty → HTTP 401.

Model fetch HTTP logic (headers, URL ordering) already lives in fetch_provider_models_for_tui (runtime_systems/types.rs); this PR does not change that path.

Fix

Use StreamCheckService::extract_claude_key when populating the Claude API key field, matching CLI and stream-check behavior.

Tests

  • populate_claude_form_reads_anthropic_api_key_when_auth_token_missing
  • populate_claude_form_prefers_anthropic_auth_token_over_api_key

Verification

cd src-tauri
cargo fmt --check
cargo test populate_claude_form

@thedavidweng thedavidweng changed the title fix(provider): resolve 401 when fetching models from Anthropic-compatible endpoints fix(tui): load ANTHROPIC_API_KEY when populating Claude provider form Jun 2, 2026
@thedavidweng
thedavidweng force-pushed the fix/anthropic-model-fetch-401 branch from b5b6bb5 to 504e4e5 Compare June 2, 2026 01:15
Add regression coverage for loading Claude providers whose key is stored in ANTHROPIC_API_KEY, while preserving the current apiKeyField precedence rules.

Refs SaladDay#227
@SaladDay
SaladDay force-pushed the fix/anthropic-model-fetch-401 branch from 504e4e5 to 0334536 Compare June 4, 2026 09:15
@SaladDay

SaladDay commented Jun 4, 2026

Copy link
Copy Markdown
Owner

LGTM, THANKS

@SaladDay
SaladDay merged commit fff5a53 into SaladDay:main Jun 4, 2026
@thedavidweng
thedavidweng deleted the fix/anthropic-model-fetch-401 branch June 4, 2026 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(provider): TUI fetch-models returns 401 for Anthropic-compatible endpoints

2 participants