Audio
Synthesize speech, transcribe audio, and translate audio into English.
Overview
AGTCloud audio APIs support speech synthesis, audio transcription, and audio translation. Each task uses a different input format and returns either audio bytes or text.
Supported tasks
| Task | Description | Main result |
|---|---|---|
| Speech synthesis | Convert text into speech | Binary audio |
| Audio transcription | Convert audio into text in the source language | JSON, text, or subtitles |
| Audio translation | Convert audio into English text | JSON, text, or subtitles |
API access
Base URL
https://api.agtcloud.cn/v1Speech synthesis
curl 'https://api.agtcloud.cn/v1/audio/speech' \
-H 'Authorization: Bearer your-api-key' \
-H 'Content-Type: application/json' \
--data '{
"model": "MODEL_ID",
"input": "Welcome to AGTCloud.",
"voice": "alloy"
}' \
--output speech.mp3| Parameter | Required | Description |
|---|---|---|
model | Yes | Text-to-speech model ID |
input | Yes | Text to synthesize |
voice | Yes | Voice used for generated speech |
response_format | No | Audio output format |
speed | No | Speech speed |
Speech returns audio bytes. Save them using the actual response format instead of parsing the response as JSON.
Audio transcription
curl 'https://api.agtcloud.cn/v1/audio/transcriptions' \
-H 'Authorization: Bearer your-api-key' \
-F 'file=@meeting.mp3' \
-F 'model=MODEL_ID'| Parameter | Required | Description |
|---|---|---|
file | Yes | Audio file to transcribe |
model | Yes | Transcription model ID |
language | No | ISO-639-1 language code for the input audio |
response_format | No | Output format for the transcript |
Transcriptions uploads audio as multipart data. In the basic JSON response, the transcript is in text.
Audio translation
curl 'https://api.agtcloud.cn/v1/audio/translations' \
-H 'Authorization: Bearer your-api-key' \
-F 'file=@chinese.mp3' \
-F 'model=MODEL_ID'| Parameter | Required | Description |
|---|---|---|
file | Yes | Non-English audio file to translate |
model | Yes | Audio translation model ID |
prompt | No | English text that guides output style |
response_format | No | Output format for the translation |
Translations returns English text. In the basic JSON response, the result is in text.
Handle responses
| API | Handling |
|---|---|
| Speech | Save binary audio using the response format |
| Transcriptions | Process JSON, text, or subtitles according to response_format |
| Translations | Process the English text according to response_format |