Create Speech Engine
Creates a reusable Speech Engine configuration that connects client audio to STT, forwards transcripts to your application, and streams synthesized responses back to the client.
/el/v1/speech-engineCreates a reusable Speech Engine configuration that connects client audio to STT, forwards transcripts to your application, and streams synthesized responses back to the client.
Tenant key (ElevenLabs SDK convention).
In: header
Query Parameters
AllModels streaming STT model. The router selects an eligible provider automatically.
Optional STT provider pin. Omit to use automatic provider routing.
Provider-specific STT setting with no standard Speech Engine field. Replace name with the option name; the JavaScript SDK accepts stt: { provider_options: { ... } }.
Portable STT setting with no standard Speech Engine field, such as turn_detection. Replace name with the setting name; the JavaScript SDK accepts stt: { input: { ... } }.
AllModels streaming TTS model. The router selects an eligible provider automatically.
Optional TTS provider pin. Omit to use automatic provider routing.
Provider-specific TTS setting with no standard Speech Engine field. Replace name with the option name; the JavaScript SDK accepts tts: { provider_options: { ... } }.
Portable TTS setting with no standard Speech Engine field. Supported names are text_buffer_mode, text_buffer_min_characters, text_buffer_target_characters, and text_buffer_max_characters.
Request Body
application/json
TypeScript Definitions
Use the request body type in TypeScript.
ElevenLabs-compatible Speech Engine configuration. Use standard ASR and TTS fields first. Use the stt and tts query extensions only to select non-ElevenLabs models or pass settings that have no standard Speech Engine field.
Response Body
application/json
application/json
application/json
application/json
application/json
import { writeFile } from "node:fs/promises";const response = await fetch("https://api.allmodels.io/el/v1/speech-engine?stt%5Bmodel%5D=deepgram%2Fnova-3&tts%5Bmodel%5D=cartesia%2Fsonic-3", { method: "POST", headers: { ...{ Authorization: `Bearer ${process.env.ALLMODELS_API_KEY}` }, "Content-Type": "application/json" }, body: JSON.stringify({ "name": "Voice agent", "speech_engine": { "ws_url": "wss://app.example.com/voice-agent" }, "asr": { "user_input_audio_format": "pcm_16000" }, "tts": { "voice_id": "YOUR_CARTESIA_VOICE_ID", "agent_output_audio_format": "pcm_16000", "speed": 1.1 }, "language": "en"})});if (!response.ok) throw new Error(`AllModels request failed: ${response.status}`);console.log(await response.json());import osimport requestspayload = { "name": "Voice agent", "speech_engine": { "ws_url": "wss://app.example.com/voice-agent" }, "asr": { "user_input_audio_format": "pcm_16000" }, "tts": { "voice_id": "YOUR_CARTESIA_VOICE_ID", "agent_output_audio_format": "pcm_16000", "speed": 1.1 }, "language": "en"}response = requests.post( "https://api.allmodels.io/el/v1/speech-engine?stt%5Bmodel%5D=deepgram%2Fnova-3&tts%5Bmodel%5D=cartesia%2Fsonic-3", headers={"Authorization": f"Bearer {os.environ['ALLMODELS_API_KEY']}"}, json=payload, timeout=60,)response.raise_for_status()print(response.json())curl -X POST https://api.allmodels.io/el/v1/speech-engine?stt%5Bmodel%5D=deepgram%2Fnova-3&tts%5Bmodel%5D=cartesia%2Fsonic-3 \ -H "Authorization: Bearer $ALLMODELS_API_KEY" \ -H "Content-Type: application/json" \ --data '{ "name": "Voice agent", "speech_engine": { "ws_url": "wss://app.example.com/voice-agent" }, "asr": { "user_input_audio_format": "pcm_16000" }, "tts": { "voice_id": "YOUR_CARTESIA_VOICE_ID", "agent_output_audio_format": "pcm_16000", "speed": 1.1 }, "language": "en"}'import { ElevenLabsClient } from "@elevenlabs/elevenlabs-js";const client = new ElevenLabsClient({ apiKey: process.env.ALLMODELS_API_KEY, baseUrl: "https://api.allmodels.io/el"});const engine = await client.speechEngine.create({ name: "Support agent", // optional speechEngine: { wsUrl: "wss://app.example.com/voice-agent", requestHeaders: { authorization: "Bearer YOUR_APPLICATION_TOKEN" } // optional }, asr: { userInputAudioFormat: "pcm_16000" // optional }, tts: { voiceId: "YOUR_CARTESIA_VOICE_ID", agentOutputAudioFormat: "pcm_16000", // optional speed: 1.1 // optional }, language: "en" // optional}, { queryParams: { stt: { model: "deepgram/nova-3" }, tts: { model: "cartesia/sonic-3" } }});console.log(engine.engineId);import osfrom elevenlabs.client import ElevenLabsfrom elevenlabs.types import ( AsrConversationalConfig, SpeechEngineConfig, TtsConversationalConfigInput,)client = ElevenLabs( api_key=os.environ["ALLMODELS_API_KEY"], base_url="https://api.allmodels.io/el",)engine = client.speech_engine.create( name="Support agent", # optional speech_engine=SpeechEngineConfig( ws_url="wss://app.example.com/voice-agent", request_headers={ "authorization": "Bearer YOUR_APPLICATION_TOKEN", }, # optional ), asr=AsrConversationalConfig( user_input_audio_format="pcm_16000", # optional ), tts=TtsConversationalConfigInput( voice_id="YOUR_CARTESIA_VOICE_ID", agent_output_audio_format="pcm_16000", # optional speed=1.1, # optional ), language="en", # optional request_options={ "additional_query_parameters": { "stt[model]": "deepgram/nova-3", "tts[model]": "cartesia/sonic-3", } },)print(engine.engine_id){ "speech_engine_id": "string", "name": "string", "speech_engine": { "ws_url": "string", "request_headers": { "property1": "string", "property2": "string" } }, "allmodels": { "stt": { "model_id": "string", "provider": "string", "provider_options": { "property1": null, "property2": null }, "input": { "property1": null, "property2": null } }, "tts": { "model_id": "string", "provider": "string", "provider_options": { "property1": null, "property2": null }, "input": { "property1": null, "property2": null } } }, "property1": null, "property2": null}{ "error": "missing_api_key"}{ "detail": { "message": "string", "status": "string", "property1": null, "property2": null }}{ "detail": { "message": "string", "status": "string", "property1": null, "property2": null }}{ "detail": { "message": "string", "status": "string", "property1": null, "property2": null }}