Voice and Text
Last updated:2023-11-02

Voice and Text

Converting voice and text to each other.

Voice-to-Text

Convert input audio content to text output.

Request Method

POST

Request URL

https://api.gptbots.ai/v1/bot/detail

Request Authentication

See Overview for authentication details.

Request

Request Example

curl -X POST https://api.gptbots.ai/v1/identify \ -H 'Authorization: Bearer your_apikey' \ -H 'Content-Type: multipart/form-data' \ -F 'file=@'
          curl -X POST https://api.gptbots.ai/v1/identify \
  -H 'Authorization: Bearer your_apikey' \
  -H 'Content-Type: multipart/form-data' \
  -F 'file=@'

        
This code block in the floating window

Request Headers

Field Type Description
Authorization Bearer ${token} Use Authorization: Bearer ${token} for authentication. Get the key from the API Keys page as token.
Content-Type multipart/form-data Data type, set to multipart/form-data.

Request Body

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?"
}

        
This code block in the floating window

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 Bot 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

Text-to-Audio

Translate the text output by the Bot into voice playback.

Request Method

POST

Request URL

https://api.gptbots.ai/v1/text-to-audio

Request Authentication

See Overview for authentication details.

Request

Request Example

curl -X POST https://api.gptbots.ai/v1/text-to-audio \ -H 'Authorization: Bearer your_apikey' \ -H 'Content-Type: application/json' \ -d '{ "id": "Message id" }'
          curl -X POST https://api.gptbots.ai/v1/text-to-audio \ 
    -H 'Authorization: Bearer your_apikey' \ 
    -H 'Content-Type: application/json' \ 
    -d '{
        "id": "Message id"
    }'

        
This code block in the floating window

Request Headers

Field Type Description
Authorization Bearer ${token} Use Authorization: Bearer ${token} for authentication. Get the key from the API Keys page as token.
Content-Type application/json Data type, set to application/json.

Request Body

Field Type Required Description
id string Yes 消息 ID。

Response

Response Example

Byte stream, streaming return.
          Byte stream, streaming return.

        
This code block in the floating window

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 Bot.
20059 Bot deleted
40371 Voice content is empty
40379 Credit not enough