To initiate a streaming session, make this POST request. In the request’s body, you must provide an avatarCode, voiceId, and voiсeProvider.

🚧

Only elevenlabs voices are supported

You can get voice ID from the Voices list API call. As for now, only eleven lab's voices are supported. You can also specify Elevenlabs model and latency optimization putting it in voiceId after the ID like voiceId: "LcfcDJNUP1GQjkzn1xUU:eleven_turbo_v2_5:2" where eleven_turbo_v2_5 is model name and 2 is latency optimization parameter.

📘

Only specific avatars are supported

To get a list of supported avatars call Avatars list API with realtime=true query param and use code param from specific avatar object here.

The response to this request will provide you with a unique stream ID and webrtcData. They will be needed in other requests.

Here's an example of the request you should send:

const response = await fetch("https://apis.elai.io/api/v1/streams", {
    method: 'POST',
    headers: {
      Authorization: `Bearer ${SECRET_KEY}`,
      'Content-Type': 'application/json',
    },
    body: JSON.stringify({
      avatarCode: "gia",
      voiceId: "LcfcDJNUP1GQjkzn1xUU",
      voiceProvider: "elevenlabs"
    }),
  });

VoiceID example with custom model: voiceId: "LcfcDJNUP1GQjkzn1xUU:eleven_turbo_v2_5"

VoiceID example with custom model and latency optimization: voiceId: "LcfcDJNUP1GQjkzn1xUU:eleven_turbo_v2_5:2"

Here is an example of a response:

