Elai Realtime API allows you to create a stream with a specific avatar and render speech instantly in real-time. It is based on WebRTC (Web Real-Time Communication protocol) which is the best technology right now to use for live streaming in browsers.

📘

React.js Demo App

Feel free to check out our React Demo App. You can use it to familiarize yourself with API capabilities or as a foundation for your integration.

To obtain a video stream you should follow 4 steps:

Step 1: Create a new stream session

To establish a real-time WebRTC connection, call the Create a stream API endpoint to retrieve the server's offer SDP and ICE information.

This request will provide you with a unique id (use it as streamId in other requests as URL path parameter) and a webrtcData object. The stream ID is an identifier for the streaming session, while the webrtcData contains offer and iceServers properties, that will be needed to start a stream session described in the next step.

Step 2: Starting a stream

Utilize the offer and iceServers data obtained from Step 1 to create a new WebRTC peer connection and generate an answer to the server. All necessary information is described in the Start a stream API endpoint.

Step 3: Submit network information

After a successful exchange of SDP, you will need to send some network information to establish a connection fully. Additional information is described in the Submit network information API endpoint.

Step 4: Render a video

After successfully establishing a stream session, the final step is to send text what the avatar will say. Use Render a video API endpoint to make avatar talk.

🚧

Do not exposure your API Key

We recommend to call our API only from your secured backend app or use some backend proxy service, so your API key is never stored in browser but only in secured storage


Limitations

The stream will expire in 2 minutes without any requests to render text or after all render audio requests are handled.

All plans except custom enterprise are limited to 1 session at a time for trial purposes.