TTS

Create a TTS request

POST
https://api.tunio.ai/v1/tts/requests

Queue text for speech synthesis with a catalog voice or one of the caller's cloned voices. Poll GET /v1/tts/requests/{request_id} until the state is completed, then download audio_url. Credits are charged only when synthesis succeeds; up to 20 requests may be pending or processing per account. Rate limited to 60 calls per minute per account across the TTS request endpoints.

请求体

Text, voice and output format

名称类型说明
formatstring
Format of the resulting file: m4a (default), mp3 or wav.
model_idstring
Voice (model_id from GET /v1/tts/models, including the caller's cloned voices), required.
speednumber
Tempo multiplier, 0.7..1.8. Defaults to 1.0.
textstring
Text to synthesize, required: 1..2000 characters after trimming.
请求示例
01{
02 "format": "mp3",
03 "model_id": "string",
04 "speed": 1,
05 "text": "Welcome to our store! Today all coffee is 20% off."
06}

响应

名称类型说明
requestobject
The queued TTS request.
audio_urlstring
Always null on create.
completed_atstring
Always null on create.
coststring
Estimated cost in credits, as a decimal string; the amount is charged only when synthesis succeeds.
created_atstring
When the request was accepted.
durationinteger
Always null on create.
errorstring
Always null on create.
expires_atstring
Always null on create.
formatstring
Format of the resulting file.
model_idstring
Voice the text is spoken with.
request_idstring
Request ID.
speednumber
Tempo multiplier.
statestring
Always pending on create.
textstring
Text being synthesized.
successboolean
Always true.
名称类型说明
max_lengthinteger
Maximum text length in characters, set with text_too_long.
messagestring
Error code: invalid_body, text_required, text_too_long, invalid_speed, invalid_format or invalid_model.
successboolean
Always false.
名称类型说明
messagestring
Error code or human-readable error details.
successboolean
Always false for error payloads.
名称类型说明
available_creditsstring
Credits available on the account, as a decimal string.
messagestring
Always insufficient_balance.
required_creditsstring
Credits the request costs, as a decimal string.
successboolean
Always false.
名称类型说明
max_pendinginteger
Maximum number of pending or processing requests per account, set with too_many_pending_requests.
messagestring
too_many_pending_requests (the account already has max_pending requests pending or processing) or rate_limited (more than 60 calls a minute; see Retry-After).
successboolean
Always false.
名称类型说明
messagestring
Error code or human-readable error details.
successboolean
Always false for error payloads.