{"record":{"id":"32e89a87a94bbe5c","repo":"Mintplex-Labs/anything-llm","slug":"no-openai-compatible-endpoint-was-set-please-set-32e89a","errorCode":null,"errorMessage":"No OpenAI compatible endpoint was set. Please set this to use your OpenAI compatible TTS service.","messagePattern":"No OpenAI compatible endpoint was set\\. Please set this to use your OpenAI compatible TTS service\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"server/utils/TextToSpeech/openAiGeneric/index.js","lineNumber":16,"sourceCode":"class GenericOpenAiTTS {\n  constructor() {\n    if (!process.env.TTS_OPEN_AI_COMPATIBLE_KEY)\n      this.#log(\n        \"No OpenAI compatible API key was set. You might need to set this to use your OpenAI compatible TTS service.\"\n      );\n    if (!process.env.TTS_OPEN_AI_COMPATIBLE_MODEL)\n      this.#log(\n        \"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.\"\n      );\n    if (!process.env.TTS_OPEN_AI_COMPATIBLE_VOICE_MODEL)\n      this.#log(\n        \"No OpenAI compatible voice model was set. We will use the default voice model 'alloy'. This may not exist for your selected endpoint.\"\n      );\n    if (!process.env.TTS_OPEN_AI_COMPATIBLE_ENDPOINT)\n      throw new Error(\n        \"No OpenAI compatible endpoint was set. Please set this to use your OpenAI compatible TTS service.\"\n      );\n\n    const { OpenAI: OpenAIApi } = require(\"openai\");\n    this.openai = new OpenAIApi({\n      apiKey: process.env.TTS_OPEN_AI_COMPATIBLE_KEY || null,\n      baseURL: process.env.TTS_OPEN_AI_COMPATIBLE_ENDPOINT,\n    });\n    this.model = process.env.TTS_OPEN_AI_COMPATIBLE_MODEL ?? \"tts-1\";\n    this.voice = process.env.TTS_OPEN_AI_COMPATIBLE_VOICE_MODEL ?? \"alloy\";\n    this.#log(\n      `Service (${process.env.TTS_OPEN_AI_COMPATIBLE_ENDPOINT}) with model: ${this.model} and voice: ${this.voice}`\n    );\n  }\n\n  #log(text, ...args) {\n    console.log(`\\x1b[32m[OpenAiGenericTTS]\\x1b[0m ${text}`, ...args);\n  }","sourceCodeStart":1,"sourceCodeEnd":34,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/server/utils/TextToSpeech/openAiGeneric/index.js#L1-L34","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","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."],"exampleFix":"# before (.env)\nTTS_PROVIDER=generic-openai\n# -> Error: No OpenAI compatible endpoint was set...\n\n# after (.env)\nTTS_PROVIDER=generic-openai\nTTS_OPEN_AI_COMPATIBLE_ENDPOINT=http://localhost:8080/v1\nTTS_OPEN_AI_COMPATIBLE_MODEL=kokoro\nTTS_OPEN_AI_COMPATIBLE_VOICE_MODEL=af_sky","handlingStrategy":"validation","validationCode":"const canUseGenericOpenAiTTS = () =>\n  Boolean(process.env.TTS_OPEN_AI_COMPATIBLE_ENDPOINT);\n\nif (process.env.TTS_PROVIDER === \"generic-openai\" && !canUseGenericOpenAiTTS()) {\n  throw new Error(\"generic-openai TTS requires TTS_OPEN_AI_COMPATIBLE_ENDPOINT\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  tts = getTTSProvider();\n} catch (e) {\n  if (/No OpenAI compatible endpoint was set/.test(e.message))\n    return respondConfigError(\"TTS_OPEN_AI_COMPATIBLE_ENDPOINT missing\");\n  throw e;\n}","preventionTips":["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."],"tags":["env","configuration","tts","openai-compatible","self-hosted"],"backgroundTag":"missing-env-var","analyzedSha":"3aec848f2885144aa8f1e53b9731a04310d5d558","analyzedAt":"2026-08-18T10:02:21.017Z","contentChangedAt":"2026-08-18T10:02:21.017Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}