Mintplex-Labs/anything-llm · error
No Cerebras API key was set.
Error message
No Cerebras API key was set.
What it means
Constructor guard in CerebrasLLM: the CEREBRAS_API_KEY environment variable is unset, so the OpenAI-compatible client cannot authenticate to Cerebras and provider instantiation stops before any request is attempted.
Solutions
- Set the Cerebras API key in provider settings or env.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at provider construction when no Cerebras API key is configured.
Common situations: Cerebras selected as LLM provider without an API key.
AI-assisted analysis of Mintplex-Labs/anything-llm@a145d4d87d (2026-08-18).
Data as JSON: /api/errors/e27ccb6843576b3f.
Report an issue: GitHub.
Appendix: source
Thrown at server/utils/AiProviders/cerebras/index.js:17
const { NativeEmbedder } = require("../../EmbeddingEngines/native");
const {
LLMPerformanceMonitor,
} = require("../../helpers/chat/LLMPerformanceMonitor");
const {
handleDefaultStreamResponseV2,
formatChatHistory,
} = require("../../helpers/chat/responses");
const { MODEL_MAP } = require("../modelMap");
class CerebrasLLM {
static modelContextWindows = {};
constructor(embedder = null, modelPreference = null) {
const { OpenAI: OpenAIApi } = require("openai");
if (!process.env.CEREBRAS_API_KEY)
throw new Error("No Cerebras API key was set.");
this.className = "CerebrasLLM";
this.openai = new OpenAIApi({
baseURL: "https://api.cerebras.ai/v1",
apiKey: process.env.CEREBRAS_API_KEY,
});
this.model =
modelPreference || process.env.CEREBRAS_MODEL_PREF || "gpt-oss-120b";
// Lazy load the limits to avoid blocking the main thread on cacheContextWindows
this.limits = null;
this.embedder = embedder ?? new NativeEmbedder();
this.defaultTemp = 0;
CerebrasLLM.cacheContextWindows(true);
this.#log(`Initialized with model: ${this.model}`);
}
View on GitHub (pinned to a145d4d87d)