moeru-ai/airi · error

MiniMax TTS request failed: ${response.status} ${response.st

Error message

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

What it means

After forwarding the TTS request to MiniMax's /v1/t2a_v2 endpoint, the provider requires an ok HTTP response with a readable stream body (MiniMax streams SSE with hex-encoded audio chunks). A non-ok status or a missing/null body produces this error — an upstream API failure.

Source

Thrown at packages/provider-inference/src/providers/cloud/minimax-speech/index.ts:61

              text: body.input ?? '',
              stream: true,
              voice_setting: {
                voice_id: body.voice || 'English_Graceful_Lady',
                speed: 1,
                vol: 1,
                pitch: 0,
              },
              audio_setting: {
                sample_rate: 32000,
                bitrate: 128000,
                format: 'mp3',
                channel: 1,
              },
            }),
          })

          if (!response.ok || !response.body)
            throw new Error(`MiniMax TTS request failed: ${response.status} ${response.statusText}`)

          // MiniMax streams SSE events that contain hex-encoded audio chunks.
          const reader = response.body.getReader()
          const decoder = new TextDecoder()
          const audioChunks: Uint8Array[] = []
          let buffer = ''

          while (true) {
            const { done, value } = await reader.read()
            if (done)
              break

            buffer += decoder.decode(value, { stream: true })
            const lines = buffer.split('\n')
            buffer = lines.pop() || ''
            for (const line of lines) {
              if (!line.startsWith('data:'))
                continue

View on GitHub (pinned to f679616c34)

Solutions

  1. Log the response status and MiniMax's JSON error payload to identify the cause (auth, quota, or payload).
  2. Verify the MiniMax API key and account balance/quota.
  3. Confirm the voice and model ids are valid and enabled for your account.
  4. Retry with backoff on 429/5xx.
  5. Check that no proxy strips the response body; test the same request with curl.
Defensive patterns

Strategy: retry

Validate before calling

if (!apiKey) throw new Error('MiniMax API key required')
if (!text?.trim()) throw new Error('TTS input text required')

Try / catch

try { await tts(text) } catch (e) {
  if (/failed: (429|5\d\d)/.test(e.message)) await backoffRetry()
  else if (/401/.test(e.message)) notifyInvalidApiKey()
  else if (/402/.test(e.message)) notifyInsufficientQuota()
  else throw e
}

Prevention

When it happens

Trigger: MiniMax returns 401 (invalid API key), 400 (invalid voice/model/text), 402 (insufficient quota/credits), 429 (rate limited), or 5xx; or the response arrives without a body (rare, e.g. some proxies or mocks).

Common situations: Wrong or expired MiniMax API key; voice id not enabled for the account; account out of credits; text containing unsupported characters; streaming disabled by an intermediate proxy.

Related errors


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