moeru-ai/airi · error

MiMo TTS request failed: ${response.status} ${response.statu

Error message

MiMo TTS request failed: ${response.status} ${response.statusText}

What it means

The MiMo chat/completions-based TTS endpoint returned a non-OK status, or returned OK with no response body. The provider raises a single error carrying the HTTP status and statusText so the developer can diagnose the API-side rejection.

Source

Thrown at packages/provider-inference/src/providers/cloud/mimo-audio/index.ts:113

        }

        if (model === 'mimo-v2.5-tts-voicedesign' && !stylePrompt)
          throw new Error('MiMo voice design requires a style prompt in the user message.')

        const response = await fetch(new URL('chat/completions', baseUrl), {
          method: 'POST',
          headers: { 'Content-Type': 'application/json', 'api-key': apiKey },
          body: JSON.stringify({
            model,
            messages: [
              { role: 'user', content: userPrompt },
              { role: 'assistant', content: body.input ?? '' },
            ],
            audio,
          }),
        })
        if (!response.ok || !response.body)
          throw new Error(`MiMo TTS request failed: ${response.status} ${response.statusText}`)

        const data = await response.json() as {
          choices?: Array<{ message?: { audio?: { data?: string } } }>
        }
        const audioBase64 = data.choices?.[0]?.message?.audio?.data
        if (!audioBase64)
          throw new Error('MiMo TTS response missing audio data')

        const binary = atob(audioBase64)
        const bytes = new Uint8Array(binary.length)
        for (let index = 0; index < binary.length; index++)
          bytes[index] = binary.charCodeAt(index)

        let contentType = `audio/${format}`
        if (format === 'wav')
          contentType = 'audio/wav'
        else if (format === 'mp3')
          contentType = 'audio/mpeg'

View on GitHub (pinned to f679616c34)

Solutions

  1. Check the status/statusText in the message; 401/403 means fix the API key, 404 means check model id and baseUrl
  2. Verify the 'api-key' header value and that baseUrl points to the correct MiMo endpoint
  3. Confirm the TTS model id (mimo-v2.5-tts / voiceclone / voicedesign) is enabled for your account
  4. Retry with backoff on 429/5xx
  5. Ensure a response body is present (the provider also rejects OK-with-no-body responses)
Defensive patterns

Strategy: retry

Validate before calling

// pre-flight
if (!apiKey) throw new Error('Missing MiMo api-key')
if (!/^https?:\/\//.test(baseUrl)) throw new Error('Invalid MiMo baseUrl')

Try / catch

try {
  const audio = await speech({ input, model })
} catch (e) {
  if (e instanceof Error && e.message.startsWith('MiMo TTS request failed:')) {
    const status = Number(e.message.match(/failed: (\d+)/)?.[1])
    if (status === 429 || status >= 500) await retryWithBackoff()
    else if (status === 401 || status === 403) fixApiKey()
    else if (status === 404) fixModelOrBaseUrl()
  }
}

Prevention

When it happens

Trigger: MiMo API rejects the request: invalid api-key header, unknown model id, malformed audio options, quota/auth failures, or a 5xx outage; also when response.ok but response.body is null.

Common situations: Wrong or missing API key, using a MiMo model id not available to the account, incorrect baseUrl pointing at a non-MiMo endpoint, or transient server errors.

Understand the failure class

Background: "API error: {status}" and "HTTP 401/403/404/429/5xx" errors: non-2xx HTTP responses explained — this error's family across 27 libraries.

Related errors


AI-assisted analysis of moeru-ai/airi@f679616c34 (2026-09-08). Data as JSON: /api/errors/e8f3e0ab3aa8c735. Report an issue: GitHub.