Mintplex-Labs/anything-llm · error
No Minimax API key was set.
Error message
No Minimax API key was set.
What it means
MinimaxLLM's constructor throws immediately when process.env.MINIMAX_API_KEY is falsy, before the OpenAI-compatible client for https://api.minimax.io/v1 is even built. Any code path that instantiates the provider (selecting MiniMax as the LLM provider, starting a chat, or constructing providers programmatically) fails until the key is set.
Solutions
- Add MINIMAX_API_KEY=<key from the MiniMax platform console> to the server's .env
- Restart the AnythingLLM server or container so the variable is loaded
- If using Docker, confirm the variable is present in the container (check the name only, never print the value): docker exec <container> printenv | grep -c MINIMAX_API_KEY
- Check for typos and stray whitespace in the variable name and value
Example fix
# before # (MINIMAX_API_KEY not set) # after MINIMAX_API_KEY=eyJhbGciOi...your-key
Defensive patterns
Strategy: validation
Validate before calling
if (!process.env.MINIMAX_API_KEY)
throw new Error('MiniMax provider selected but MINIMAX_API_KEY is not configured');
const llm = new MinimaxLLM(embedder); Try / catch
try {
const llm = new MinimaxLLM(embedder);
} catch (e) {
if (e.message === 'No Minimax API key was set.')
return respondConfigError(e); // stop, configure the key, restart
throw e;
} Prevention
- Set provider API keys before selecting that provider in the UI
- Restart the server after every .env change
- Pass env vars explicitly in Docker (-e or --env-file)
- Fail fast at startup when the configured provider lacks its key
When it happens
Trigger: Selecting MiniMax as the workspace or system LLM provider while MINIMAX_API_KEY is unset, misspelled, or empty; editing .env without restarting the process; Docker deployments where the variable was never passed into the container.
Common situations: Typo'd variable name (MINIMAX_KEY, MINIMAX_APIKEY); .env edited but server not restarted; docker-compose environment section missing the var; test/CI environments that never had the key.
Understand the failure class
Background: "API key is required" / "API key not found" / "No API key was set": the missing-api-key error family across 16 libraries — this error's family across 16 libraries.
Related errors
- No Mistral API key was set.
- No Moonshot AI API key was set.
- No Novita API key was set.
- No Groq API key was set.
- No NVIDIA NIM API Base Path was set.
AI-assisted analysis of Mintplex-Labs/anything-llm@3aec848f28 (2026-08-18).
Data as JSON: /api/errors/9bacafd75db0bba9.
Report an issue: GitHub.
Appendix: source
Thrown at server/utils/AiProviders/minimax/index.js:14
const { NativeEmbedder } = require("../../EmbeddingEngines/native");
const {
LLMPerformanceMonitor,
} = require("../../helpers/chat/LLMPerformanceMonitor");
const {
handleDefaultStreamResponseV2,
} = require("../../helpers/chat/responses");
const { MODEL_MAP } = require("../modelMap");
class MinimaxLLM {
constructor(embedder = null, modelPreference = null) {
const { OpenAI: OpenAIApi } = require("openai");
if (!process.env.MINIMAX_API_KEY)
throw new Error("No Minimax API key was set.");
this.className = "MinimaxLLM";
this.openai = new OpenAIApi({
baseURL: "https://api.minimax.io/v1",
apiKey: process.env.MINIMAX_API_KEY,
});
this.model =
modelPreference || process.env.MINIMAX_MODEL_PREF || "MiniMax-M2.7";
this.limits = {
history: this.promptWindowLimit() * 0.15,
system: this.promptWindowLimit() * 0.15,
user: this.promptWindowLimit() * 0.7,
};
this.embedder = embedder ?? new NativeEmbedder();
this.defaultTemp = 0.7;
this.log(
`Initialized ${this.model} with context window ${this.promptWindowLimit()}`View on GitHub (pinned to 3aec848f28)