{"record":{"id":"e3edd1203fe2f448","repo":"Mintplex-Labs/anything-llm","slug":"togetherai-api-key-must-be-provided-to-use-agents","errorCode":null,"errorMessage":"TogetherAI API key must be provided to use agents.","messagePattern":"TogetherAI API key must be provided to use agents\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"critical","filePath":"server/utils/agents/index.js","lineNumber":152,"sourceCode":"      case \"anthropic\":\n        if (!process.env.ANTHROPIC_API_KEY)\n          throw new Error(\"Anthropic API key must be provided to use agents.\");\n        break;\n      case \"lmstudio\":\n        if (!process.env.LMSTUDIO_BASE_PATH)\n          throw new Error(\"LMStudio base path must be provided to use agents.\");\n        break;\n      case \"ollama\":\n        if (!process.env.OLLAMA_BASE_PATH)\n          throw new Error(\"Ollama base path must be provided to use agents.\");\n        break;\n      case \"groq\":\n        if (!process.env.GROQ_API_KEY)\n          throw new Error(\"Groq API key must be provided to use agents.\");\n        break;\n      case \"togetherai\":\n        if (!process.env.TOGETHER_AI_API_KEY)\n          throw new Error(\"TogetherAI API key must be provided to use agents.\");\n        break;\n      case \"azure\":\n        if (!process.env.AZURE_OPENAI_ENDPOINT || !process.env.AZURE_OPENAI_KEY)\n          throw new Error(\n            \"Azure OpenAI API endpoint and key must be provided to use agents.\"\n          );\n        break;\n      case \"koboldcpp\":\n        if (!process.env.KOBOLD_CPP_BASE_PATH)\n          throw new Error(\n            \"KoboldCPP must have a valid base path to use for the api.\"\n          );\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          );","sourceCodeStart":134,"sourceCodeEnd":170,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/526360e320da9d1b36074be5ed64fe76e5bbfbbd/server/utils/agents/index.js#L134-L170","documentation":"checkSetup() (index.js:150-153) throws for provider === \"togetherai\" when process.env.TOGETHER_AI_API_KEY is falsy, preventing an unauthenticated call to Together AI.","triggerScenarios":"Selecting the togetherai agent provider while TOGETHER_AI_API_KEY is unset or empty in the server environment.","commonSituations":"Together AI provider chosen without the key, a typo'd env var, or a container missing the secret.","solutions":["Set TOGETHER_AI_API_KEY in .env to a valid Together AI API key.","Restart the server so the new env loads.","For Docker, inject the key via compose env or -e.","Confirm the key is active in the Together AI dashboard."],"exampleFix":"# before (.env)\n# TOGETHER_AI_API_KEY=\n\n# after (.env)\nTOGETHER_AI_API_KEY=...validkey...","handlingStrategy":"validation","validationCode":"function togetherAgentReady() {\n  return Boolean(process.env.TOGETHER_AI_API_KEY && process.env.TOGETHER_AI_API_KEY.trim());\n}\nif (provider === \"togetherai\" && !togetherAgentReady())\n  throw new Error(\"Set TOGETHER_AI_API_KEY before enabling the togetherai agent.\");","typeGuard":null,"tryCatchPattern":"try {\n  agent.checkSetup();\n} catch (e) {\n  if (/TOGETHER_AI_API_KEY|API key must be provided/i.test(e.message)) {\n    throw new Error(\"TogetherAI agent is not configured: set TOGETHER_AI_API_KEY in .env and restart.\");\n  }\n  throw e;\n}","preventionTips":["Call checkSetup() at startup to fail fast.","Restart the server after editing .env.","Inject the key via Docker env in deployments.","Confirm the key is active in the Together AI dashboard."],"tags":["togetherai","config","env","auth","agents"],"backgroundTag":null,"analyzedSha":"526360e320da9d1b36074be5ed64fe76e5bbfbbd","analyzedAt":"2026-08-13T01:45:47.170Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}