Mintplex-Labs/anything-llm · critical · Error
No Azure API endpoint was set.
Error message
No Azure API endpoint was set.
What it means
Thrown by the AzureOpenAiLLM constructor when process.env.AZURE_OPENAI_ENDPOINT is falsy. Azure OpenAI requires an endpoint URL (per-resource) distinct from the key, and formatBaseUrl later parses it, so the constructor gates on its presence before anything else. It is checked before the key guard, so this fires first when both are missing.
Source
Thrown at server/utils/AiProviders/azureOpenAi/index.js:14
const { NativeEmbedder } = require("../../EmbeddingEngines/native");
const {
formatChatHistory,
handleDefaultStreamResponseV2,
} = require("../../helpers/chat/responses");
const {
LLMPerformanceMonitor,
} = require("../../helpers/chat/LLMPerformanceMonitor");
class AzureOpenAiLLM {
constructor(embedder = null, modelPreference = null) {
const { OpenAI } = require("openai");
if (!process.env.AZURE_OPENAI_ENDPOINT)
throw new Error("No Azure API endpoint was set.");
if (!process.env.AZURE_OPENAI_KEY)
throw new Error("No Azure API key was set.");
this.className = "AzureOpenAiLLM";
this.openai = new OpenAI({
apiKey: process.env.AZURE_OPENAI_KEY,
baseURL: AzureOpenAiLLM.formatBaseUrl(process.env.AZURE_OPENAI_ENDPOINT),
});
this.model =
modelPreference ||
process.env.AZURE_OPENAI_MODEL_PREF ||
process.env.OPEN_MODEL_PREF;
/*
Note: Azure OpenAI deployments do not expose model metadata that would allow us to
programmatically detect whether the deployment uses a reasoning model (o1, o1-mini, o3-mini, etc.).
As a result, we rely on the user to explicitly set AZURE_OPENAI_MODEL_TYPE="reasoning"
when using reasoning models, as incorrect configuration might result in chat errors.
*/View on GitHub (pinned to 526360e320)
Solutions
- Set `AZURE_OPENAI_ENDPOINT=https://<your-resource>.openai.azure.com` in .env and restart.
- Re-save the Azure provider config in the UI so both endpoint and key are persisted.
- Confirm the variable name exactly matches AZURE_OPENAI_ENDPOINT (no typo like ENDPOINT_URL).
- Also set AZURE_OPENAI_KEY to avoid immediately hitting the next guard (error 167).
Example fix
// before // .env AZURE_OPENAI_ENDPOINT= AZURE_OPENAI_KEY=... // after // .env AZURE_OPENAI_ENDPOINT=https://my-resource.openai.azure.com AZURE_OPENAI_KEY=...
Defensive patterns
Strategy: validation
Validate before calling
if (!process.env.AZURE_OPENAI_ENDPOINT) {
throw new Error(
"AZURE_OPENAI_ENDPOINT is missing. Set it to https://<resource>.openai.azure.com before using Azure."
);
}
const llm = new AzureOpenAiLLM(embedder, modelPref); Type guard
/** @param {unknown} v @returns {boolean} */
function isNonEmptyString(v) {
return typeof v === "string" && v.trim().length > 0;
} Try / catch
try {
const llm = new AzureOpenAiLLM(embedder, modelPref);
} catch (e) {
if (/No Azure API endpoint/.test(e.message)) {
return { ok: false, reason: "missing-endpoint" };
}
throw e;
} Prevention
- Group Azure config (endpoint, key, model pref) and validate all three together at save time.
- Provide a template value (https://<resource>.openai.azure.com) in the UI to discourage hostname-only entries.
- Document that Azure requires both endpoint and key, unlike some single-env providers.
- Restart after .env edits.
When it happens
Trigger: Instantiating AzureOpenAiLLM while AZURE_OPENAI_ENDPOINT is unset. The value should look like `https://<resource>.openai.azure.com` and is later normalized to `<endpoint>/openai/v1` by formatBaseUrl.
Common situations: Azure provider selected but endpoint not pasted; key was set but endpoint field left blank; env var misnamed (e.g. AZURE_OPENAI_URL); deploying to a new environment without copying the endpoint.
Related errors
- No Azure API key was set.
- No Anthropic API key was set.
- No ApiPie LLM API key was set.
- "${azureOpenAiEndpoint}" is not a valid URL. Check your sett
- No AZURE_OPENAI_MODEL_PREF ENV defined. This must the name o
AI-assisted analysis of Mintplex-Labs/anything-llm@526360e320 (2026-08-13).
Data as JSON: /api/errors/17fa92b1b4aa2107.
Report an issue: GitHub.