メインコンテンツへスキップ

音声

3 つのエンドポイントグループがあります:音声→テキスト、音声翻訳、テキスト→音声(TTS)。文字起こし/翻訳はファイルを multipart/form-data でアップロードし、TTS は JSON を受け取ってバイナリ音声を返します。

文字起こし​

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"

フィールド(form-data)​

フィールド型必須説明
filefileはい音声ファイル(mp3/wav/m4a/webm など、≤25MB)
modelstringはいwhisper-1、gpt-4o-transcribe、gpt-4o-mini-transcribe など
languagestringいいえISO-639-1 コード(例:zh)— 精度が向上します
promptstringいいえ固有名詞の表記を補助するガイドテキスト
response_formatstringいいえjson(デフォルト)/ text / srt / verbose_json / vtt
temperaturenumberいいえサンプリング温度

レスポンス​

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

verbose_json 形式では、さらにセグメントとタイムスタンプ(segments / duration)も返されます。

音声翻訳​

POST /v1/audio/translations

音声の内容を英語に翻訳します。フィールドは文字起こしと同じです(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." }

テキスト読み上げ(TTS)​

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

リクエストボディ​

パラメーター型必須説明
modelstringはいtts-1、tts-1-hd、gpt-4o-mini-tts など
inputstringはい合成するテキスト — 最大 4096 文字
voicestringはいalloy / echo / fable / onyx / nova / shimmer など
response_formatstringいいえmp3(デフォルト)/ opus / aac / flac / wav / pcm
speednumberいいえ0.25–4.0、デフォルトは 1.0

レスポンス​

成功すると、エンドポイントは生の音声バイト列(response_format に従ってエンコード)を返します。JSON としてパースするのではなく、ファイルとして保存してください。

注意

Web プレイグラウンドで文字起こし/翻訳を利用する場合は、ファイルをアップロードできるフォームモードに切り替えてください。TTS のレスポンスはバイナリストリームです — プレイグラウンドでは音声プレーヤーが埋め込まれますが、cURL/SDK での動作確認を推奨します。