Skip to content
speechinfraConsole

AssemblyAI · Realtime ASR

Universal-3 Realtime Pro

Low-latency streaming ASR for live conversations and responsive voice applications.

universal-3-realtime-pro
$0.005 / audio minuteTry in Console

Current model-specific price from our catalog. Requests require your project API key and sufficient balance. Availability is checked at execution time.

Input and capabilities

Connect over WebSocket. After session.updated, send mono PCM16 little-endian audio at 16 kHz. The direct streaming session supports up to 30 seconds of audio.

  • transcription
  • realtime input
  • streaming output
  • diarization
  • realtime diarization
  • word timestamps
  • partial transcripts
  • speaker relabels
  • endpointing

Automatic language detection: supported.

Supported language codes: en, es, de, fr, pt, it.

API endpoint

WEBSOCKET wss://api.speechinfra.com/v1/inference/universal-3-realtime-pro/realtime

Authenticate with your Speechinfra project key. Read the quickstart and billing guide.

Python
# pip install websockets
# audio.pcm: mono, 16 kHz, signed PCM16 little-endian; <= 30 seconds.
import asyncio, json, os
from pathlib import Path
from websockets.asyncio.client import connect

async def main():
    headers = {"Authorization": "Bearer " + os.environ["SPEECH_API_KEY"]}
    async with connect("wss://api.speechinfra.com/v1/inference/universal-3-realtime-pro/realtime", additional_headers=headers) as socket:
        await socket.send("{\"speaker_labels\":false,\"format_turns\":true,\"min_turn_silence\":100,\"max_turn_silence\":1000,\"type\":\"session.configure\"}")
        while True:
            event = json.loads(await socket.recv())
            if event["type"] == "error":
                raise RuntimeError(event)
            if event["type"] == "session.updated":
                break
        async def send():
            audio = Path("audio.pcm").read_bytes()
            assert 0 < len(audio) <= 960000 and len(audio) % 2 == 0
            for i in range(0, len(audio), 3200):
                await socket.send(audio[i:i+3200])
                await asyncio.sleep(0.1)
            await socket.send('{"type":"session.close"}')
        sender = asyncio.create_task(send())
        try:
            async with asyncio.timeout(90):
                async for message in socket:
                    print(message)
        finally:
            sender.cancel()

asyncio.run(main())
JavaScript / browser
// Use from the console origin with a Speech Cloud project key.
// apiKey is a Speech Cloud project key, never a provider key.
const socket = new WebSocket("wss://api.speechinfra.com/v1/inference/universal-3-realtime-pro/realtime", ['speech', apiKey]);
socket.onopen = () => socket.send("{\"speaker_labels\":false,\"format_turns\":true,\"min_turn_silence\":100,\"max_turn_silence\":1000,\"type\":\"session.configure\"}");
socket.onmessage = ({data}) => {
  const event = JSON.parse(data);
  console.log(event);
  if (event.type === 'session.updated') {
    // Send mono PCM16 / 16 kHz binary frames, <= 30 s in total.
    // After the final frame: socket.send(JSON.stringify({type:'session.close'}));
  }
};
// For a complete file-streaming example: scripts/test_models.py

Request parameters

Generated from the API schema for this deployment. Conditional parameters apply only when their controlling setting is enabled.

ParameterTypeDetails
speaker_labelsboolean

default: false

max_speakersinteger

min: 1 · max: 10

Applies when: {"speaker_labels":true}

format_turnsboolean

default: true

min_turn_silenceinteger

default: 100 · min: 50 · max: 10000

max_turn_silenceinteger

default: 1000 · min: 50 · max: 10000

promptstring

max 1750 chars

keyterms_promptarray

max 100 items

typestring

enum: session.configure · default: "session.configure"

All accepted values
[
  "session.configure"
]
Complete request schema
{
  "type": "object",
  "additionalProperties": false,
  "required": [],
  "properties": {
    "speaker_labels": {
      "type": "boolean",
      "default": false
    },
    "max_speakers": {
      "type": "integer",
      "minimum": 1,
      "maximum": 10,
      "visibleWhen": {
        "speaker_labels": true
      }
    },
    "format_turns": {
      "type": "boolean",
      "default": true
    },
    "min_turn_silence": {
      "type": "integer",
      "minimum": 50,
      "maximum": 10000,
      "default": 100
    },
    "max_turn_silence": {
      "type": "integer",
      "minimum": 50,
      "maximum": 10000,
      "default": 1000
    },
    "prompt": {
      "type": "string",
      "maxLength": 1750
    },
    "keyterms_prompt": {
      "type": "array",
      "items": {
        "type": "string",
        "minLength": 1,
        "maxLength": 50
      },
      "maxItems": 100
    },
    "type": {
      "type": "string",
      "enum": [
        "session.configure"
      ],
      "default": "session.configure"
    }
  }
}

Response schema

Returns JSON events over the WebSocket connection.

View complete response schema
{
  "type": "object",
  "description": "JSON server events. Send binary mono PCM16 at 16 kHz after session.updated; session.close drains and returns session.closed.",
  "properties": {
    "type": {
      "enum": [
        "session.created",
        "session.updated",
        "session.routed",
        "transcript.partial",
        "transcript.final",
        "error",
        "session.closed"
      ]
    }
  }
}