Mintplex-Labs/anything-llm · error · Error
No Kokoro endpoint was set. Please set TTS_KOKORO_ENDPOINT t
Error message
No Kokoro endpoint was set. Please set TTS_KOKORO_ENDPOINT to the base URL of your kokoro-fastapi server (e.g. http://localhost:8880/v1).
What it means
Thrown by the KokoroTTS constructor when process.env.TTS_KOKORO_ENDPOINT is falsy. Kokoro TTS targets a self-hosted kokoro-fastapi server via an OpenAI-compatible client, so the base URL is mandatory. The endpoint is normalized so its pathname ends with /v1. An invalid URL string (not a parseable URL) would throw a different error from `new URL(...)`.
Source
Thrown at server/utils/TextToSpeech/kokoro/index.js:4
class KokoroTTS {
constructor() {
if (!process.env.TTS_KOKORO_ENDPOINT)
throw new Error(
"No Kokoro endpoint was set. Please set TTS_KOKORO_ENDPOINT to the base URL of your kokoro-fastapi server (e.g. http://localhost:8880/v1)."
);
const endpoint = new URL(process.env.TTS_KOKORO_ENDPOINT);
if (!endpoint.pathname.endsWith("/v1")) endpoint.pathname = "/v1";
const { OpenAI: OpenAIApi } = require("openai");
this.openai = new OpenAIApi({
apiKey: process.env.TTS_KOKORO_KEY || null,
baseURL: endpoint.toString(),
});
this.model = "kokoro";
this.voice = process.env.TTS_KOKORO_VOICE_MODEL ?? "af_bella";
this.#log(
`Service (${process.env.TTS_KOKORO_ENDPOINT}) with voice: ${this.voice}`
);
}
View on GitHub (pinned to 526360e320)
Solutions
- Add TTS_KOKORO_ENDPOINT=http://<host>:8880/v1 to .env and restart (pathname is auto-corrected to /v1 if missing).
- Optionally set TTS_KOKORO_KEY if your kokoro-fastapi server requires auth.
- Verify the endpoint is reachable from the server container (curl http://<host>:8880/v1).
- Ensure the value is a parseable absolute URL (scheme + host).
Example fix
# before TTS_PROVIDER=kokoro # TTS_KOKORO_ENDPOINT missing # after TTS_PROVIDER=kokoro TTS_KOKORO_ENDPOINT=http://localhost:8880/v1
Defensive patterns
Strategy: validation
Validate before calling
if (process.env.TTS_PROVIDER === "kokoro" && !process.env.TTS_KOKORO_ENDPOINT) {
throw new Error("TTS_PROVIDER is 'kokoro' but TTS_KOKORO_ENDPOINT is not set.");
}
// also guard against an unparseable URL
if (process.env.TTS_KOKORO_ENDPOINT) {
try { new URL(process.env.TTS_KOKORO_ENDPOINT); }
catch { throw new Error("TTS_KOKORO_ENDPOINT is not a valid URL."); }
} Type guard
function isValidHttpUrl(v) {
try { new URL(v); return /^https?:/.test(new URL(v).protocol); }
catch { return false; }
} Try / catch
try {
return new KokoroTTS();
} catch (e) {
if (/No Kokoro endpoint/i.test(e.message)) {
logger.error("Set TTS_KOKORO_ENDPOINT (kokoro-fastapi base URL) in .env, then restart.");
}
throw e;
} Prevention
- Provide a parseable absolute URL with scheme + host (pathname auto-corrected to /v1).
- Verify the kokoro-fastapi server is reachable from the server container.
- Restart after editing .env.
When it happens
Trigger: TTS_PROVIDER=kokoro is set but TTS_KOKORO_ENDPOINT is missing/empty; the var was renamed; the var is set but the process was not restarted.
Common situations: Self-hosting kokoro-fastapi but forgetting to point AnythingLLM at it; switching to kokoro without completing its env block; Docker env not propagated.
Related errors
- No ElevenLabs API key was set.
- ENV: No TTS_PROVIDER value found in environment!
- No OpenAI API key was set.
- No OpenAI compatible endpoint was set. Please set this to us
- No Deepgram API key was set.
AI-assisted analysis of Mintplex-Labs/anything-llm@526360e320 (2026-08-13).
Data as JSON: /api/errors/41935d9baffd8c59.
Report an issue: GitHub.