API ReferenceRealtime
Connect to a Realtime session
Connect with a single-use client_secret, or use profile_id with an Authorization Bearer token. Client audio is accepted as soon as the WebSocket opens.
GET
/v1/realtimeConnect with a single-use client_secret, or use profile_id with an Authorization Bearer token. Client audio is accepted as soon as the WebSocket opens.
client_secret<token>
Single-use client secret returned by POST /v1/realtime/client-secrets.
In: query
Query Parameters
client_secret?string
Single-use credential returned by POST /v1/realtime/client-secrets.
profile_id?string
Realtime profile used with Authorization Bearer authentication.
Response Body
application/json
application/json
application/json
import { readFile } from "node:fs/promises";import WebSocket from "ws";const audioChunk = await readFile("chunk.pcm");const ws = new WebSocket("wss://api.allmodels.io/v1/realtime?client_secret=$REALTIME_CLIENT_SECRET");ws.on("open", () => { ws.send(audioChunk); ws.send(JSON.stringify({ type: "realtime.input_audio.commit" }));});ws.on("message", (data, isBinary) => { if (isBinary) process.stdout.write(data); else console.log(JSON.parse(data.toString()));});ws.on("error", console.error);import asyncioimport base64import jsonimport osfrom pathlib import Pathimport websocketsasync def main(): async with websockets.connect( "wss://api.allmodels.io/v1/realtime?client_secret=$REALTIME_CLIENT_SECRET", ) as socket: await socket.send(Path("chunk.pcm").read_bytes()) await socket.send(json.dumps({"type": "realtime.input_audio.commit"})) async for message in socket: print(message if isinstance(message, str) else f"{len(message)} audio bytes")asyncio.run(main())curl --http1.1 -i "https://api.allmodels.io/v1/realtime?client_secret=$REALTIME_CLIENT_SECRET" \ -H "Connection: Upgrade" \ -H "Upgrade: websocket" \ -H "Sec-WebSocket-Version: 13" \ -H "Sec-WebSocket-Key: SGVsbG9BbGxNb2RlbHMhIQ=="Empty
{ "error": "missing_api_key"}{ "error": "websocket_upgrade_required"}{ "error": { "type": "string", "code": "string", "message": "string", "property1": null, "property2": null }}