Voice
You're Claude Code, working in my repository.
Task
Add a small Voice API client module to my project, typed with the Voice schemas page: transcribe(file, options), which posts the two-part multipart request to POST /v1/asr/transcribe and returns the parsed TranscribeResponse (start from the starter code), and realtime(audio, options), which opens wss://api.meta.ai/v1/asr/realtime, sends the handshake, streams PCM at real-time pace and yields each server event (start from the Python example on https://dev.meta.ai/docs/api-reference/voice/realtime.md).
Read this first
Meta's docs page "Voice" as Markdown: https://dev.meta.ai/docs/api-reference/voice.md
It's the source of truth for request and response shapes. The same page for people: https://dev.meta.ai/docs/api-reference/voice
Setup
- Base URL: https://api.meta.ai/v1
- Auth: send Authorization: Bearer $MODEL_API_KEY, reading MODEL_API_KEY from the environment. Never hard-code, print or commit the key.
- Model: muse-voice-transcribe-1.0
- Python: the OpenAI SDK (pip install openai) with base_url="https://api.meta.ai/v1" and api_key=os.environ["MODEL_API_KEY"] works, or plain requests.
Facts to get right
- transcribe authenticates with the Authorization header; realtime ignores that header and takes the key in its handshake frame's authorization.accessToken.
- Both run muse-voice-transcribe-1.0 with the same modes (PUSH_TO_TALK default, ENDPOINTING, DIARIZATION), keywords and languageBias. transcribe needs audioEncoding "WAV"; the handshake needs PCM_24KHZ or PCM_16KHZ.
- sessionId is an optional query parameter on both, echoed back for log correlation.
- Both share one rate budget: 256 concurrent streams and 16,000 streams an hour per team. transcribe answers 429; realtime closes with 1013.
Starter code (Python)
import json
import os
import requests
request = {"model": "muse-voice-transcribe-1.0", "audioEncoding": "WAV", "mode": "DIARIZATION", "keywords": ["Acme Mobile", "eSIM"]}
with open("meeting.wav", "rb") as audio:
response = requests.post(
"https://api.meta.ai/v1/asr/transcribe",
params={"sessionId": "my-session-id"},
headers={"Authorization": f"Bearer {os.environ['MODEL_API_KEY']}", "Accept": "application/json"},
files={
"request": (None, json.dumps(request), "application/json"),
"audio": ("meeting.wav", audio, "audio/wav"),
},
)
response.raise_for_status()
reply = response.json()
print(reply["transcript"], reply["audioDurationMs"])
for turn in reply["turns"]: # can be empty
print(turn.get("speaker", "?"), turn["startMs"], turn["endMs"], turn["transcript"])
Done when
- transcribe() on a WAV returns an object with transcript, turns, audioDurationMs and sessionId.
- realtime() yields speechStart, transcript and speechComplete events and finishes when the socket closes with 1000.
- The key comes from MODEL_API_KEY and never appears in code, logs or commits.
- API errors (4xx, 429) surface their message instead of failing silently.3,021 characters
The audio endpoints transcribe speech to text. Transcribe a complete recording in one request, or stream live audio over a WebSocket and receive transcripts as the audio arrives.
For modes, speaker labels, endpointing, and worked examples, see the Speech to text feature page.
Mirrored from dev.meta.ai/docs/api-reference/voice (synced Oct 30, 2026). Text and examples © Meta. Live demos run on Muse Muse's key.