Mintplex-Labs/anything-llm · error · Error
No OpenAI compatible endpoint was set. Please set this to…
Error message
No OpenAI compatible endpoint was set. Please set this to use your OpenAI compatible TTS service.
What it means
Thrown by the GenericOpenAiTTS constructor when TTS_OPEN_AI_COMPATIBLE_ENDPOINT is unset — the only hard requirement for pointing TTS at an OpenAI-compatible server. Missing key (TTS_OPEN_AI_COMPATIBLE_KEY), model (defaults tts-1), and voice (defaults alloy) only emit #log warnings and proceed, so of the four variables the endpoint is the one that throws. The check runs last, after the warnings, then builds an OpenAI SDK client with baseURL set to the endpoint.
Solutions
- Set TTS_OPEN_AI_COMPATIBLE_ENDPOINT=http://<host>:<port>/v1 and restart the server.
- Set TTS_OPEN_AI_COMPATIBLE_KEY when your endpoint requires auth (null apiKey otherwise).
- Set TTS_OPEN_AI_COMPATIBLE_MODEL and TTS_OPEN_AI_COMPATIBLE_VOICE_MODEL to values your endpoint actually serves — the tts-1/alloy defaults usually don't exist on non-OpenAI servers.
- Confirm the endpoint exposes /audio/speech with a curl POST.
Example fix
# before (.env) TTS_PROVIDER=generic-openai # -> Error: No OpenAI compatible endpoint was set... # after (.env) TTS_PROVIDER=generic-openai TTS_OPEN_AI_COMPATIBLE_ENDPOINT=http://localhost:8080/v1 TTS_OPEN_AI_COMPATIBLE_MODEL=kokoro TTS_OPEN_AI_COMPATIBLE_VOICE_MODEL=af_sky
Defensive patterns
Strategy: validation
Validate before calling
const canUseGenericOpenAiTTS = () =>
Boolean(process.env.TTS_OPEN_AI_COMPATIBLE_ENDPOINT);
if (process.env.TTS_PROVIDER === "generic-openai" && !canUseGenericOpenAiTTS()) {
throw new Error("generic-openai TTS requires TTS_OPEN_AI_COMPATIBLE_ENDPOINT");
} Try / catch
try {
tts = getTTSProvider();
} catch (e) {
if (/No OpenAI compatible endpoint was set/.test(e.message))
return respondConfigError("TTS_OPEN_AI_COMPATIBLE_ENDPOINT missing");
throw e;
} Prevention
- Only the endpoint throws; key/model/voice silently default — set all four to avoid surprising tts-1/alloy requests to a non-OpenAI server.
- Prefer a readiness probe against the endpoint's /models route before enabling the provider.
- Keep STT_ and TTS_ compatible-endpoint vars paired in config templates so neither is forgotten.
When it happens
Trigger: TTS_PROVIDER=generic-openai with TTS_OPEN_AI_COMPATIBLE_ENDPOINT absent; endpoint present under the STT_ prefix (STT_OPEN_AI_COMPATIBLE_ENDPOINT) but not the TTS_ prefix; empty string value (falsy) also throws.
Common situations: Running LocalAI/kokoro/other compatible servers and forgetting the URL; mixing up the STT_ and TTS_ compatible-endpoint variables; value lost during migration between bare-metal and Docker deployments; endpoint defined after the process started reading env (no restart).
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 Kokoro endpoint was set. Please set TTS_KOKORO_ENDPOINT…
- No OpenAI compatible endpoint was set. Please set this to…
- ENV: No TTS_PROVIDER value found in environment!
- No ElevenLabs API key was set.
- No OpenAI API key was set.
AI-assisted analysis of Mintplex-Labs/anything-llm@3aec848f28 (2026-08-18).
Data as JSON: /api/errors/32e89a87a94bbe5c.
Report an issue: GitHub.
Appendix: source
Thrown at server/utils/TextToSpeech/openAiGeneric/index.js:16
class GenericOpenAiTTS {
constructor() {
if (!process.env.TTS_OPEN_AI_COMPATIBLE_KEY)
this.#log(
"No OpenAI compatible API key was set. You might need to set this to use your OpenAI compatible TTS service."
);
if (!process.env.TTS_OPEN_AI_COMPATIBLE_MODEL)
this.#log(
"No OpenAI compatible TTS model was set. We will use the default voice model 'tts-1'. This may not exist or be valid your selected endpoint."
);
if (!process.env.TTS_OPEN_AI_COMPATIBLE_VOICE_MODEL)
this.#log(
"No OpenAI compatible voice model was set. We will use the default voice model 'alloy'. This may not exist for your selected endpoint."
);
if (!process.env.TTS_OPEN_AI_COMPATIBLE_ENDPOINT)
throw new Error(
"No OpenAI compatible endpoint was set. Please set this to use your OpenAI compatible TTS service."
);
const { OpenAI: OpenAIApi } = require("openai");
this.openai = new OpenAIApi({
apiKey: process.env.TTS_OPEN_AI_COMPATIBLE_KEY || null,
baseURL: process.env.TTS_OPEN_AI_COMPATIBLE_ENDPOINT,
});
this.model = process.env.TTS_OPEN_AI_COMPATIBLE_MODEL ?? "tts-1";
this.voice = process.env.TTS_OPEN_AI_COMPATIBLE_VOICE_MODEL ?? "alloy";
this.#log(
`Service (${process.env.TTS_OPEN_AI_COMPATIBLE_ENDPOINT}) with model: ${this.model} and voice: ${this.voice}`
);
}
#log(text, ...args) {
console.log(`\x1b[32m[OpenAiGenericTTS]\x1b[0m ${text}`, ...args);
}View on GitHub (pinned to 3aec848f28)