Create an ASR Model
Create anOpenAIASRModel with an OpenAICredential. The default model is
gpt-4o-mini-transcribe:
Transcribe Audio
transcribe() accepts the complete audio as bytes. Pass the original
filename so the provider can identify the in-memory audio format:
audio value or filename raises ValueError.
Keyword arguments passed directly to transcribe() override values from the
model’s Parameters object for that call.
Read the Response
transcribe() returns an ASRResponse:
Batch models return a final response with
is_last=True. Realtime models may
return intermediate responses with is_last=False from push().
Discover Available Models
ASR model cards describe supported audio types, output types, realtime capability, and the provider parameter schema. Discover them from either the credential or the model class:Implement a Custom ASR Model
SubclassASRModelBase and implement transcribe() for a batch provider:
realtime=True, implement connect(), push(), and
close(), and use the model as an asynchronous context manager. Send audio
chunks through push() and call transcribe() without audio to finalize the
current transcript.
DashScopeRealtimeASRModel implements this lifecycle for PCM audio.
Configure its sample rate to match the audio you send. Batch DashScope
transcription uses DashScopeASRModel with a DashScopeCredential.Browser Speech Input
The Agent Service exposesGET /asr-model/ for model discovery and POST /asr/transcriptions
for uploaded audio. For streaming input, request a short-lived token with
POST /asr/realtime/token, then connect to the /asr/realtime WebSocket.
WebSocket traffic is not represented in the OpenAPI reference.