odysseus-dev/odysseus · error · HTTPException
Could not auto-detect provider. Pass base_url (e.g. 'https:/
Error message
Could not auto-detect provider. Pass base_url (e.g. 'https://api.deepseek.com/v1') or provider ('deepseek', 'openai', 'groq', etc.) What it means
HTTP 400 from POST /v1/chat: no base_url was supplied and _resolve_base_url(model, provider) could not map the request to a known provider. Resolution keys off the model name prefix or an explicit provider string against KNOWN_PROVIDERS (deepseek, openai, groq, ...).
Source
Thrown at routes/webhook/webhook_routes.py:296
# --- Case 2: Direct API key + model (no pre-configured endpoint needed) ---
if not sess and body.api_key:
api_key = body.api_key.strip()
model = body.model or "deepseek-chat"
# Validate only token-supplied direct base_url; auto-resolved known-provider
# URLs are not subject to extra local/LAN blocking beyond existing provider logic.
direct_base_url = body.base_url.strip().rstrip("/") if body.base_url else None
if direct_base_url:
try:
base_url = validate_public_http_url(direct_base_url)
except ValueError as e:
detail = str(e).replace("URL", "base_url", 1)
raise HTTPException(400, detail)
else:
base_url = _resolve_base_url(model, body.provider)
if not base_url:
raise HTTPException(400,
"Could not auto-detect provider. Pass base_url (e.g. 'https://api.deepseek.com/v1') "
"or provider ('deepseek', 'openai', 'groq', etc.)")
base_url = normalize_base(base_url)
endpoint_url = build_chat_url(base_url)
if not session_manager:
raise HTTPException(500, "Session manager not available")
sid = str(uuid.uuid4())
sess = session_manager.create_session(
session_id=sid, name="API Chat", endpoint_url=endpoint_url,
model=model, owner=token_owner,
)
sess.headers = build_headers(api_key, base_url)
session_manager.save_sessions()
session_id = sid
# --- Case 3: Fall back to first configured ModelEndpoint ---View on GitHub (pinned to f9235ebbf1)
Solutions
- Add an explicit provider field matching a KNOWN_PROVIDERS key (e.g. 'deepseek', 'openai', 'groq')
- Or supply a public base_url explicitly (see the SSRF constraints of error 929)
- Or configure a ModelEndpoint in Admin and call with no api_key (Case 3 fallback)
Example fix
// before
{"message":"hi","api_key":"sk-...","model":"llama-3-70b"}
// after
{"message":"hi","api_key":"sk-...","model":"llama-3-70b","provider":"groq"} Defensive patterns
Strategy: validation
Validate before calling
KNOWN = {"deepseek", "openai", "groq"} # keep in sync with KNOWN_PROVIDERS
if not base_url and (provider not in KNOWN and not model.startswith(tuple(KNOWN))):
require_explicit_provider_or_base_url() Try / catch
if resp.status_code == 400 and 'auto-detect provider' in detail:
retry_with(provider=guess_provider(model), base_url=None) Prevention
- Always send an explicit provider with non-standard model names
- Or configure a ModelEndpoint in Admin and skip per-request api_key entirely
When it happens
Trigger: Passing api_key + an unrecognized model (e.g. 'llama-3-70b') with no base_url and no provider; passing a provider string not in KNOWN_PROVIDERS (typo like 'opena1'); provider given as None and model name doesn't start with any known prefix.
Common situations: Using a third-party OpenAI-compatible aggregator (OpenRouter, Together) whose model names don't match known prefixes; new model names the resolver's prefix table doesn't know yet.
Related errors
- No session, api_key, or configured endpoints. Pass api_key +
- Message is required
- detail
- await res.text()
- HTTP ${res.status}
AI-assisted analysis of odysseus-dev/odysseus@f9235ebbf1 (2026-08-14).
Data as JSON: /api/errors/459945794bb99e59.
Report an issue: GitHub.