API リファレンス
音声
対応モデルはまだありません
現在、モデル一覧にこのルートに対応するモデルはありません。このページは参考として残しています。
POST
/v1/audio/speechPOST
/v1/audio/transcriptionsPOST
/v1/audio/translations双方向の音声処理:/v1/audio/speech はテキストを音声のバイト列に合成し、/v1/audio/transcriptions は音声をテキストに変換します(Whisper 互換)。/v1/audio/translations は直接英語に文字起こしします。
#リクエストパラメーター
modelstring必須speech には tts-1 系、文字起こしには whisper-1 系を使います。
inputstring必須speech のみ:読み上げるテキスト。
voicestring必須speech のみ:ボイス名(alloy、nova、…)。利用できるボイスはモデルカードを参照してください。
filefile (multipart)必須transcriptions のみ:音声ファイル(mp3、wav、m4a、webm …)。
languagestring任意transcriptions のみ:精度を高めるための ISO-639-1 言語ヒント。
response_formatstring任意speech:mp3 | wav | opus …、transcriptions:json | text | srt | verbose_json。
speednumber任意speech のみ:再生速度 0.25–4.0。
2 種類の Content-Type
speech は JSON ボディを受け取り、生の音声バイト列を返します。transcriptions/translations は multipart/form-data を受け取り、JSON を返します。両者を混同しないでください。
#関連するエラー
- 413 payload_too_largeリクエストボディ(プロンプト、画像、または音声ファイル)が許容サイズを超えています。
- 401Bearer トークンが無効か、ありません。このパスでは error.code が付きません — ステータスで判定してください。
- 402 insufficient_user_quotaウォレット残高が事前確保の見積額に足りません。
- 429キー単位のレート制限です。ボディは空なので、Retry-After の時間だけ待ってください。insufficient_user_quota が付いた 429 は、レート制限ではなく 1 日の利用上限額によるものです。
- 503 model_not_found不明なモデルか、現在そのモデルを提供できる正常なチャネルがありません。
#リクエスト例
# text → speech (bytes saved to file)
curl https://www.aisplice.store/v1/audio/speech \
-H "Authorization: Bearer sk-YOUR_KEY" \
-H "Content-Type: application/json" \
-d '{"model": "tts-1", "voice": "alloy", "input": "Hello from the gateway."}' \
--output hello.mp3
# speech → text (multipart)
curl https://www.aisplice.store/v1/audio/transcriptions \
-H "Authorization: Bearer sk-YOUR_KEY" \
-F file=@meeting.mp3 -F model=whisper-1#レスポンス
response.json
// /v1/audio/speech → binary audio body (Content-Type: audio/mpeg)
// /v1/audio/transcriptions
{"text": "…transcript…"}まだ解決しませんか?
リクエスト ID かエラーメッセージを送っていただければ、こちらで調査します。