
ソケットを通じたライブ文字起こしは、話者が話す間に部分的な結果を返し、音声活動検出で各文をマークします。
ソケットを通じたライブ文字起こしは、話者が話す間に部分的な結果を返し、音声活動検出で各文をマークします。
EmpirioLabs exposes the standard WEBSOCKET /v1/realtime endpoint and returns partial and final transcripts as the speaker talks.
別名 StepAudio ASR Stream, StepFun StepAudio 2.5 ASR Stream
stepaudio-2-5-asr-stream/v1/realtimestepaudio-2.5-asr-streamstepfun/stepaudio-2-5-asr-streamEmpirioLabs カタログのライブ従量課金料金です。使った分だけの支払いで、月額最低料金はありません。
StepAudio 2.5 ASR Stream は HTTP エンドポイントではなく、wss://api.empiriolabs.ai/v1/realtime?model=stepaudio-2-5-asr-stream の WebSocket 上でライブ音声ストリームを文字起こしします。モデル ID stepaudio-2-5-asr-stream で接続し、ハンドシェイク時に EmpirioLabs の API キーを Authorization: Bearer ヘッダーとして送信してください。base64 の 16 ビット PCM 音声を追加すると、話している最中から文字起こしイベントを受け取れます。 ブラウザは WebSocket にヘッダーを設定できないため、この接続はサーバーから開き、音声は自前のソケットでブラウザへ中継してください。 EmpirioLabs ダッシュボードで API キーを取得してください。
import asyncio, json, os, websockets
async def main():
async with websockets.connect(
"wss://api.empiriolabs.ai/v1/realtime?model=stepaudio-2-5-asr-stream",
additional_headers=[
("Authorization", f"Bearer {os.environ['EMPIRIOLABS_API_KEY']}"),
],
max_size=None,
) as ws:
print(json.loads(await ws.recv())["type"]) # session.created
import base64
# 16-bit PCM microphone audio, base64 encoded, in small chunks.
for chunk in read_microphone_chunks():
await ws.send(json.dumps({
"type": "input_audio_buffer.append",
"audio": base64.b64encode(chunk).decode(),
}))
await ws.send(json.dumps({"type": "input_audio_buffer.commit"}))
async for raw in ws:
event = json.loads(raw)
if event["type"].endswith("input_audio_transcription.delta"):
# "text" is settled transcript; "stash" is still in progress.
if event.get("text"):
print(event["text"], end="", flush=True)
asyncio.run(main())EmpirioLabs 上の StepAudio 2.5 ASR Stream API が対応するリクエストパラメーターです。フィールドを省略した場合はデフォルト値が適用されます。
| パラメータ | タイプ | デフォルト | 範囲 / 値 | 説明 |
|---|---|---|---|---|
| input_audio_format | enum | pcm16 | pcm16 | 入力バッファに追加するオーディオのエンコード:base64 16ビットPCM。 |
| language | enum | zh | en, zh, fr, es | 認識言語。 |
Live transcription over a WebSocket at wss://api.empiriolabs.ai/v1/realtime?model=stepaudio-2-5-asr-stream, authenticated with the ordinary Authorization Bearer header. Stream 16 kHz pcm16 audio up with input_audio_buffer.append and read partial results back as the speaker is still talking, with server-side voice activity detection marking where each sentence ends. Use this for live captions and voice input; for a finished recording, StepAudio 2.5 ASR returns the whole transcript in one call. Billing follows the duration of audio you stream, settled when the session closes.
EmpirioLabs では StepAudio 2.5 ASR Stream は従量課金です: 転写 $0.18 音声の時間あたり。このページのライブ料金表は常に API の請求額と一致します。
StepAudio 2.5 ASR Stream は api.empiriolabs.ai 上の WEBSOCKET /v1/realtime で提供され、標準的な Bearer トークン認証を使用します。
EmpirioLabs プレイグラウンド を開き、Start session を押すとブラウザーで試せます。StepAudio 2.5 ASR Stream はリクエストとレスポンスではなく WebSocket 上で動作するため、組み込むときは リアルタイム音声クイックスタート から始めてください。EmpirioLabs の API キーとモデル ID stepaudio-2-5-asr-stream を使ってサーバーから接続し、音声を双方向にストリーミングします。
EmpirioLabs アカウントを作成し、ダッシュボードの API Keysでキーを生成してください。課金は従量制クレジットなので、実行したリクエストの分だけ支払います。