Text to Audio
Text to Audio
Translate the text output by the Agent into voice playback.
Request Method
POST
Request URL
https://api-${endpoint}.gptbots.ai/v1/text-to-audio
Request Authentication
Please refer to Overview in API Reference.
Request
Request Example
curl -X POST 'https://api-${endpoint}.gptbots.ai/v1/text-to-audio' \
-H 'Authorization: Bearer ${API Key}' \
-H 'Content-Type: application/json' \
-d '{
"id": "Message id"
}'
curl -X POST 'https://api-${endpoint}.gptbots.ai/v1/text-to-audio' \
-H 'Authorization: Bearer ${API Key}' \
-H 'Content-Type: application/json' \
-d '{
"id": "Message id"
}'
Este bloque de código en una ventana flotante
Request Headers
| Field | Type | Description |
|---|---|---|
| Authorization | Bearer ${API Key} | Use Authorization: Bearer ${API Key} for authentication. Get API key from API Key page. |
| Content-Type | application/json | Data type, set to application/json. |
Request Body
| Field | Type | Required | Description |
|---|---|---|---|
| id | string | Yes | Message ID. |
Response
Response Example
Byte stream, streaming return.
Byte stream, streaming return.
Este bloque de código en una ventana flotante
Suceess Response
| Field | Type | Description |
|---|---|---|
| Byte[] | Byte stream. |
Failure Response
| Field | Type | Description |
|---|---|---|
| code | int | Error code. |
| message | string | Error details. |
Error Codes
| Code | Message |
|---|---|
| 40000 | Invalid parameter |
| 40107 | Credentials expired |
| 40127 | Developer authentication failed |
| 40325 | Invalid file type, only 'm4a', 'mp3', 'webm', 'mp4', 'mpga', 'wav', 'mpeg' supported |
| 50000 | Internal server error |
| 40113 | Unauthorized access to Agent. |
| 20059 | Agent deleted |
| 40371 | Voice content is empty |
| 40379 | Credit not enough |
