{"record":{"id":"440478ee797eebef","repo":"Mintplex-Labs/anything-llm","slug":"deepseek-api-key-must-be-provided-to-use-agents","errorCode":null,"errorMessage":"DeepSeek API Key must be provided to use agents.","messagePattern":"DeepSeek API Key must be provided to use agents\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/utils/agents/index.js","lineNumber":205,"sourceCode":"        break;\n      case \"textgenwebui\":\n        if (!process.env.TEXT_GEN_WEB_UI_BASE_PATH)\n          throw new Error(\n            \"TextWebGenUI API base path must be provided to use agents.\"\n          );\n        break;\n      case \"bedrock\":\n        // No validations since there are many possible authentication methods\n        break;\n      case \"fireworksai\":\n        if (!process.env.FIREWORKS_AI_LLM_API_KEY)\n          throw new Error(\n            \"FireworksAI API Key must be provided to use agents.\"\n          );\n        break;\n      case \"deepseek\":\n        if (!process.env.DEEPSEEK_API_KEY)\n          throw new Error(\"DeepSeek API Key must be provided to use agents.\");\n        break;\n      case \"litellm\":\n        if (!process.env.LITE_LLM_BASE_PATH)\n          throw new Error(\n            \"LiteLLM API base path and key must be provided to use agents.\"\n          );\n        break;\n      case \"apipie\":\n        if (!process.env.APIPIE_LLM_API_KEY)\n          throw new Error(\"ApiPie API Key must be provided to use agents.\");\n        break;\n      case \"xai\":\n        if (!process.env.XAI_LLM_API_KEY)\n          throw new Error(\"xAI API Key must be provided to use agents.\");\n        break;\n      case \"zai\":\n        if (!process.env.ZAI_API_KEY)\n          throw new Error(\"Z.AI API Key must be provided to use agents.\");","sourceCodeStart":187,"sourceCodeEnd":223,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/526360e320da9d1b36074be5ed64fe76e5bbfbbd/server/utils/agents/index.js#L187-L223","documentation":"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.","triggerScenarios":"An agent invocation runs with workspace.agentProvider === 'deepseek' while DEEPSEEK_API_KEY is absent from process.env. Path: #providerSetupAndCheck() -> checkSetup() at index.js:476.","commonSituations":"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.","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)."],"exampleFix":"// before (.env)\n// DEEPSEEK_API_KEY=\n\n// after (.env)\nDEEPSEEK_API_KEY=sk-...your-key","handlingStrategy":"validation","validationCode":"const key = process.env.DEEPSEEK_API_KEY;\nif (!key) {\n  throw new Error(\n    'Cannot start DeepSeek agent: set DEEPSEEK_API_KEY (from platform.deepseek.com/api_keys) in .env.'\n  );\n}","typeGuard":null,"tryCatchPattern":"try {\n  await agentHandler.start();\n} catch (e) {\n  if (/DeepSeek API Key must be provided/.test(e.message)) {\n    return respondConfigError('deepseek', ['DEEPSEEK_API_KEY']);\n  }\n  throw e;\n}","preventionTips":["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."],"tags":["agents","llm-provider","deepseek","api-key","environment-variables","config"],"backgroundTag":null,"analyzedSha":"526360e320da9d1b36074be5ed64fe76e5bbfbbd","analyzedAt":"2026-08-13T01:45:47.170Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}