Mintplex-Labs/anything-llm · error · Error
No Groq API key was set.
Error message
No Groq API key was set.
What it means
GroqSTT's constructor throws when process.env.STT_GROQ_API_KEY is unset or empty, before the OpenAI-compatible client to https://api.groq.com/openai/v1 is created. The check runs at instantiation, i.e. the first transcription after STT_PROVIDER=groq is configured.
Solutions
- Add STT_GROQ_API_KEY=<key> (a key from console.groq.com) to .env and restart
- Optionally set STT_GROQ_MODEL (defaults to whisper-large-v3-turbo)
- Ensure Docker passes the variable into the container
- Double-check the exact prefix STT_GROQ_API_KEY, not GROQ_API_KEY
Example fix
# before (.env) STT_PROVIDER=groq # after (.env) STT_PROVIDER=groq STT_GROQ_API_KEY=gsk_...
Defensive patterns
Strategy: validation
Validate before calling
if (process.env.STT_PROVIDER === 'groq' && !process.env.STT_GROQ_API_KEY) {
throw new Error('STT_PROVIDER=groq requires STT_GROQ_API_KEY to be set');
} Try / catch
try {
stt = new GroqSTT();
} catch (err) {
if (err.message === 'No Groq API key was set.') {
// prompt for the key or fall back to another provider
}
throw err;
} Prevention
- Use the exact STT_GROQ_API_KEY name — not GROQ_API_KEY or the LLM-side variable
- Restart after .env edits and pass env through in containerized deployments
- Validate provider env pairs in a startup checklist
When it happens
Trigger: STT_PROVIDER=groq set but STT_GROQ_API_KEY missing from the environment; variable present in .env but the process was started before the edit; wrong variable name used (e.g. GROQ_API_KEY without the STT_ prefix).
Common situations: Env var name confusion between the LLM-side Groq key and the STT-side key; Docker/compose not passing the variable; trailing whitespace or quotes around the key value in .env.
Understand the failure class
Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.
Related errors
- No Deepgram API key was set.
- No Lemonade base path was set.
- No Groq API key was set.
- No OpenRouter image generation API key was set.
- No OpenRouter image generation model was set.
AI-assisted analysis of Mintplex-Labs/anything-llm@3aec848f28 (2026-08-18).
Data as JSON: /api/errors/bec2b7ab12fca6a6.
Report an issue: GitHub.
Appendix: source
Thrown at server/utils/SpeechToText/groq/index.js:4
class GroqSTT {
constructor() {
if (!process.env.STT_GROQ_API_KEY)
throw new Error("No Groq API key was set.");
const { OpenAI: OpenAIApi } = require("openai");
this.openai = new OpenAIApi({
baseURL: "https://api.groq.com/openai/v1",
apiKey: process.env.STT_GROQ_API_KEY,
});
this.model = process.env.STT_GROQ_MODEL ?? "whisper-large-v3-turbo";
}
#log(text, ...args) {
console.log(`\x1b[32m[GroqSTT]\x1b[0m ${text}`, ...args);
}
/**
* Transcribes an audio buffer to text using the Groq STT service.
* @param {Buffer} audioBuffer - The audio buffer to be transcribed.
* @param {string} filename - Original filename, used to hint the audio container/codec to Groq.
* @returns {Promise<string>} The transcribed text.
*/View on GitHub (pinned to 3aec848f28)