Mintplex-Labs/anything-llm · error · Error

No Deepgram API key was set.

Error message

No Deepgram API key was set.

What it means

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.

Source

Thrown at server/utils/SpeechToText/deepgram/index.js:4

class DeepgramSTT {
  constructor() {
    if (!process.env.STT_DEEPGRAM_API_KEY)
      throw new Error("No Deepgram API key was set.");

    this.apiKey = process.env.STT_DEEPGRAM_API_KEY;
    this.model = process.env.STT_DEEPGRAM_MODEL ?? "nova-3";
    this.endpoint = "https://api.deepgram.com/v1/listen";
    this.#log(`Service ready with model: ${this.model}`);
  }

  #log(text, ...args) {
    console.log(`\x1b[32m[DeepgramSTT]\x1b[0m ${text}`, ...args);
  }

  // Map common audio file extensions to a Content-Type that Deepgram accepts.
  // Deepgram auto-detects most containers from the bytes but a hint is best.
  #contentTypeFromFilename(filename) {
    const ext = filename.split(".").pop()?.toLowerCase();
    switch (ext) {
      case "wav":
        return "audio/wav";

View on GitHub (pinned to 526360e320)

Solutions

  1. Add STT_DEEPGRAM_API_KEY=<your-key> to the server .env and restart AnythingLLM.
  2. If using Docker, ensure the variable is passed to the container (docker-compose env_file or -e).
  3. Verify the exact env name is STT_DEEPGRAM_API_KEY (no prefix/suffix).
  4. If you don't have a Deepgram key, switch STT_PROVIDER to a provider you have credentials for (openai, groq, generic-openai, lemonade).

Example fix

# before
STT_PROVIDER=deepgram
# .env — key missing

# after
STT_PROVIDER=deepgram
STT_DEEPGRAM_API_KEY=abc123yourdeepgramkey
Defensive patterns

Strategy: validation

Validate before calling

if (process.env.STT_PROVIDER === "deepgram" && !process.env.STT_DEEPGRAM_API_KEY) {
  throw new Error(
    "STT_PROVIDER is 'deepgram' but STT_DEEPGRAM_API_KEY is not set. Add it to .env and restart."
  );
}

Try / catch

try {
  return new DeepgramSTT();
} catch (e) {
  if (/No Deepgram API key/i.test(e.message)) {
    logger.error("Set STT_DEEPGRAM_API_KEY in .env, then restart the server.");
  }
  throw e;
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Related errors


AI-assisted analysis of Mintplex-Labs/anything-llm@526360e320 (2026-08-13). Data as JSON: /api/errors/1070b972ced158de. Report an issue: GitHub.