{"record":{"id":"9eec04a258124651","repo":"Mintplex-Labs/anything-llm","slug":"api-base-path-must-be-provided-to-use-agents","errorCode":null,"errorMessage":"API base path must be provided to use agents.","messagePattern":"API base path must be provided to use agents\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/utils/agents/index.js","lineNumber":182,"sourceCode":"          );\n        break;\n      case \"localai\":\n        if (!process.env.LOCAL_AI_BASE_PATH)\n          throw new Error(\n            \"LocalAI must have a valid base path to use for the api.\"\n          );\n        break;\n      case \"openrouter\":\n        if (!process.env.OPENROUTER_API_KEY)\n          throw new Error(\"OpenRouter API key must be provided to use agents.\");\n        break;\n      case \"mistral\":\n        if (!process.env.MISTRAL_API_KEY)\n          throw new Error(\"Mistral API key must be provided to use agents.\");\n        break;\n      case \"generic-openai\":\n        if (!process.env.GENERIC_OPEN_AI_BASE_PATH)\n          throw new Error(\"API base path must be provided to use agents.\");\n        break;\n      case \"perplexity\":\n        if (!process.env.PERPLEXITY_API_KEY)\n          throw new Error(\"Perplexity API key must be provided to use agents.\");\n        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.\"","sourceCodeStart":164,"sourceCodeEnd":200,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/526360e320da9d1b36074be5ed64fe76e5bbfbbd/server/utils/agents/index.js#L164-L200","documentation":"Thrown by AgentHandler.checkSetup() (server/utils/agents/index.js:181) when the workspace agent provider is 'generic-openai' but GENERIC_OPEN_AI_BASE_PATH is unset/empty. The generic-openai provider points AnythingLLM at any OpenAI-compatible endpoint, so the base URL is the only required credential and is what this guard checks.","triggerScenarios":"An agent invocation runs with workspace.agentProvider === 'generic-openai' while GENERIC_OPEN_AI_BASE_PATH is absent from process.env. Path: #providerSetupAndCheck() -> checkSetup() at index.js:476.","commonSituations":"Generic OpenAI provider selected in System > LLM Preference but the custom endpoint URL was never entered; the base path was set in the UI but not persisted to .env; pointing at a gateway (vLLM, OpenLLM, internal proxy) whose URL changed; missing /v1 suffix causing later failures even after this guard passes.","solutions":["Set GENERIC_OPEN_AI_BASE_PATH in .env to the OpenAI-compatible endpoint (usually ending in /v1).","Restart AnythingLLM so process.env reloads.","If the endpoint needs auth, also set GENERIC_OPEN_AI_API_KEY (the base-path guard only checks the URL).","Confirm the endpoint answers with curl <base path>/models."],"exampleFix":"// before (.env)\n// GENERIC_OPEN_AI_BASE_PATH=\n\n// after (.env)\nGENERIC_OPEN_AI_BASE_PATH=https://my-internal-gateway.example.com/v1","handlingStrategy":"validation","validationCode":"const base = process.env.GENERIC_OPEN_AI_BASE_PATH;\nif (!base) {\n  throw new Error(\n    'Cannot start generic-openai agent: set GENERIC_OPEN_AI_BASE_PATH (OpenAI-compatible URL, usually ending in /v1) in .env.'\n  );\n}\ntry { new URL(base); } catch { throw new Error('GENERIC_OPEN_AI_BASE_PATH is not a valid URL'); }","typeGuard":null,"tryCatchPattern":"try {\n  await agentHandler.start();\n} catch (e) {\n  if (/API base path must be provided/.test(e.message)) {\n    return respondConfigError('generic-openai', ['GENERIC_OPEN_AI_BASE_PATH']);\n  }\n  throw e;\n}","preventionTips":["The guard checks only the base path; if the endpoint needs auth, also set GENERIC_OPEN_AI_API_KEY.","Restart AnythingLLM after .env edits.","Validate the endpoint with curl <base path>/models before configuring agents.","Keep the /v1 suffix consistent with what the upstream gateway expects."],"tags":["agents","llm-provider","generic-openai","openai-compatible","environment-variables","config"],"backgroundTag":null,"analyzedSha":"526360e320da9d1b36074be5ed64fe76e5bbfbbd","analyzedAt":"2026-08-13T01:45:47.170Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}