decolua/9router · error · Error

xiaomi-mimo API key required

Error message

xiaomi-mimo API key required

What it means

The Xiaomi MiMo TTS provider's synthesize() guard requires credentials.apiKey; without it it throws synchronously before calling synthesizeMiMo. Pure local configuration check — no network involved.

Source

Thrown at open-sse/handlers/ttsProviders/xiaomi-mimo.js:13

// Xiaomi MiMo TTS — via OpenAI-compatible chat completions (non-streaming).
// Docs: https://mimo.mi.com/docs/zh-CN/quick-start/usage-guide/audio/speech-synthesis-v2.5
// Message contract: target text in `role: assistant` content, style/voice
// instructions in `role: user` content. Voice is selected via the top-level
// `audio.voice` field (NOT embedded in the model name).
import { parseModelVoice } from "./_base.js";

const DEFAULT_MODEL = "mimo-v2.5-tts";
const DEFAULT_VOICE = "mimo_default";

export default {
  synthesize(text, model, credentials, responseFormat, { style, language } = {}) {
    if (!credentials?.apiKey) throw new Error("xiaomi-mimo API key required");
    return synthesizeMiMo(text, model, credentials.apiKey, style, language);
  },
};

export async function synthesizeMiMo(text, model, apiKey, style, language) {
  const { modelId, voiceId } = parseModelVoice(model, DEFAULT_MODEL, DEFAULT_VOICE, [DEFAULT_MODEL]);

  // Language and style are soft instructions → prepend as a role:user message.
  // MiMo auto-detects the spoken language of the text; the hint only nudges it
  // (e.g. "Speak in English.") and is independent of the chosen voice.
  const instructions = [];
  if (language) instructions.push(`Speak in ${language}.`);
  if (style) instructions.push(style);

  const messages = [{ role: "assistant", content: text }];
  if (instructions.length) messages.unshift({ role: "user", content: instructions.join(" ") });

  const res = await fetch("https://api.xiaomimimo.com/v1/chat/completions", {

View on GitHub (pinned to 90b52e06ff)

Solutions

  1. Configure a Xiaomi MiMo API key in the 9Router provider credentials
  2. Verify the key is valid on the Xiaomi open platform console
  3. Restart the gateway so credential caches reload
  4. Switch to a TTS provider that has credentials configured
Defensive patterns

Strategy: validation

Validate before calling

if (!credentials?.apiKey) throw new Error("Configure a Xiaomi MiMo API key before using xiaomi-mimo TTS");

Type guard

function hasMiMoKey(c) {
  return typeof c?.apiKey === "string" && c.apiKey.trim().length > 0;
}

Try / catch

try {
  await mimoTts.synthesize(text, model, creds);
} catch (e) {
  if (e.message === "xiaomi-mimo API key required") {
    notifyUser("Add a Xiaomi MiMo API key in provider settings");
  } else throw e;
}

Prevention

When it happens

Trigger: Calling TTS routed to xiaomi-mimo with no Xiaomi API key stored in 9Router credentials, or a credential entry with an empty/undefined apiKey.

Common situations: MiMo added as a model but key never configured; key revoked/expired on the Xiaomi open platform; wrong credentials object passed by the caller.

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


AI-assisted analysis of decolua/9router@90b52e06ff (2026-08-30). Data as JSON: /api/errors/f43a641f06f3faaa. Report an issue: GitHub.