feat: auto-detect provider when switching models via /model (#1506)
When typing /model deepseek-chat while on a different provider, the model name now auto-resolves to the correct provider instead of silently staying on the wrong one and causing API errors. Detection priority: 1. Direct provider with credentials (e.g. DEEPSEEK_API_KEY set) 2. OpenRouter catalog match with proper slug remapping 3. Direct provider without creds (clear error beats silent failure) Also adds DeepSeek as a first-class API-key provider — just set DEEPSEEK_API_KEY and /model deepseek-chat routes directly. Bare model names get remapped to proper OpenRouter slugs: /model gpt-5.4 → openai/gpt-5.4 /model claude-opus-4.6 → anthropic/claude-opus-4.6 Salvages the concept from PR #1177 by @virtaava with credential awareness and OpenRouter slug mapping added. Co-authored-by: virtaava <virtaava@users.noreply.github.com>
This commit is contained in:
parent
9cf7e2f0af
commit
c1da1fdcd5
8 changed files with 213 additions and 5 deletions
|
|
@ -85,6 +85,7 @@ class TestProviderEnvBlocklist:
|
|||
"KIMI_API_KEY": "kimi-key",
|
||||
"MINIMAX_API_KEY": "mm-key",
|
||||
"MINIMAX_CN_API_KEY": "mmcn-key",
|
||||
"DEEPSEEK_API_KEY": "deepseek-key",
|
||||
}
|
||||
result_env = _run_with_env(extra_os_env=registry_vars)
|
||||
|
||||
|
|
@ -95,7 +96,6 @@ class TestProviderEnvBlocklist:
|
|||
"""Extra provider vars not in PROVIDER_REGISTRY must also be blocked."""
|
||||
extra_provider_vars = {
|
||||
"GOOGLE_API_KEY": "google-key",
|
||||
"DEEPSEEK_API_KEY": "deepseek-key",
|
||||
"MISTRAL_API_KEY": "mistral-key",
|
||||
"GROQ_API_KEY": "groq-key",
|
||||
"TOGETHER_API_KEY": "together-key",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue