Mintplex-Labs/anything-llm · error · Error
No Perplexity API key was set.
Error message
No Perplexity API key was set.
What it means
Configuration guard thrown by the PerplexityLLM constructor: the perplexity provider was selected but the PERPLEXITY_API_KEY environment variable is empty/unset, so the online-models/search API cannot be authenticated.
Solutions
- Set the Perplexity API key in provider settings or env.
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at provider construction when no Perplexity API key is configured.
Common situations: Perplexity selected as LLM provider without an API key.
AI-assisted analysis of Mintplex-Labs/anything-llm@20f6d3546c (2026-08-18).
Data as JSON: /api/errors/ace19a1ad2b7e728.
Report an issue: GitHub.
Appendix: source
Thrown at server/utils/AiProviders/perplexity/index.js:21
const { isAbortError } = require("../../helpers/abortSignals");
const {
writeResponseChunk,
clientAbortedHandler,
} = require("../../helpers/chat/responses");
const {
LLMPerformanceMonitor,
} = require("../../helpers/chat/LLMPerformanceMonitor");
const { getAnythingLLMUserAgent } = require("../../../endpoints/utils");
function perplexityModels() {
const { MODELS } = require("./models.js");
return MODELS || {};
}
class PerplexityLLM {
constructor(embedder = null, modelPreference = null) {
if (!process.env.PERPLEXITY_API_KEY)
throw new Error("No Perplexity API key was set.");
this.className = "PerplexityLLM";
const { OpenAI: OpenAIApi } = require("openai");
this.openai = new OpenAIApi({
baseURL: "https://api.perplexity.ai",
apiKey: process.env.PERPLEXITY_API_KEY ?? null,
defaultHeaders: {
"X-Pplx-Integration": getAnythingLLMUserAgent(),
},
});
this.model =
modelPreference ||
process.env.PERPLEXITY_MODEL_PREF ||
"llama-3-sonar-large-32k-online"; // Give at least a unique model to the provider as last fallback.
this.limits = {
history: this.promptWindowLimit() * 0.15,
system: this.promptWindowLimit() * 0.15,
user: this.promptWindowLimit() * 0.7,View on GitHub (pinned to 20f6d3546c)