9. 音声(Audio)#
9.1 音声合成(TTS)#
POST /v1/audio/speech — テキストを音声に変換し、音声バイトストリームを返します(例:audio/mpeg)。そのままファイルに書き込めます。
| パラメータ | 型 | 必須 | 説明 |
|---|---|---|---|
model | string | はい | TTS モデル名 |
input | string | はい | 合成するテキスト |
voice | string | いいえ | 音色 |
cURL
curl http://183.240.79.21:52099/v1/audio/speech \
-H "Authorization: Bearer sk-你的YiTuoToken-Key" \
-H "Content-Type: application/json" \
-d '{
"model": "tts-1",
"input": "你好,欢迎使用 YiTuoToken",
"voice": "alloy"
}' \
--output speech.mp3
9.2 音声認識(STT)#
POST /v1/audio/transcriptions — 音声をテキストに変換します(Whisper)。multipart/form-data で音声ファイルをアップロードします。
| フィールド | 必須 | 説明 |
|---|---|---|
file | はい | 音声ファイル |
model | はい | 認識モデル名 |
language | いいえ | 言語コード。例:zh |
prompt | いいえ | プロンプト |
response_format | いいえ | 応答形式 |
temperature | いいえ | サンプリング温度 |
cURL
curl http://183.240.79.21:52099/v1/audio/transcriptions \
-H "Authorization: Bearer sk-你的YiTuoToken-Key" \
-F file=@./audio.mp3 \
-F model="whisper-1" \
-F language="zh"