Speech Engine conversation WebSocket
/el/v1/convai/conversationConnect using the signed_url returned by the signed URL endpoint. The client sends microphone audio directly to AllModels and receives transcripts, response text, and synthesized audio.
Query Parameters
Opaque credential included in the signed URL.
Speech Engine id included by ElevenLabs-compatible clients.
Header Parameters
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/el/v1/convai/conversation?conversation_signature=$CONVERSATION_SIGNATURE&agent_id=$SPEECH_ENGINE_ID");ws.on("open", () => { ws.send(JSON.stringify({ user_audio_chunk: audioChunk.toString("base64") }));});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/el/v1/convai/conversation?conversation_signature=$CONVERSATION_SIGNATURE&agent_id=$SPEECH_ENGINE_ID", ) as socket: audio = base64.b64encode(Path("chunk.pcm").read_bytes()).decode("ascii") await socket.send(json.dumps({"user_audio_chunk": audio})) 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/el/v1/convai/conversation?conversation_signature=$CONVERSATION_SIGNATURE&agent_id=$SPEECH_ENGINE_ID" \ -H "Connection: Upgrade" \ -H "Upgrade: websocket" \ -H "Sec-WebSocket-Version: 13" \ -H "Sec-WebSocket-Key: SGVsbG9BbGxNb2RlbHMhIQ=="import { Conversation } from "@elevenlabs/client";const conversation = await Conversation.startSession({ signedUrl, connectionType: "websocket"});// End the session when your UI is finished.await conversation.endSession();# pip install "elevenlabs[pyaudio]"import osfrom elevenlabs.client import ElevenLabsfrom elevenlabs.conversational_ai.conversation import Conversationfrom elevenlabs.conversational_ai.default_audio_interface import DefaultAudioInterfaceclient = ElevenLabs( api_key=os.environ["ALLMODELS_API_KEY"], base_url="https://api.allmodels.io/el",)conversation = Conversation( client=client, agent_id="seng_01JZ8H4B1M4YDQ3Z4MXN8D0Q1A", requires_auth=True, audio_interface=DefaultAudioInterface(),)conversation.start_session()try: input("Press Enter to end the conversation...\n")finally: conversation.end_session()print(conversation.wait_for_session_end()){ "detail": { "message": "string", "status": "string", "property1": null, "property2": null }}{ "detail": { "message": "websocket upgrade required", "status": "websocket_upgrade_required" }}{ "detail": { "message": "string", "status": "string", "property1": null, "property2": null }}Check balance (OpenRouter-compatible) GET
Returns the balance of the account associated with your API key in OpenRouter's `GET /credits` format, for chat-completions clients that read a provider balance from the base URL (`https://api.allmodels.io/oai/credits`). Configure such clients to display `data.total_credits - data.total_usage`. Authenticate with `Authorization: Bearer <apiKey>`. You can call this endpoint even when the balance is zero. For the full breakdown, use `GET /account/balance`.
ElevenLabs SDK-compatible TTS (HTTP streaming) POST
Generates speech with `client.textToSpeech.stream(...)` and returns audio as it is produced. The response `Content-Type` follows `output_format`: `mp3_*` → `audio/mpeg`, `pcm_*` → `audio/L16; rate=N`, otherwise `application/octet-stream`.
