TTS
Create a TTS request
POST
https://api.tunio.ai/ v1/ tts/ requestsQueue 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
| 名称 | 类型 | 说明 |
|---|---|---|
| format | string | Format of the resulting file: m4a (default), mp3 or wav. |
| model_id | string | Voice (model_id from GET /v1/tts/models, including the caller's cloned voices), required. |
| speed | number | Tempo multiplier, 0.7..1.8. Defaults to 1.0. |
| text | string | 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}
响应
| 名称 | 类型 | 说明 |
|---|---|---|
| request | object | The queued TTS request. |
| audio_url | string | Always null on create. |
| completed_at | string | Always null on create. |
| cost | string | Estimated cost in credits, as a decimal string; the amount is charged only when synthesis succeeds. |
| created_at | string | When the request was accepted. |
| duration | integer | Always null on create. |
| error | string | Always null on create. |
| expires_at | string | Always null on create. |
| format | string | Format of the resulting file. |
| model_id | string | Voice the text is spoken with. |
| request_id | string | Request ID. |
| speed | number | Tempo multiplier. |
| state | string | Always pending on create. |
| text | string | Text being synthesized. |
| success | boolean | Always true. |
| 名称 | 类型 | 说明 |
|---|---|---|
| max_length | integer | Maximum text length in characters, set with text_too_long. |
| message | string | Error code: invalid_body, text_required, text_too_long, invalid_speed, invalid_format or invalid_model. |
| success | boolean | Always false. |
| 名称 | 类型 | 说明 |
|---|---|---|
| message | string | Error code or human-readable error details. |
| success | boolean | Always false for error payloads. |
| 名称 | 类型 | 说明 |
|---|---|---|
| available_credits | string | Credits available on the account, as a decimal string. |
| message | string | Always insufficient_balance. |
| required_credits | string | Credits the request costs, as a decimal string. |
| success | boolean | Always false. |
| 名称 | 类型 | 说明 |
|---|---|---|
| max_pending | integer | Maximum number of pending or processing requests per account, set with too_many_pending_requests. |
| message | string | 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). |
| success | boolean | Always false. |
| 名称 | 类型 | 说明 |
|---|---|---|
| message | string | Error code or human-readable error details. |
| success | boolean | Always false for error payloads. |