AGTCloud API Docs
GuidesAPI ReferenceIntegrations and resourcesUpdate and help

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

TaskDescriptionMain result
Speech synthesisConvert text into speechBinary audio
Audio transcriptionConvert audio into text in the source languageJSON, text, or subtitles
Audio translationConvert audio into English textJSON, text, or subtitles

API access

Base URL

https://api.agtcloud.cn/v1

Speech 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
ParameterRequiredDescription
modelYesText-to-speech model ID
inputYesText to synthesize
voiceYesVoice used for generated speech
response_formatNoAudio output format
speedNoSpeech 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'
ParameterRequiredDescription
fileYesAudio file to transcribe
modelYesTranscription model ID
languageNoISO-639-1 language code for the input audio
response_formatNoOutput 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'
ParameterRequiredDescription
fileYesNon-English audio file to translate
modelYesAudio translation model ID
promptNoEnglish text that guides output style
response_formatNoOutput format for the translation

Translations returns English text. In the basic JSON response, the result is in text.

Handle responses

APIHandling
SpeechSave binary audio using the response format
TranscriptionsProcess JSON, text, or subtitles according to response_format
TranslationsProcess the English text according to response_format

Learn more

On this page