Mintplex-Labs/anything-llm · error · Error
DeepSeek API Key must be provided to use agents.
Error message
DeepSeek API Key must be provided to use agents.
What it means
Thrown by AgentHandler.checkSetup() (server/utils/agents/index.js:204) when the workspace agent provider is 'deepseek' but DEEPSEEK_API_KEY is unset/empty. DeepSeek's API (DeepSeek-V3/R1) is keyed by this single value, which the guard validates before the agent starts.
Source
Thrown at server/utils/agents/index.js:205
break;
case "textgenwebui":
if (!process.env.TEXT_GEN_WEB_UI_BASE_PATH)
throw new Error(
"TextWebGenUI API base path must be provided to use agents."
);
break;
case "bedrock":
// No validations since there are many possible authentication methods
break;
case "fireworksai":
if (!process.env.FIREWORKS_AI_LLM_API_KEY)
throw new Error(
"FireworksAI API Key must be provided to use agents."
);
break;
case "deepseek":
if (!process.env.DEEPSEEK_API_KEY)
throw new Error("DeepSeek API Key must be provided to use agents.");
break;
case "litellm":
if (!process.env.LITE_LLM_BASE_PATH)
throw new Error(
"LiteLLM API base path and key must be provided to use agents."
);
break;
case "apipie":
if (!process.env.APIPIE_LLM_API_KEY)
throw new Error("ApiPie API Key must be provided to use agents.");
break;
case "xai":
if (!process.env.XAI_LLM_API_KEY)
throw new Error("xAI API Key must be provided to use agents.");
break;
case "zai":
if (!process.env.ZAI_API_KEY)
throw new Error("Z.AI API Key must be provided to use agents.");View on GitHub (pinned to 526360e320)
Solutions
- Create an API key at https://platform.deepseek.com/api_keys and set DEEPSEEK_API_KEY in .env.
- Restart AnythingLLM to reload process.env.
- Verify with curl -H 'Authorization: Bearer $DEEPSEEK_API_KEY' https://api.deepseek.com/models.
- Ensure the agent model is a valid DeepSeek model id (e.g. deepseek-chat, deepseek-reasoner).
Example fix
// before (.env) // DEEPSEEK_API_KEY= // after (.env) DEEPSEEK_API_KEY=sk-...your-key
Defensive patterns
Strategy: validation
Validate before calling
const key = process.env.DEEPSEEK_API_KEY;
if (!key) {
throw new Error(
'Cannot start DeepSeek agent: set DEEPSEEK_API_KEY (from platform.deepseek.com/api_keys) in .env.'
);
} Try / catch
try {
await agentHandler.start();
} catch (e) {
if (/DeepSeek API Key must be provided/.test(e.message)) {
return respondConfigError('deepseek', ['DEEPSEEK_API_KEY']);
}
throw e;
} Prevention
- Generate the key at platform.deepseek.com and write it to .env immediately.
- Restart the Node process / Docker container after .env edits.
- Add a CI/startup check that DEEPSEEK_API_KEY is set when provider is deepseek.
- Keep .env out of version control; rotate keys on quota exhaustion.
When it happens
Trigger: An agent invocation runs with workspace.agentProvider === 'deepseek' while DEEPSEEK_API_KEY is absent from process.env. Path: #providerSetupAndCheck() -> checkSetup() at index.js:476.
Common situations: DeepSeek selected in System > LLM Preference without a key; key created at platform.deepseek.com but not pasted into .env; .env updated but the server/container not restarted; key revoked after quota exhaustion.
Related errors
- OpenRouter API key must be provided to use agents.
- Mistral API key must be provided to use agents.
- Perplexity API key must be provided to use agents.
- FireworksAI API Key must be provided to use agents.
- ApiPie API Key must be provided to use agents.
AI-assisted analysis of Mintplex-Labs/anything-llm@526360e320 (2026-08-13).
Data as JSON: /api/errors/440478ee797eebef.
Report an issue: GitHub.