Hint at provider prefix when bare model 401s against OpenAI
A bare model name without a provider prefix routes through the SDK's default OpenAI provider, so configuring STRIX_LLM=deepseek-v4-pro with LLM_API_KEY=<deepseek key> sends that key to api.openai.com and surfaces a confusing "Incorrect API key" error pointing at the OpenAI dashboard. When warm-up fails with an OpenAI-shaped error AND the configured model is still unprefixed after normalize_model_name, append a hint that points the user at the '<provider>/<model>' form with concrete examples.
This commit is contained in:
@@ -5,6 +5,7 @@ Strix Agent Interface
|
|||||||
|
|
||||||
import argparse
|
import argparse
|
||||||
import asyncio
|
import asyncio
|
||||||
|
import contextlib
|
||||||
import shutil
|
import shutil
|
||||||
import sys
|
import sys
|
||||||
from datetime import UTC, datetime
|
from datetime import UTC, datetime
|
||||||
@@ -242,6 +243,24 @@ async def warm_up_llm() -> None:
|
|||||||
error_text.append("Please check your configuration and try again.\n", style="white")
|
error_text.append("Please check your configuration and try again.\n", style="white")
|
||||||
error_text.append(f"\nError: {e}", style="dim white")
|
error_text.append(f"\nError: {e}", style="dim white")
|
||||||
|
|
||||||
|
raw_model = ""
|
||||||
|
resolved = ""
|
||||||
|
with contextlib.suppress(Exception):
|
||||||
|
raw_model = (load_settings().llm.model or "").strip()
|
||||||
|
resolved = normalize_model_name(raw_model)
|
||||||
|
err_lc = str(e).lower()
|
||||||
|
unprefixed = bool(resolved) and "/" not in resolved
|
||||||
|
looks_openai = "platform.openai.com" in err_lc or "openai" in err_lc
|
||||||
|
if unprefixed and looks_openai:
|
||||||
|
error_text.append(
|
||||||
|
f"\n\nHint: '{raw_model}' has no provider prefix, so the SDK "
|
||||||
|
f"routed it through OpenAI by default. For non-OpenAI providers "
|
||||||
|
f"use the '<provider>/<model>' form, e.g. "
|
||||||
|
f"'deepseek/deepseek-chat', 'groq/llama-3.1-70b', "
|
||||||
|
f"'anthropic/claude-3-5-sonnet'.",
|
||||||
|
style="yellow",
|
||||||
|
)
|
||||||
|
|
||||||
panel = Panel(
|
panel = Panel(
|
||||||
error_text,
|
error_text,
|
||||||
title="[bold white]STRIX",
|
title="[bold white]STRIX",
|
||||||
|
|||||||
Reference in New Issue
Block a user