Skip to main content

Audio

Three endpoint groups: speech-to-text, audio translation, and text-to-speech (TTS). Transcription/translation upload files as multipart/form-data; TTS takes JSON and returns binary audio.

Transcriptions​

POST /v1/audio/transcriptions
curl https://test.kailin.com.cn/v1/audio/transcriptions \
-H "Authorization: Bearer sk-your-token" \
-F "file=@/path/to/audio.mp3" \
-F "model=whisper-1" \
-F "language=zh"

Fields (form-data)​

FieldTypeRequiredDescription
filefileYesAudio file (mp3/wav/m4a/webm etc., ≤25MB)
modelstringYeswhisper-1, gpt-4o-transcribe, gpt-4o-mini-transcribe, etc.
languagestringNoISO-639-1 code (e.g. zh) — improves accuracy
promptstringNoGuiding text to help spell proper nouns
response_formatstringNojson (default) / text / srt / verbose_json / vtt
temperaturenumberNoSampling temperature

Response​

{ "text": "This is the transcribed text." }

The verbose_json format additionally returns segments and timestamps (segments / duration).

Translations​

POST /v1/audio/translations

Translates audio content into English. Fields are the same as transcriptions (no language parameter):

curl https://test.kailin.com.cn/v1/audio/translations \
-H "Authorization: Bearer sk-your-token" \
-F "file=@/path/to/audio.mp3" \
-F "model=whisper-1"
{ "text": "This is the English translation of the audio." }

Text to Speech​

POST /v1/audio/speech
curl https://test.kailin.com.cn/v1/audio/speech \
-H "Content-Type: application/json" \
-H "Authorization: Bearer sk-your-token" \
-d '{
"model": "tts-1",
"voice": "alloy",
"input": "Welcome to AI Station."
}' \
--output speech.mp3

Request Body​

ParameterTypeRequiredDescription
modelstringYestts-1, tts-1-hd, gpt-4o-mini-tts, etc.
inputstringYesText to synthesize — up to 4096 characters
voicestringYesalloy / echo / fable / onyx / nova / shimmer, etc.
response_formatstringNomp3 (default) / opus / aac / flac / wav / pcm
speednumberNo0.25–4.0, default 1.0

Response​

On success the endpoint returns raw audio bytes (encoded per response_format). Save it as a file instead of parsing it as JSON.

caution

When using the web playground for transcription/translation, switch to the form mode to upload files. The TTS response is a binary stream — the playground embeds an audio player for it, but cURL/SDK validation is recommended.