メインコンテンツまでスキップ

Transcription Streaming API

stream=trueとresponse_format=jsonを指定して、SSEで最終文字起こし結果を受信します。

POST /v1/audio/transcriptions

KITSCH_OPENAI_BASE_URLには末尾が/v1のAudio API URLを設定します。

curl "$KITSCH_OPENAI_BASE_URL/audio/transcriptions" \
-H "Authorization: Bearer $KITSCH_API_KEY" \
-F "file=@speech.wav" -F "model=kitsch-stt-v1" \
-F "response_format=json" -F "stream=true"

応答​

Content-Type: text/event-stream.

event: transcript.text.done
data: {"type":"transcript.text.done","text":"Hello.","usage":{"type":"duration","seconds":1}}

transcript.text.doneのtextは最終文字起こし結果、usage.secondsは音声の長さです。