音声
3 つのエンドポイントグループがあります:音声→テキスト、音声翻訳、テキスト→音声(TTS)。文字起こし/翻訳は ファイルを multipart/form-data でアップロードし、TTS は JSON を受け取ってバイナリ音声を返します。
文字起こし
POST /v1/audio/transcriptionscurl 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)
| フィールド | 型 | 必須 | 説明 |
|---|---|---|---|
file | file | はい | 音声ファイル(mp3/wav/m4a/webm など、≤25MB) |
model | string | はい | whisper-1、gpt-4o-transcribe、gpt-4o-mini-transcribe など |
language | string | いいえ | ISO-639-1 コード(例:zh)— 精度が向上します |
prompt | string | いいえ | 固有名詞の表記を補助するガイドテキスト |
response_format | string | いいえ | json(デフォルト)/ text / srt / verbose_json / vtt |
temperature | number | いいえ | サンプリング温度 |
レスポンス
{ "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/speechcurl 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