{"record":{"id":"1070b972ced158de","repo":"Mintplex-Labs/anything-llm","slug":"no-deepgram-api-key-was-set","errorCode":null,"errorMessage":"No Deepgram API key was set.","messagePattern":"No Deepgram API key was set\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/utils/SpeechToText/deepgram/index.js","lineNumber":4,"sourceCode":"class DeepgramSTT {\n  constructor() {\n    if (!process.env.STT_DEEPGRAM_API_KEY)\n      throw new Error(\"No Deepgram API key was set.\");\n\n    this.apiKey = process.env.STT_DEEPGRAM_API_KEY;\n    this.model = process.env.STT_DEEPGRAM_MODEL ?? \"nova-3\";\n    this.endpoint = \"https://api.deepgram.com/v1/listen\";\n    this.#log(`Service ready with model: ${this.model}`);\n  }\n\n  #log(text, ...args) {\n    console.log(`\\x1b[32m[DeepgramSTT]\\x1b[0m ${text}`, ...args);\n  }\n\n  // Map common audio file extensions to a Content-Type that Deepgram accepts.\n  // Deepgram auto-detects most containers from the bytes but a hint is best.\n  #contentTypeFromFilename(filename) {\n    const ext = filename.split(\".\").pop()?.toLowerCase();\n    switch (ext) {\n      case \"wav\":\n        return \"audio/wav\";","sourceCodeStart":1,"sourceCodeEnd":22,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/526360e320da9d1b36074be5ed64fe76e5bbfbbd/server/utils/SpeechToText/deepgram/index.js#L1-L22","documentation":"Thrown by the DeepgramSTT constructor when process.env.STT_DEEPGRAM_API_KEY is falsy. The class hard-fails at instantiation rather than at first request, so selecting the deepgram provider without the key prevents the service from being created. The key is sent to Deepgram as an Authorization: Token header during transcription.","triggerScenarios":"STT_PROVIDER=deepgram is set but STT_DEEPGRAM_API_KEY is missing/empty in .env; the env var was added but the process was not restarted; the key was set under a different name (e.g. DEEPGRAM_API_KEY).","commonSituations":"New deployment forgetting the Deepgram key; renaming the env var; Docker env not passed through (missing -e or env_file entry); .env file not loaded in the current environment.","solutions":["Add STT_DEEPGRAM_API_KEY=<your-key> to the server .env and restart AnythingLLM.","If using Docker, ensure the variable is passed to the container (docker-compose env_file or -e).","Verify the exact env name is STT_DEEPGRAM_API_KEY (no prefix/suffix).","If you don't have a Deepgram key, switch STT_PROVIDER to a provider you have credentials for (openai, groq, generic-openai, lemonade)."],"exampleFix":"# before\nSTT_PROVIDER=deepgram\n# .env — key missing\n\n# after\nSTT_PROVIDER=deepgram\nSTT_DEEPGRAM_API_KEY=abc123yourdeepgramkey","handlingStrategy":"validation","validationCode":"if (process.env.STT_PROVIDER === \"deepgram\" && !process.env.STT_DEEPGRAM_API_KEY) {\n  throw new Error(\n    \"STT_PROVIDER is 'deepgram' but STT_DEEPGRAM_API_KEY is not set. Add it to .env and restart.\"\n  );\n}","typeGuard":null,"tryCatchPattern":"try {\n  return new DeepgramSTT();\n} catch (e) {\n  if (/No Deepgram API key/i.test(e.message)) {\n    logger.error(\"Set STT_DEEPGRAM_API_KEY in .env, then restart the server.\");\n  }\n  throw e;\n}","preventionTips":["Add a startup env checklist that validates provider→key pairings.","Keep a single source of truth for required env per provider in your deploy docs.","Restart the process/container after editing .env."],"tags":["stt","deepgram","configuration","environment","credentials"],"backgroundTag":null,"analyzedSha":"526360e320da9d1b36074be5ed64fe76e5bbfbbd","analyzedAt":"2026-08-13T01:45:47.170Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}