Audio Generation
POST
https://api.oneinfer.ai/v1/ula/generate-audioGenerate audio from text using the universal text-to-speech API. Name a TTS model and provide the text to speak; OneInfer picks the provider that serves the model.
Request headers
AuthorizationstringrequiredBearer token for authentication. Format:
Bearer <YOUR_TOKEN>. Exchange your API key for a token via the Authentication endpoint.Content-TypestringrequiredSet to application/json for all audio generation requests.
Request parameters
modelstringrequiredThe speech model, by its name in the model catalog (e.g. "hexgrad/Kokoro-82M", "Qwen/Qwen3-TTS-VoiceDesign", "sarvam/bulbul:v3"). OneInfer picks the provider that serves it; the response's
provider field says which one did.promptstringrequiredText to synthesize into speech. Each model takes up to a set number of characters; the Get Supported Voice for Audio Models endpoint gives it as
max_characters.streambooleanIf true, returns chunked audio bytes directly instead of JSON metadata.
voice_idstringThe voice. Most models take a preset voice name; get each model's voices and default from the Get Supported Voice for Audio Models endpoint. For Qwen/Qwen3-TTS-VoiceDesign, describe the voice in words instead, e.g. "a calm, deep male narrator with a British accent". Leave it out for models that have their own voice, such as ResembleAI/chatterbox-turbo.
formatstringOutput audio format (e.g. mp3, wav). Use mp3 when streaming.
Example request
Example TTS Request
{
"model": "sarvam/bulbul:v3",
"prompt": "Namaste from OneInfer audio generation.",
"stream": false,
"voice_id": "shubh",
"format": "mp3",
"speed": 1.0,
"volume": 1.0,
"pitch": 0
}Example TTS Request: a voice described in words (Qwen3-TTS VoiceDesign)
{
"model": "Qwen/Qwen3-TTS-VoiceDesign",
"prompt": "Welcome back. Here is what changed this week.",
"stream": false,
"voice_id": "a calm, deep male narrator with a British accent",
"format": "mp3"
}Response
JSON
{
"api_details": {
"api_status": "success",
"api_message": "API has returned response successfully."
},
"data": {
"id": "aud_12345abcde",
"created": 1711468800,
"text": "Generated audio for prompt: Namaste from OneInfer audio generation.",
"finish_reason": "stop",
"provider": "sarvam",
"model": "bulbul:v3",
"usage": {
"prompt_tokens": 7,
"completion_tokens": 0,
"total_tokens": 7
},
"latency_ms": 980,
"audios": [
{
"url": "data:audio/mpeg;base64,....",
"format": "mp3",
"base64_data": "...",
"mime_type": "audio/mpeg"
}
]
},
"error": {}
}Error status codes
| Code | Status | Description |
|---|---|---|
200 | OK | Audio generated successfully. |
400 | Bad Request | Invalid request body or unsupported model. |
401 | Unauthorized | Missing or invalid Authorization header / Bearer token. |
403 | Forbidden | Insufficient credit balance. |
422 | Unprocessable Entity | Request body failed schema validation. |
500 | Internal Server Error | Unexpected error during audio generation. |