HKUDS/DeepTutor · critical · LLMConfigError
OpenAI API key is not configured. Set it in Settings > Catal
Error message
OpenAI API key is not configured. Set it in Settings > Catalog, or select a local provider such as Ollama.
What it means
After resolving model and URL, the config loader enforces authentication for official OpenAI: if the provider is openai, mode is standard (not oauth), and the api_key is one of the placeholder values ('', 'no-key', 'sk-no-key-required'), it raises LLMConfigError with actionable guidance. Local providers like Ollama are explicitly offered as the alternative.
Source
Thrown at deeptutor/services/llm/config.py:187
def _get_llm_config_from_resolver() -> LLMConfig:
"""Resolve LLM config from the TutorBot-style runtime adapter."""
resolved = resolve_llm_runtime_config()
if not resolved.model:
raise LLMConfigError(
"No active LLM model is configured. Please set it in Settings > Catalog."
)
if not resolved.effective_url and resolved.provider_mode != "oauth":
raise LLMConfigError(
"No effective LLM endpoint resolved. Please configure base_url or provider defaults."
)
is_placeholder_key = resolved.api_key in {"", "no-key", "sk-no-key-required"}
if (
resolved.provider_name == "openai"
and resolved.provider_mode == "standard"
and is_placeholder_key
):
raise LLMConfigError(
"OpenAI API key is not configured. Set it in Settings > Catalog, "
"or select a local provider such as Ollama."
)
return LLMConfig(
model=resolved.model,
api_key=resolved.api_key,
base_url=resolved.base_url,
effective_url=resolved.effective_url,
binding=resolved.binding,
provider_name=resolved.provider_name,
provider_mode=resolved.provider_mode,
api_version=resolved.api_version,
extra_headers=resolved.extra_headers,
reasoning_effort=resolved.reasoning_effort,
context_window=resolved.context_window,
)
View on GitHub (pinned to 3e82f13042)
Solutions
- Set the OpenAI key in Settings > Catalog or via OPENAI_API_KEY.
- If you intended local inference, switch the provider to Ollama (or set its base_url) instead of OpenAI.
- Remove placeholder strings like 'sk-no-key-required' from settings templates.
- For OAuth flows, set provider_mode to 'oauth' so this check is bypassed.
Example fix
// before export OPENAI_API_KEY=sk-no-key-required # after export OPENAI_API_KEY=sk-...your-real-key...
Defensive patterns
Strategy: validation
Validate before calling
PLACEHOLDERS = {"", "no-key", "sk-no-key-required"}
resolved = resolve_llm_runtime_config()
if resolved.provider_name == "openai" and resolved.provider_mode == "standard" and resolved.api_key in PLACEHOLDERS:
raise RuntimeError("Set an OpenAI key or switch to a local provider")
cfg = get_llm_config() Type guard
def is_placeholder_key(api_key: str | None) -> bool:
return (api_key or "") in {"", "no-key", "sk-no-key-required"} Try / catch
try:
cfg = get_llm_config()
except LLMConfigError as e:
if "OpenAI API key is not configured" in str(e):
prompt_for_openai_key_or_switch_to_ollama()
raise Prevention
- Scrub placeholder keys from templates and docker images.
- Export OPENAI_API_KEY in the same shell/session that launches the server.
- Default fresh installs to a local provider when no cloud key is present.
When it happens
Trigger: Provider=openai with no API key stored and mode=standard; key still at the shipped placeholder 'sk-no-key-required' from a template settings file; OPENAI_API_KEY unset in the environment fallback.
Common situations: Users running the default profile unchanged; template/docker setups shipping placeholder keys; env var present in one shell but the server launched from another; CI without secrets.
Understand the failure class
Background: "API key is required" / "API key not found" / "No API key was set": the missing-api-key error family across 16 libraries — this error's family across 16 libraries.
Related errors
- Anthropic API key is missing from the active LLM profile.
- Cohere API key is missing from the active LLM profile.
- OpenAI API key is not configured. Set it in Settings > Catal
- PageIndex OSS indexing needs an API-key or local LLM profile
- Model is required for cloud LLM provider
AI-assisted analysis of HKUDS/DeepTutor@3e82f13042 (2026-08-27).
Data as JSON: /api/errors/4936bcb2c08faac7.
Report an issue: GitHub.