I often get this error while using openai tts: ``...
# ask-ai
d
I often get this error while using openai tts:
Copy code
{
  "message": "Error in _tts_inference_task",
  "attributes": {
    "exc_info": "Traceback (most recent call last):\n  File \"/app/.venv/lib/python3.13/site-packages/livekit/agents/utils/log.py\", line 16, in async_fn_logs\n    return await fn(*args, **kwargs)\n           ^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/app/.venv/lib/python3.13/site-packages/opentelemetry/util/_decorator.py\", line 71, in async_wrapper\n    return await func(*args, **kwargs)  # type: ignore\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/app/.venv/lib/python3.13/site-packages/livekit/agents/voice/generation.py\", line 212, in _tts_inference_task\n    async for audio_frame in tts_node:\n    ...<3 lines>...\n        audio_ch.send_nowait(audio_frame)\n  File \"/app/.venv/lib/python3.13/site-packages/livekit/agents/voice/agent.py\", line 412, in tts_node\n    async for ev in stream:\n        yield ev.frame\n  File \"/app/.venv/lib/python3.13/site-packages/livekit/agents/tts/tts.py\", line 532, in __anext__\n    raise exc  # noqa: B904\n    ^^^^^^^^^\n  File \"/app/.venv/lib/python3.13/site-packages/opentelemetry/util/_decorator.py\", line 71, in async_wrapper\n    return await func(*args, **kwargs)  # type: ignore\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/app/.venv/lib/python3.13/site-packages/livekit/agents/tts/tts.py\", line 357, in _main_task\n    await self._run(output_emitter)\n  File \"/app/.venv/lib/python3.13/site-packages/livekit/agents/tts/stream_adapter.py\", line 131, in _run\n    await asyncio.gather(*tasks)\n  File \"/app/.venv/lib/python3.13/site-packages/livekit/agents/tts/stream_adapter.py\", line 121, in _synthesize\n    async for audio in tts_stream:\n        output_emitter.push(audio.frame.data.tobytes())\n        duration += audio.frame.duration\n  File \"/app/.venv/lib/python3.13/site-packages/livekit/agents/tts/tts.py\", line 291, in __anext__\n    raise exc  # noqa: B904\n    ^^^^^^^^^\n  File \"/app/.venv/lib/python3.13/site-packages/opentelemetry/util/_decorator.py\", line 71, in async_wrapper\n    return await func(*args, **kwargs)  # type: ignore\n           ^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/app/.venv/lib/python3.13/site-packages/livekit/agents/tts/tts.py\", line 231, in _main_task\n    await self._run(output_emitter)\n  File \"/app/.venv/lib/python3.13/site-packages/livekit/plugins/openai/tts.py\", line 230, in _run\n    raise APIStatusError(\n        e.message, status_code=e.status_code, request_id=e.request_id, body=e.body\n    ) from None\nlivekit.agents._exceptions.APIStatusError: Error code: 400 - {'error': {'message': '[{\\'type\\': \\'enum\\', \\'loc\\': (\\'body\\', \\'voice\\'), \\'msg\\': \"Input should be \\'nova\\', \\'shimmer\\', \\'echo\\', \\'onyx\\', \\'fable\\', \\'alloy\\', \\'ash\\', \\'sage\\' or \\'coral\\'\", \\'input\\': \\'verse\\', \\'ctx\\': {\\'expected\\': \"\\'nova\\', \\'shimmer\\', \\'echo\\', \\'onyx\\', \\'fable\\', \\'alloy\\', \\'ash\\', \\'sage\\' or \\'coral\\'\"}}]', 'type': 'invalid_request_error', 'param': None, 'code': None}} (status_code=400, request_id=req_176afc925c8c489d96a102cbe02fa938, body={'message': '[{\\'type\\': \\'enum\\', \\'loc\\': (\\'body\\', \\'voice\\'), \\'msg\\': \"Input should be \\'nova\\', \\'shimmer\\', \\'echo\\', \\'onyx\\', \\'fable\\', \\'alloy\\', \\'ash\\', \\'sage\\' or \\'coral\\'\", \\'input\\': \\'verse\\', \\'ctx\\': {\\'expected\\': \"\\'nova\\', \\'shimmer\\', \\'echo\\', \\'onyx\\', \\'fable\\', \\'alloy\\', \\'ash\\', \\'sage\\' or \\'coral\\'\"}}]', 'type': 'invalid_request_error', 'param': None, 'code': None}, retryable=False)",
    "level": "error",
    "name": "livekit.agents",
    "timestamp": "2025-08-30T09:29:01.715850+00:00"
  },
  "tags": {
    "project": "e0e6b762-2ef2-4dd3-98ba-3b863a4c4e49",
    "environment": "0dead8d7-9976-4ce3-9e41-815f5c443bd4",
    "service": "e82756c5-5805-413d-bf6b-b5d31ebe3db7",
    "deployment": "e7881b4d-22db-45dd-954e-d64fa35957ac",
    "replica": "6ba51d21-dd78-4b32-9d5d-5a7376b2e446"
  },
  "timestamp": "2025-08-30T09:29:01.718549991Z"
}
Is this related to livekit or to openai API ? How could I solve this issue ?
t
Thanks for reaching out, W. I'm an AI assistant and I'm here to help. Give me a moment while I research this topic.
Hey there! It looks like the error you're seeing is because the voice parameter in your OpenAI API call within LiveKit is set to "verse," which unfortunately isn’t one of the supported options. The OpenAI TTS API currently accepts these voices: "nova," "shimmer," "echo," "onyx," "fable," "alloy," "ash," "sage," or "coral." To fix this, just make sure you pick one of those voices in your request. If things still aren’t working, double-check your API key, your network connection, and any other input parameters to make sure everything’s in order. If you need a hand, I’m here to help! Sources: Events and error handling | LiveKit Docs | OpenAI integration guide | LiveKit Docs | livekit-agents/livekit/agents/voice/agent_session.py