decolua/9router · error · Error
No OpenRouter API key configured
Error message
No OpenRouter API key configured
What it means
The OpenRouter TTS provider requires credentials.apiKey; it throws locally before any network call when absent. OpenRouter proxies TTS to underlying models, so its key is mandatory. This is a pure configuration guard.
Source
Thrown at open-sse/handlers/ttsProviders/openrouter.js:8
// OpenRouter TTS — via chat completions + audio modality (SSE stream)
import { PROVIDER_MEDIA } from "../../providers/index.js";
const TTS_CFG = PROVIDER_MEDIA["openrouter"]?.ttsConfig || {};
export default {
async synthesize(text, model, credentials) {
if (!credentials?.apiKey) throw new Error("No OpenRouter API key configured");
// model format: "tts-model/voice" e.g. "openai/gpt-4o-mini-tts/alloy"
let ttsModel = TTS_CFG.defaultModel;
let voice = "alloy";
if (model && model.includes("/")) {
const lastSlash = model.lastIndexOf("/");
const maybVoice = model.slice(lastSlash + 1);
const maybeModel = model.slice(0, lastSlash);
if (maybeModel.includes("/")) {
ttsModel = maybeModel;
voice = maybVoice;
} else {
voice = model;
}
} else if (model) {
voice = model;
}
View on GitHub (pinned to 90b52e06ff)
Solutions
- Add an OpenRouter API key in the 9Router provider credentials
- Ensure the key is active on openrouter.ai/keys
- Restart/reload the gateway so credentials are re-read
- Or switch the TTS model to a provider whose credentials exist
Defensive patterns
Strategy: validation
Validate before calling
if (!credentials?.apiKey) throw new Error("Configure an OpenRouter API key before using OpenRouter TTS"); Type guard
function hasOpenRouterKey(c) {
return typeof c?.apiKey === "string" && c.apiKey.trim().length > 0;
} Try / catch
try {
await openrouterTts.synthesize(text, model, creds);
} catch (e) {
if (e.message === "No OpenRouter API key configured") {
notifyUser("Add an OpenRouter API key in provider settings");
} else throw e;
} Prevention
- Preflight-check that every TTS-enabled provider has a non-empty key
- Rotate keys on schedule and update the credential store
- Don't reuse chat-provider account objects for TTS without verifying fields
- Add startup health checks per enabled provider
When it happens
Trigger: Invoking TTS routed to OpenRouter without an OpenRouter API key stored in 9Router credentials, or with an empty apiKey string in the credentials object.
Common situations: OpenRouter added as a chat provider but no key saved for TTS use; key rotated/removed; wrong account object passed to the TTS handler.
Understand the failure class
Background: "API key is required" / "API key not found" / "No API key was set": the missing-api-key error family across 16 libraries — this error's family across 16 libraries.
Related errors
- ElevenLabs API key required
- No Gemini API key configured
- No OpenAI API key configured
- xiaomi-mimo API key required
- Upstream error (${res.status})
AI-assisted analysis of decolua/9router@90b52e06ff (2026-08-30).
Data as JSON: /api/errors/b2aef5a554eac251.
Report an issue: GitHub.