{
    "id": "661783648dd0fe73e0846643",
    "webrtcData": {
        "offer": {
            "type": "offer",
            "sdp": "v=0\r\no=- 1305108476168966665 2 IN IP4 127.0.0.1\r\ns=-\r\nt=0 0\r\na=group:BUNDLE 0 1\r\na=msid-semantic: WMS 55a74c0c-2fe1-4d76-abdb-67ad5a6f5fa6\r\nm=audio 48174 UDP/TLS/RTP/SAVPF 111 103 104 9 102 0 8 106 105 13 110 112 113 126\r\nc=IN IP4 216.39.253.44\r\na=rtcp:9 IN IP4 0.0.0.0\r\na=candidate:2733026917 1 udp 41820671 216.39.253.44 48174 typ relay raddr 0.0.0.0 rport 0 generation 0 network-id 2 network-cost 50\r\na=candidate:897171276 1 udp 41886207 216.39.253.46 31313 typ relay raddr 0.0.0.0 rport 0 generation 0 network-id 1 network-cost 50\r\na=candidate:2733026917 1 udp 41820159 216.39.253.44 30801 typ relay raddr 0.0.0.0 rport 0 generation 0 network-id 2 network-cost 50\r\na=candidate:897171276 1 udp 41885695 216.39.253.46 11442 typ relay raddr 0.0.0.0 rport 0 generation 0 network-id 1 network-cost 50\r\na=candidate:2079998908 1 udp 25108735 216.39.253.46 16373 typ relay raddr 0.0.0.0 rport 0 generation 0 network-id 1 network-cost 50\r\na=candidate:3038349044 1 udp 25043199 104.167.196.56 61699 typ relay raddr 0.0.0.0 rport 0 generation 0 network-id 2 network-cost 50\r\na=ice-ufrag:eEkB\r\na=ice-pwd:LYFa4iqGkGFslFjxZ4VvnVhH\r\na=ice-options:trickle\r\na=fingerprint:sha-256 0B:7C:41:43:A8:92:DA:F6:B9:22:B4:F3:D6:7A:14:6E:17:E0:84:7A:28:42:BA:63:83:75:42:75:76:6C:0E:DA\r\na=setup:actpass\r\na=mid:0\r\na=extmap:1 urn:ietf:params:rtp-hdrext:ssrc-audio-level\r\na=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time\r\na=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01\r\na=extmap:4 urn:ietf:params:rtp-hdrext:sdes:mid\r\na=extmap:5 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id\r\na=extmap:6 urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id\r\na=sendrecv\r\na=msid:55a74c0c-2fe1-4d76-abdb-67ad5a6f5fa6 fd845451-de24-4ab3-9b19-944acd41923b\r\na=rtcp-mux\r\na=rtpmap:111 opus/48000/2\r\na=rtcp-fb:111 transport-cc\r\na=fmtp:111 minptime=10;useinbandfec=1\r\na=rtpmap:103 ISAC/16000\r\na=rtpmap:104 ISAC/32000\r\na=rtpmap:9 G722/8000\r\na=rtpmap:102 ILBC/8000\r\na=rtpmap:0 PCMU/8000\r\na=rtpmap:8 PCMA/8000\r\na=rtpmap:106 CN/32000\r\na=rtpmap:105 CN/16000\r\na=rtpmap:13 CN/8000\r\na=rtpmap:110 telephone-event/48000\r\na=rtpmap:112 telephone-event/32000\r\na=rtpmap:113 telephone-event/16000\r\na=rtpmap:126 telephone-event/8000\r\na=ssrc:748673523 cname:IvJ/7olJ7rQsoWWM\r\na=ssrc:748673523 msid:55a74c0c-2fe1-4d76-abdb-67ad5a6f5fa6 fd845451-de24-4ab3-9b19-944acd41923b\r\na=ssrc:748673523 mslabel:55a74c0c-2fe1-4d76-abdb-67ad5a6f5fa6\r\na=ssrc:748673523 label:fd845451-de24-4ab3-9b19-944acd41923b\r\nm=video 51237 UDP/TLS/RTP/SAVPF 96 97 98 99 100 101 127 124 125\r\nc=IN IP4 104.167.196.56\r\na=rtcp:9 IN IP4 0.0.0.0\r\na=candidate:4221204996 1 udp 41820159 104.167.196.56 51237 typ relay raddr 0.0.0.0 rport 0 generation 0 network-id 2 network-cost 50\r\na=candidate:2733026917 1 udp 41886207 216.39.253.44 34494 typ relay raddr 0.0.0.0 rport 0 generation 0 network-id 1 network-cost 50\r\na=candidate:2733026917 1 udp 41820671 216.39.253.44 49367 typ relay raddr 0.0.0.0 rport 0 generation 0 network-id 2 network-cost 50\r\na=candidate:4221204996 1 udp 41885695 104.167.196.56 59672 typ relay raddr 0.0.0.0 rport 0 generation 0 network-id 1 network-cost 50\r\na=candidate:3966063253 1 udp 25108735 216.39.253.44 45141 typ relay raddr 0.0.0.0 rport 0 generation 0 network-id 1 network-cost 50\r\na=candidate:3038349044 1 udp 25043199 104.167.196.56 62041 typ relay raddr 0.0.0.0 rport 0 generation 0 network-id 2 network-cost 50\r\na=ice-ufrag:eEkB\r\na=ice-pwd:LYFa4iqGkGFslFjxZ4VvnVhH\r\na=ice-options:trickle\r\na=fingerprint:sha-256 0B:7C:41:43:A8:92:DA:F6:B9:22:B4:F3:D6:7A:14:6E:17:E0:84:7A:28:42:BA:63:83:75:42:75:76:6C:0E:DA\r\na=setup:actpass\r\na=mid:1\r\na=extmap:14 urn:ietf:params:rtp-hdrext:toffset\r\na=extmap:2 http://www.webrtc.org/experiments/rtp-hdrext/abs-send-time\r\na=extmap:13 urn:3gpp:video-orientation\r\na=extmap:3 http://www.ietf.org/id/draft-holmer-rmcat-transport-wide-cc-extensions-01\r\na=extmap:12 http://www.webrtc.org/experiments/rtp-hdrext/playout-delay\r\na=extmap:11 http://www.webrtc.org/experiments/rtp-hdrext/video-content-type\r\na=extmap:7 http://www.webrtc.org/experiments/rtp-hdrext/video-timing\r\na=extmap:8 http://tools.ietf.org/html/draft-ietf-avtext-framemarking-07\r\na=extmap:9 http://www.webrtc.org/experiments/rtp-hdrext/color-space\r\na=extmap:4 urn:ietf:params:rtp-hdrext:sdes:mid\r\na=extmap:5 urn:ietf:params:rtp-hdrext:sdes:rtp-stream-id\r\na=extmap:6 urn:ietf:params:rtp-hdrext:sdes:repaired-rtp-stream-id\r\na=sendrecv\r\na=msid:55a74c0c-2fe1-4d76-abdb-67ad5a6f5fa6 726b9265-32f9-4a11-a7ae-ed47ce0f84c7\r\na=rtcp-mux\r\na=rtcp-rsize\r\na=rtpmap:96 VP8/90000\r\na=rtcp-fb:96 goog-remb\r\na=rtcp-fb:96 transport-cc\r\na=rtcp-fb:96 ccm fir\r\na=rtcp-fb:96 nack\r\na=rtcp-fb:96 nack pli\r\na=rtpmap:97 rtx/90000\r\na=fmtp:97 apt=96\r\na=rtpmap:98 VP9/90000\r\na=rtcp-fb:98 goog-remb\r\na=rtcp-fb:98 transport-cc\r\na=rtcp-fb:98 ccm fir\r\na=rtcp-fb:98 nack\r\na=rtcp-fb:98 nack pli\r\na=fmtp:98 profile-id=0\r\na=rtpmap:99 rtx/90000\r\na=fmtp:99 apt=98\r\na=rtpmap:100 VP9/90000\r\na=rtcp-fb:100 goog-remb\r\na=rtcp-fb:100 transport-cc\r\na=rtcp-fb:100 ccm fir\r\na=rtcp-fb:100 nack\r\na=rtcp-fb:100 nack pli\r\na=fmtp:100 profile-id=2\r\na=rtpmap:101 rtx/90000\r\na=fmtp:101 apt=100\r\na=rtpmap:127 red/90000\r\na=rtpmap:124 rtx/90000\r\na=fmtp:124 apt=127\r\na=rtpmap:125 ulpfec/90000\r\na=ssrc-group:FID 4132093035 879720522\r\na=ssrc:4132093035 cname:IvJ/7olJ7rQsoWWM\r\na=ssrc:4132093035 msid:55a74c0c-2fe1-4d76-abdb-67ad5a6f5fa6 726b9265-32f9-4a11-a7ae-ed47ce0f84c7\r\na=ssrc:4132093035 mslabel:55a74c0c-2fe1-4d76-abdb-67ad5a6f5fa6\r\na=ssrc:4132093035 label:726b9265-32f9-4a11-a7ae-ed47ce0f84c7\r\na=ssrc:879720522 cname:IvJ/7olJ7rQsoWWM\r\na=ssrc:879720522 msid:55a74c0c-2fe1-4d76-abdb-67ad5a6f5fa6 726b9265-32f9-4a11-a7ae-ed47ce0f84c7\r\na=ssrc:879720522 mslabel:55a74c0c-2fe1-4d76-abdb-67ad5a6f5fa6\r\na=ssrc:879720522 label:726b9265-32f9-4a11-a7ae-ed47ce0f84c7\r\n"
        },
        "iceServers": [
            {
                "urls": [
                    "turn:standard.relay.metered.ca:80",
                    "turn:standard.relay.metered.ca:80?transport=tcp",
                    "turn:standard.relay.metered.ca:443",
                    "turns:standard.relay.metered.ca:443?transport=tcp"
                ],
                "username": "XXX",
                "credential": "XXX"
            }
        ]
    }
}
Language
Credentials
Header
Click Try It! to start a request and see the response here!