{"record":{"id":"eb317b992488da1b","repo":"Mintplex-Labs/anything-llm","slug":"apipie-api-key-must-be-provided-to-use-agents","errorCode":null,"errorMessage":"ApiPie API Key must be provided to use agents.","messagePattern":"ApiPie API Key must be provided to use agents\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/utils/agents/index.js","lineNumber":215,"sourceCode":"      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.\");\n        break;\n      case \"novita\":\n        if (!process.env.NOVITA_LLM_API_KEY)\n          throw new Error(\"Novita API Key must be provided to use agents.\");\n        break;\n      case \"nvidia-nim\":\n        if (!process.env.NVIDIA_NIM_LLM_BASE_PATH)\n          throw new Error(\n            \"NVIDIA NIM base path must be provided to use agents.\"\n          );","sourceCodeStart":197,"sourceCodeEnd":233,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/526360e320da9d1b36074be5ed64fe76e5bbfbbd/server/utils/agents/index.js#L197-L233","documentation":"Thrown by AgentHandler.checkSetup() (server/utils/agents/index.js:214) when the workspace agent provider is 'apipie' but APIPIE_LLM_API_KEY is unset/empty. APIPie is a hosted aggregator of LLM APIs behind one key, which is the only credential this guard validates.","triggerScenarios":"An agent invocation runs with workspace.agentProvider === 'apipie' while APIPIE_LLM_API_KEY is absent from process.env. Path: #providerSetupAndCheck() -> checkSetup() at index.js:476.","commonSituations":"APIPie selected in System > LLM Preference without a key; key from apipie.io not pasted into .env; .env changed but Node not restarted; key revoked.","solutions":["Create a key at https://apipie.io (account > API Keys) and set APIPIE_LLM_API_KEY in .env.","Restart AnythingLLM to reload process.env.","Validate the key with curl -H 'Authorization: Bearer $APIPIE_LLM_API_KEY' against the APIPie models endpoint.","Confirm the agent model string matches an APIPie-routed model id."],"exampleFix":"// before (.env)\n// APIPIE_LLM_API_KEY=\n\n// after (.env)\nAPIPIE_LLM_API_KEY=...your-apipie-key","handlingStrategy":"validation","validationCode":"const key = process.env.APIPIE_LLM_API_KEY;\nif (!key) {\n  throw new Error(\n    'Cannot start ApiPie agent: set APIPIE_LLM_API_KEY (from your APIPie account) in .env.'\n  );\n}","typeGuard":null,"tryCatchPattern":"try {\n  await agentHandler.start();\n} catch (e) {\n  if (/ApiPie API Key must be provided/.test(e.message)) {\n    return respondConfigError('apipie', ['APIPIE_LLM_API_KEY']);\n  }\n  throw e;\n}","preventionTips":["Create the key in the APIPie dashboard and write it to .env immediately.","Restart AnythingLLM so process.env reloads.","Add a startup assertion that APIPIE_LLM_API_KEY is set when provider is apipie.","Keep .env out of version control and rotate keys periodically."],"tags":["agents","llm-provider","apipie","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"}