open-webui/open-webui · error · HTTPException
Mistral API key is required for Mistral TTS
Error message
Mistral API key is required for Mistral TTS
What it means
HTTP 400 raised in _tts_mistral (backend/open_webui/routers/audio.py) when the audio.tts.mistral.api_key config is empty. The Mistral TTS handler requires a Bearer token for POST {api_base_url}/audio/speech and fails fast before making the request.
Source
Thrown at backend/open_webui/routers/audio.py:513
},
)
sf.write(str(file_path), wav['audio'], samplerate=wav['sampling_rate'])
await asyncio.to_thread(_run_pipeline)
# Audio file already written by sf.write; just persist the request metadata.
async with aiofiles.open(file_body_path, 'w') as f:
await f.write(json.dumps(payload))
return FileResponse(file_path)
async def _tts_mistral(request, payload, file_path, file_body_path, user):
"""Generate speech via the Mistral TTS API."""
api_key = await Config.get('audio.tts.mistral.api_key')
api_base_url = await Config.get('audio.tts.mistral.api_base_url') or 'https://api.mistral.ai/v1'
if not api_key:
raise HTTPException(status_code=400, detail='Mistral API key is required for Mistral TTS')
r = None
try:
session = await get_session()
r = await session.post(
url=f'{api_base_url}/audio/speech',
json={
'input': payload.get('input', ''), # text to synthesize
'model': await Config.get('audio.tts.model') or 'voxtral-mini-tts-2603',
'voice_id': payload.get('voice', ''),
'response_format': 'mp3',
},
headers={
'Content-Type': 'application/json',
'Authorization': f'Bearer {api_key}',
},
ssl=AIOHTTP_CLIENT_SESSION_SSL,
)View on GitHub (pinned to 01f4282f1f)
Solutions
- Set the Mistral API key under Admin Settings > Audio (audio.tts.mistral.api_key) and retry.
- If configured via environment/config file, ensure the key value is non-empty and the backend is restarted.
- Confirm the key is valid by calling the Mistral API directly (e.g. their models endpoint) to rule out an auth mix-up.
Example fix
# before (env) AUDIO_TTS_ENGINE=mistral # no api key set # after AUDIO_TTS_ENGINE=mistral AUDIO_TTS_MISTRAL_API_KEY=<your-key>
Defensive patterns
Strategy: validation
Validate before calling
api_key = await Config.get('audio.tts.mistral.api_key')
if engine == 'mistral' and not api_key:
raise HTTPException(400, 'Configure audio.tts.mistral.api_key before using Mistral TTS') Prevention
- Validate engine-specific credentials in Admin Settings before saving the engine choice.
- Add a 'test connection' button that probes the provider when credentials are entered.
- Include required keys per engine in deployment checklists.
When it happens
Trigger: Selecting 'mistral' as audio.tts.engine in Admin Settings without entering a Mistral API key, or having the key stored as an empty string.
Common situations: Admin switched the TTS engine to Mistral but skipped the key field; the key was cleared during a config migration or reset; env-var-based key not passed into the container.
Related errors
- API key cannot be empty.
- No audio_data in Mistral TTS response
- We could not find what you're looking for :/
- Unsupported TTS engine: {engine}
- Mistral API key is required for Mistral STT
AI-assisted analysis of open-webui/open-webui@01f4282f1f (2026-08-14).
Data as JSON: /api/errors/2d4d3774d7d5e80c.
Report an issue: GitHub.