Voice to Text
Voice to Text
Convert input audio content to text output.
Request Method
POST
Request URL
https://api-${endpoint}.gptbots.ai/v1/audio-to-text
Request Authentication
Please refer to Overview in API Reference.
Request
Request Example
curl -X POST 'https://api-${endpoint}.gptbots.ai/v1/audio-to-text' \
-H 'Authorization: Bearer ${API Key}' \
-H 'Content-Type: multipart/form-data' \
-F 'file=@/path/to/your/audio/file.mp3'
curl -X POST 'https://api-${endpoint}.gptbots.ai/v1/audio-to-text' \
-H 'Authorization: Bearer ${API Key}' \
-H 'Content-Type: multipart/form-data' \
-F 'file=@/path/to/your/audio/file.mp3'
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 | multipart/form-data | Data type, set to multipart/form-data. |
Request Parameters
| Field | Type | Required | Description |
|---|---|---|---|
| file | Byte[] | Yes | Audio file, max 25 MB. Supported formats: mp3 |
Response
Response Example
{
"text": "Hi, is there anything I can help you?"
}
{
"text": "Hi, is there anything I can help you?"
}
Este bloque de código en una ventana flotante
Success Response
| Field | Type | Description |
|---|---|---|
| text | string | Recognized text. |
Failure Response
| Field | Type | Description |
|---|---|---|
| code | int | Error code. |
| message | string | Error details. |
Error Codes
| Code | Message |
|---|---|
| 40000 | Invalid parameter |
| 40127 | Developer authentication failed |
| 40325 | Invalid file type, only 'm4a', 'mp3', 'webm', 'mp4', 'mpga', 'wav', 'mpeg' supported |
| 50000 | Internal server error |
| 20059 | Agent deleted |
| 200116 | Multi-modal voice input function is not turned on |
| 40353 | The function is only available after upgrading the package. |
| 40326 | limited to 25 MB |
| 20059 | bot deleted |
| 20022 | credit not enough |
