Aller au contenu principal

Audio

Trois groupes de points de terminaison : reconnaissance vocale, traduction audio et synthèse vocale (TTS). La transcription/traduction téléverse les fichiers en multipart/form-data ; le TTS accepte du JSON et renvoie de l'audio binaire.

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"

Champs (form-data)​

ChampTypeObligatoireDescription
filefileOuiFichier audio (mp3/wav/m4a/webm etc., ≤25MB)
modelstringOuiwhisper-1, gpt-4o-transcribe, gpt-4o-mini-transcribe, etc.
languagestringNonCode ISO-639-1 (ex. zh) — améliore la précision
promptstringNonTexte d'aide pour bien orthographier les noms propres
response_formatstringNonjson (défaut) / text / srt / verbose_json / vtt
temperaturenumberNonTempérature d'échantillonnage

Réponse​

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

Le format verbose_json renvoie en outre les segments et les horodatages (segments / duration).

Traductions​

POST /v1/audio/translations

Traduit le contenu audio en anglais. Les champs sont les mêmes que pour les transcriptions (sans le paramètre language) :

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

Synthèse vocale​

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

Corps de la requête​

ParamètreTypeObligatoireDescription
modelstringOuitts-1, tts-1-hd, gpt-4o-mini-tts, etc.
inputstringOuiTexte à synthétiser — jusqu'à 4096 caractères
voicestringOuialloy / echo / fable / onyx / nova / shimmer, etc.
response_formatstringNonmp3 (défaut) / opus / aac / flac / wav / pcm
speednumberNon0.25–4.0, défaut 1.0

Réponse​

En cas de succès, le point de terminaison renvoie les octets audio bruts (encodés selon response_format). Enregistrez-les dans un fichier au lieu de les analyser comme du JSON.

Avertissement

Lorsque vous utilisez le playground web pour la transcription/traduction, passez en mode formulaire pour téléverser des fichiers. La réponse TTS est un flux binaire — le playground y intègre un lecteur audio, mais une validation via cURL/SDK est recommandée.