Create Session
curl --request POST \
--url https://openapi.akool.com/api/open/v4/liveAvatar/session/create \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"avatar_id": "dvp_Tristan_cloth2_1080P",
"duration": 3600,
"voice_id": "iP95p4xoKVk53GoZ742B",
"language": "en",
"mode_type": 2,
"knowledge_id": "64f8a1b2c3d4e5f6a7b8c9d0",
"background_url": "https://example.com/background.jpg",
"stream_type": "agora",
"credentials": {
"agora_uid": 100000,
"agora_app_id": "your-app-id",
"agora_channel": "your-channel",
"agora_token": "your-token"
},
"voice_params": {
"speed": 1,
"stt_language": "en",
"pron_map": {
"akool": "ai ku er"
},
"stt_type": "openai_realtime",
"turn_detection": {
"type": "server_vad",
"threshold": 0.5,
"prefix_padding_ms": 300,
"silence_duration_ms": 500
},
"elevenlabs_settings": {
"api_key": "sk_your_elevenlabs_api_key",
"model_id": "eleven_flash_v2_5",
"stability": 0.5,
"similarity_boost": 0.75,
"style": 0,
"use_speaker_boost": true
},
"minimax_settings": {
"api_key": "your api key",
"model": "speech-2.8-turbo",
"language_boost": "auto",
"voice_setting": {
"voice_id": "English_Gentle-voiced_man",
"speed": 1,
"vol": 1,
"pitch": 0,
"emotion": "angry"
}
}
}
}
'import requests
url = "https://openapi.akool.com/api/open/v4/liveAvatar/session/create"
payload = {
"avatar_id": "dvp_Tristan_cloth2_1080P",
"duration": 3600,
"voice_id": "iP95p4xoKVk53GoZ742B",
"language": "en",
"mode_type": 2,
"knowledge_id": "64f8a1b2c3d4e5f6a7b8c9d0",
"background_url": "https://example.com/background.jpg",
"stream_type": "agora",
"credentials": {
"agora_uid": 100000,
"agora_app_id": "your-app-id",
"agora_channel": "your-channel",
"agora_token": "your-token"
},
"voice_params": {
"speed": 1,
"stt_language": "en",
"pron_map": { "akool": "ai ku er" },
"stt_type": "openai_realtime",
"turn_detection": {
"type": "server_vad",
"threshold": 0.5,
"prefix_padding_ms": 300,
"silence_duration_ms": 500
},
"elevenlabs_settings": {
"api_key": "sk_your_elevenlabs_api_key",
"model_id": "eleven_flash_v2_5",
"stability": 0.5,
"similarity_boost": 0.75,
"style": 0,
"use_speaker_boost": True
},
"minimax_settings": {
"api_key": "your api key",
"model": "speech-2.8-turbo",
"language_boost": "auto",
"voice_setting": {
"voice_id": "English_Gentle-voiced_man",
"speed": 1,
"vol": 1,
"pitch": 0,
"emotion": "angry"
}
}
}
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
avatar_id: 'dvp_Tristan_cloth2_1080P',
duration: 3600,
voice_id: 'iP95p4xoKVk53GoZ742B',
language: 'en',
mode_type: 2,
knowledge_id: '64f8a1b2c3d4e5f6a7b8c9d0',
background_url: 'https://example.com/background.jpg',
stream_type: 'agora',
credentials: {
agora_uid: 100000,
agora_app_id: 'your-app-id',
agora_channel: 'your-channel',
agora_token: 'your-token'
},
voice_params: {
speed: 1,
stt_language: 'en',
pron_map: {akool: 'ai ku er'},
stt_type: 'openai_realtime',
turn_detection: {
type: 'server_vad',
threshold: 0.5,
prefix_padding_ms: 300,
silence_duration_ms: 500
},
elevenlabs_settings: {
api_key: 'sk_your_elevenlabs_api_key',
model_id: 'eleven_flash_v2_5',
stability: 0.5,
similarity_boost: 0.75,
style: 0,
use_speaker_boost: true
},
minimax_settings: {
api_key: 'your api key',
model: 'speech-2.8-turbo',
language_boost: 'auto',
voice_setting: {
voice_id: 'English_Gentle-voiced_man',
speed: 1,
vol: 1,
pitch: 0,
emotion: 'angry'
}
}
}
})
};
fetch('https://openapi.akool.com/api/open/v4/liveAvatar/session/create', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://openapi.akool.com/api/open/v4/liveAvatar/session/create",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'avatar_id' => 'dvp_Tristan_cloth2_1080P',
'duration' => 3600,
'voice_id' => 'iP95p4xoKVk53GoZ742B',
'language' => 'en',
'mode_type' => 2,
'knowledge_id' => '64f8a1b2c3d4e5f6a7b8c9d0',
'background_url' => 'https://example.com/background.jpg',
'stream_type' => 'agora',
'credentials' => [
'agora_uid' => 100000,
'agora_app_id' => 'your-app-id',
'agora_channel' => 'your-channel',
'agora_token' => 'your-token'
],
'voice_params' => [
'speed' => 1,
'stt_language' => 'en',
'pron_map' => [
'akool' => 'ai ku er'
],
'stt_type' => 'openai_realtime',
'turn_detection' => [
'type' => 'server_vad',
'threshold' => 0.5,
'prefix_padding_ms' => 300,
'silence_duration_ms' => 500
],
'elevenlabs_settings' => [
'api_key' => 'sk_your_elevenlabs_api_key',
'model_id' => 'eleven_flash_v2_5',
'stability' => 0.5,
'similarity_boost' => 0.75,
'style' => 0,
'use_speaker_boost' => true
],
'minimax_settings' => [
'api_key' => 'your api key',
'model' => 'speech-2.8-turbo',
'language_boost' => 'auto',
'voice_setting' => [
'voice_id' => 'English_Gentle-voiced_man',
'speed' => 1,
'vol' => 1,
'pitch' => 0,
'emotion' => 'angry'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://openapi.akool.com/api/open/v4/liveAvatar/session/create"
payload := strings.NewReader("{\n \"avatar_id\": \"dvp_Tristan_cloth2_1080P\",\n \"duration\": 3600,\n \"voice_id\": \"iP95p4xoKVk53GoZ742B\",\n \"language\": \"en\",\n \"mode_type\": 2,\n \"knowledge_id\": \"64f8a1b2c3d4e5f6a7b8c9d0\",\n \"background_url\": \"https://example.com/background.jpg\",\n \"stream_type\": \"agora\",\n \"credentials\": {\n \"agora_uid\": 100000,\n \"agora_app_id\": \"your-app-id\",\n \"agora_channel\": \"your-channel\",\n \"agora_token\": \"your-token\"\n },\n \"voice_params\": {\n \"speed\": 1,\n \"stt_language\": \"en\",\n \"pron_map\": {\n \"akool\": \"ai ku er\"\n },\n \"stt_type\": \"openai_realtime\",\n \"turn_detection\": {\n \"type\": \"server_vad\",\n \"threshold\": 0.5,\n \"prefix_padding_ms\": 300,\n \"silence_duration_ms\": 500\n },\n \"elevenlabs_settings\": {\n \"api_key\": \"sk_your_elevenlabs_api_key\",\n \"model_id\": \"eleven_flash_v2_5\",\n \"stability\": 0.5,\n \"similarity_boost\": 0.75,\n \"style\": 0,\n \"use_speaker_boost\": true\n },\n \"minimax_settings\": {\n \"api_key\": \"your api key\",\n \"model\": \"speech-2.8-turbo\",\n \"language_boost\": \"auto\",\n \"voice_setting\": {\n \"voice_id\": \"English_Gentle-voiced_man\",\n \"speed\": 1,\n \"vol\": 1,\n \"pitch\": 0,\n \"emotion\": \"angry\"\n }\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://openapi.akool.com/api/open/v4/liveAvatar/session/create")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"avatar_id\": \"dvp_Tristan_cloth2_1080P\",\n \"duration\": 3600,\n \"voice_id\": \"iP95p4xoKVk53GoZ742B\",\n \"language\": \"en\",\n \"mode_type\": 2,\n \"knowledge_id\": \"64f8a1b2c3d4e5f6a7b8c9d0\",\n \"background_url\": \"https://example.com/background.jpg\",\n \"stream_type\": \"agora\",\n \"credentials\": {\n \"agora_uid\": 100000,\n \"agora_app_id\": \"your-app-id\",\n \"agora_channel\": \"your-channel\",\n \"agora_token\": \"your-token\"\n },\n \"voice_params\": {\n \"speed\": 1,\n \"stt_language\": \"en\",\n \"pron_map\": {\n \"akool\": \"ai ku er\"\n },\n \"stt_type\": \"openai_realtime\",\n \"turn_detection\": {\n \"type\": \"server_vad\",\n \"threshold\": 0.5,\n \"prefix_padding_ms\": 300,\n \"silence_duration_ms\": 500\n },\n \"elevenlabs_settings\": {\n \"api_key\": \"sk_your_elevenlabs_api_key\",\n \"model_id\": \"eleven_flash_v2_5\",\n \"stability\": 0.5,\n \"similarity_boost\": 0.75,\n \"style\": 0,\n \"use_speaker_boost\": true\n },\n \"minimax_settings\": {\n \"api_key\": \"your api key\",\n \"model\": \"speech-2.8-turbo\",\n \"language_boost\": \"auto\",\n \"voice_setting\": {\n \"voice_id\": \"English_Gentle-voiced_man\",\n \"speed\": 1,\n \"vol\": 1,\n \"pitch\": 0,\n \"emotion\": \"angry\"\n }\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://openapi.akool.com/api/open/v4/liveAvatar/session/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"avatar_id\": \"dvp_Tristan_cloth2_1080P\",\n \"duration\": 3600,\n \"voice_id\": \"iP95p4xoKVk53GoZ742B\",\n \"language\": \"en\",\n \"mode_type\": 2,\n \"knowledge_id\": \"64f8a1b2c3d4e5f6a7b8c9d0\",\n \"background_url\": \"https://example.com/background.jpg\",\n \"stream_type\": \"agora\",\n \"credentials\": {\n \"agora_uid\": 100000,\n \"agora_app_id\": \"your-app-id\",\n \"agora_channel\": \"your-channel\",\n \"agora_token\": \"your-token\"\n },\n \"voice_params\": {\n \"speed\": 1,\n \"stt_language\": \"en\",\n \"pron_map\": {\n \"akool\": \"ai ku er\"\n },\n \"stt_type\": \"openai_realtime\",\n \"turn_detection\": {\n \"type\": \"server_vad\",\n \"threshold\": 0.5,\n \"prefix_padding_ms\": 300,\n \"silence_duration_ms\": 500\n },\n \"elevenlabs_settings\": {\n \"api_key\": \"sk_your_elevenlabs_api_key\",\n \"model_id\": \"eleven_flash_v2_5\",\n \"stability\": 0.5,\n \"similarity_boost\": 0.75,\n \"style\": 0,\n \"use_speaker_boost\": true\n },\n \"minimax_settings\": {\n \"api_key\": \"your api key\",\n \"model\": \"speech-2.8-turbo\",\n \"language_boost\": \"auto\",\n \"voice_setting\": {\n \"voice_id\": \"English_Gentle-voiced_man\",\n \"speed\": 1,\n \"vol\": 1,\n \"pitch\": 0,\n \"emotion\": \"angry\"\n }\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"code": 1000,
"msg": "OK",
"data": {
"_id": "<string>",
"uid": 123,
"type": 123,
"status": 1,
"stream_type": "<string>",
"credentials": {
"agora_uid": 123,
"agora_app_id": "<string>",
"agora_channel": "<string>",
"agora_token": "<string>",
"livekit_url": "<string>",
"livekit_token": "<string>",
"livekit_room_name": "<string>",
"livekit_server_identity": "<string>",
"livekit_client_identity": "<string>",
"trtc_sdk_app_id": 123,
"trtc_sdk_room_id": "<string>",
"trtc_sdk_user_id": "<string>",
"trtc_sdk_user_sig": "<string>"
}
}
}API Endpoints
Create Session
Create a new streaming avatar session
POST
/
api
/
open
/
v4
/
liveAvatar
/
session
/
create
Create Session
curl --request POST \
--url https://openapi.akool.com/api/open/v4/liveAvatar/session/create \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"avatar_id": "dvp_Tristan_cloth2_1080P",
"duration": 3600,
"voice_id": "iP95p4xoKVk53GoZ742B",
"language": "en",
"mode_type": 2,
"knowledge_id": "64f8a1b2c3d4e5f6a7b8c9d0",
"background_url": "https://example.com/background.jpg",
"stream_type": "agora",
"credentials": {
"agora_uid": 100000,
"agora_app_id": "your-app-id",
"agora_channel": "your-channel",
"agora_token": "your-token"
},
"voice_params": {
"speed": 1,
"stt_language": "en",
"pron_map": {
"akool": "ai ku er"
},
"stt_type": "openai_realtime",
"turn_detection": {
"type": "server_vad",
"threshold": 0.5,
"prefix_padding_ms": 300,
"silence_duration_ms": 500
},
"elevenlabs_settings": {
"api_key": "sk_your_elevenlabs_api_key",
"model_id": "eleven_flash_v2_5",
"stability": 0.5,
"similarity_boost": 0.75,
"style": 0,
"use_speaker_boost": true
},
"minimax_settings": {
"api_key": "your api key",
"model": "speech-2.8-turbo",
"language_boost": "auto",
"voice_setting": {
"voice_id": "English_Gentle-voiced_man",
"speed": 1,
"vol": 1,
"pitch": 0,
"emotion": "angry"
}
}
}
}
'import requests
url = "https://openapi.akool.com/api/open/v4/liveAvatar/session/create"
payload = {
"avatar_id": "dvp_Tristan_cloth2_1080P",
"duration": 3600,
"voice_id": "iP95p4xoKVk53GoZ742B",
"language": "en",
"mode_type": 2,
"knowledge_id": "64f8a1b2c3d4e5f6a7b8c9d0",
"background_url": "https://example.com/background.jpg",
"stream_type": "agora",
"credentials": {
"agora_uid": 100000,
"agora_app_id": "your-app-id",
"agora_channel": "your-channel",
"agora_token": "your-token"
},
"voice_params": {
"speed": 1,
"stt_language": "en",
"pron_map": { "akool": "ai ku er" },
"stt_type": "openai_realtime",
"turn_detection": {
"type": "server_vad",
"threshold": 0.5,
"prefix_padding_ms": 300,
"silence_duration_ms": 500
},
"elevenlabs_settings": {
"api_key": "sk_your_elevenlabs_api_key",
"model_id": "eleven_flash_v2_5",
"stability": 0.5,
"similarity_boost": 0.75,
"style": 0,
"use_speaker_boost": True
},
"minimax_settings": {
"api_key": "your api key",
"model": "speech-2.8-turbo",
"language_boost": "auto",
"voice_setting": {
"voice_id": "English_Gentle-voiced_man",
"speed": 1,
"vol": 1,
"pitch": 0,
"emotion": "angry"
}
}
}
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
avatar_id: 'dvp_Tristan_cloth2_1080P',
duration: 3600,
voice_id: 'iP95p4xoKVk53GoZ742B',
language: 'en',
mode_type: 2,
knowledge_id: '64f8a1b2c3d4e5f6a7b8c9d0',
background_url: 'https://example.com/background.jpg',
stream_type: 'agora',
credentials: {
agora_uid: 100000,
agora_app_id: 'your-app-id',
agora_channel: 'your-channel',
agora_token: 'your-token'
},
voice_params: {
speed: 1,
stt_language: 'en',
pron_map: {akool: 'ai ku er'},
stt_type: 'openai_realtime',
turn_detection: {
type: 'server_vad',
threshold: 0.5,
prefix_padding_ms: 300,
silence_duration_ms: 500
},
elevenlabs_settings: {
api_key: 'sk_your_elevenlabs_api_key',
model_id: 'eleven_flash_v2_5',
stability: 0.5,
similarity_boost: 0.75,
style: 0,
use_speaker_boost: true
},
minimax_settings: {
api_key: 'your api key',
model: 'speech-2.8-turbo',
language_boost: 'auto',
voice_setting: {
voice_id: 'English_Gentle-voiced_man',
speed: 1,
vol: 1,
pitch: 0,
emotion: 'angry'
}
}
}
})
};
fetch('https://openapi.akool.com/api/open/v4/liveAvatar/session/create', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://openapi.akool.com/api/open/v4/liveAvatar/session/create",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'avatar_id' => 'dvp_Tristan_cloth2_1080P',
'duration' => 3600,
'voice_id' => 'iP95p4xoKVk53GoZ742B',
'language' => 'en',
'mode_type' => 2,
'knowledge_id' => '64f8a1b2c3d4e5f6a7b8c9d0',
'background_url' => 'https://example.com/background.jpg',
'stream_type' => 'agora',
'credentials' => [
'agora_uid' => 100000,
'agora_app_id' => 'your-app-id',
'agora_channel' => 'your-channel',
'agora_token' => 'your-token'
],
'voice_params' => [
'speed' => 1,
'stt_language' => 'en',
'pron_map' => [
'akool' => 'ai ku er'
],
'stt_type' => 'openai_realtime',
'turn_detection' => [
'type' => 'server_vad',
'threshold' => 0.5,
'prefix_padding_ms' => 300,
'silence_duration_ms' => 500
],
'elevenlabs_settings' => [
'api_key' => 'sk_your_elevenlabs_api_key',
'model_id' => 'eleven_flash_v2_5',
'stability' => 0.5,
'similarity_boost' => 0.75,
'style' => 0,
'use_speaker_boost' => true
],
'minimax_settings' => [
'api_key' => 'your api key',
'model' => 'speech-2.8-turbo',
'language_boost' => 'auto',
'voice_setting' => [
'voice_id' => 'English_Gentle-voiced_man',
'speed' => 1,
'vol' => 1,
'pitch' => 0,
'emotion' => 'angry'
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://openapi.akool.com/api/open/v4/liveAvatar/session/create"
payload := strings.NewReader("{\n \"avatar_id\": \"dvp_Tristan_cloth2_1080P\",\n \"duration\": 3600,\n \"voice_id\": \"iP95p4xoKVk53GoZ742B\",\n \"language\": \"en\",\n \"mode_type\": 2,\n \"knowledge_id\": \"64f8a1b2c3d4e5f6a7b8c9d0\",\n \"background_url\": \"https://example.com/background.jpg\",\n \"stream_type\": \"agora\",\n \"credentials\": {\n \"agora_uid\": 100000,\n \"agora_app_id\": \"your-app-id\",\n \"agora_channel\": \"your-channel\",\n \"agora_token\": \"your-token\"\n },\n \"voice_params\": {\n \"speed\": 1,\n \"stt_language\": \"en\",\n \"pron_map\": {\n \"akool\": \"ai ku er\"\n },\n \"stt_type\": \"openai_realtime\",\n \"turn_detection\": {\n \"type\": \"server_vad\",\n \"threshold\": 0.5,\n \"prefix_padding_ms\": 300,\n \"silence_duration_ms\": 500\n },\n \"elevenlabs_settings\": {\n \"api_key\": \"sk_your_elevenlabs_api_key\",\n \"model_id\": \"eleven_flash_v2_5\",\n \"stability\": 0.5,\n \"similarity_boost\": 0.75,\n \"style\": 0,\n \"use_speaker_boost\": true\n },\n \"minimax_settings\": {\n \"api_key\": \"your api key\",\n \"model\": \"speech-2.8-turbo\",\n \"language_boost\": \"auto\",\n \"voice_setting\": {\n \"voice_id\": \"English_Gentle-voiced_man\",\n \"speed\": 1,\n \"vol\": 1,\n \"pitch\": 0,\n \"emotion\": \"angry\"\n }\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://openapi.akool.com/api/open/v4/liveAvatar/session/create")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"avatar_id\": \"dvp_Tristan_cloth2_1080P\",\n \"duration\": 3600,\n \"voice_id\": \"iP95p4xoKVk53GoZ742B\",\n \"language\": \"en\",\n \"mode_type\": 2,\n \"knowledge_id\": \"64f8a1b2c3d4e5f6a7b8c9d0\",\n \"background_url\": \"https://example.com/background.jpg\",\n \"stream_type\": \"agora\",\n \"credentials\": {\n \"agora_uid\": 100000,\n \"agora_app_id\": \"your-app-id\",\n \"agora_channel\": \"your-channel\",\n \"agora_token\": \"your-token\"\n },\n \"voice_params\": {\n \"speed\": 1,\n \"stt_language\": \"en\",\n \"pron_map\": {\n \"akool\": \"ai ku er\"\n },\n \"stt_type\": \"openai_realtime\",\n \"turn_detection\": {\n \"type\": \"server_vad\",\n \"threshold\": 0.5,\n \"prefix_padding_ms\": 300,\n \"silence_duration_ms\": 500\n },\n \"elevenlabs_settings\": {\n \"api_key\": \"sk_your_elevenlabs_api_key\",\n \"model_id\": \"eleven_flash_v2_5\",\n \"stability\": 0.5,\n \"similarity_boost\": 0.75,\n \"style\": 0,\n \"use_speaker_boost\": true\n },\n \"minimax_settings\": {\n \"api_key\": \"your api key\",\n \"model\": \"speech-2.8-turbo\",\n \"language_boost\": \"auto\",\n \"voice_setting\": {\n \"voice_id\": \"English_Gentle-voiced_man\",\n \"speed\": 1,\n \"vol\": 1,\n \"pitch\": 0,\n \"emotion\": \"angry\"\n }\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://openapi.akool.com/api/open/v4/liveAvatar/session/create")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"avatar_id\": \"dvp_Tristan_cloth2_1080P\",\n \"duration\": 3600,\n \"voice_id\": \"iP95p4xoKVk53GoZ742B\",\n \"language\": \"en\",\n \"mode_type\": 2,\n \"knowledge_id\": \"64f8a1b2c3d4e5f6a7b8c9d0\",\n \"background_url\": \"https://example.com/background.jpg\",\n \"stream_type\": \"agora\",\n \"credentials\": {\n \"agora_uid\": 100000,\n \"agora_app_id\": \"your-app-id\",\n \"agora_channel\": \"your-channel\",\n \"agora_token\": \"your-token\"\n },\n \"voice_params\": {\n \"speed\": 1,\n \"stt_language\": \"en\",\n \"pron_map\": {\n \"akool\": \"ai ku er\"\n },\n \"stt_type\": \"openai_realtime\",\n \"turn_detection\": {\n \"type\": \"server_vad\",\n \"threshold\": 0.5,\n \"prefix_padding_ms\": 300,\n \"silence_duration_ms\": 500\n },\n \"elevenlabs_settings\": {\n \"api_key\": \"sk_your_elevenlabs_api_key\",\n \"model_id\": \"eleven_flash_v2_5\",\n \"stability\": 0.5,\n \"similarity_boost\": 0.75,\n \"style\": 0,\n \"use_speaker_boost\": true\n },\n \"minimax_settings\": {\n \"api_key\": \"your api key\",\n \"model\": \"speech-2.8-turbo\",\n \"language_boost\": \"auto\",\n \"voice_setting\": {\n \"voice_id\": \"English_Gentle-voiced_man\",\n \"speed\": 1,\n \"vol\": 1,\n \"pitch\": 0,\n \"emotion\": \"angry\"\n }\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"code": 1000,
"msg": "OK",
"data": {
"_id": "<string>",
"uid": 123,
"type": 123,
"status": 1,
"stream_type": "<string>",
"credentials": {
"agora_uid": 123,
"agora_app_id": "<string>",
"agora_channel": "<string>",
"agora_token": "<string>",
"livekit_url": "<string>",
"livekit_token": "<string>",
"livekit_room_name": "<string>",
"livekit_server_identity": "<string>",
"livekit_client_identity": "<string>",
"trtc_sdk_app_id": 123,
"trtc_sdk_room_id": "<string>",
"trtc_sdk_user_id": "<string>",
"trtc_sdk_user_sig": "<string>"
}
}
}Both the avatar_id and voice_id can be easily obtained by copying them directly from the web interface. You can also create and manage your streaming avatars using our intuitive web platform.Create and manage your avatars at: https://akool.com/apps/upload/avatar?from=%2Fapps%2Fstreaming-avatar%2Fedit
Knowledge Base Integration: You can enhance your streaming avatar with contextual AI responses by integrating a Knowledge Base. When creating a session, provide a
knowledge_id parameter to enable the AI to use documents and URLs from your knowledge base for more accurate and relevant responses.ElevenLabs Custom Configuration: You can use your own ElevenLabs API key and customize voice parameters by providing
elevenlabs_settings within the voice_params object. This allows you to:- Use your own ElevenLabs account and billing
- Choose specific ElevenLabs models (e.g., eleven_flash_v2_5, eleven_turbo_v2_5)
- Fine-tune voice characteristics such as stability, similarity_boost, and style
- Enable speaker boost for improved voice cloning quality
voice_id field, and the backend will pass through all your custom parameters to ElevenLabs.Minimax Custom Configuration: You can also use your own Minimax API key and customize voice parameters by providing minimax_settings within the voice_params object. Configure the model, language boost, voice ID, speed, volume, pitch, and emotion in voice_setting.Example payload can be found in the right sidebar.Authorizations
ApiKeyAuthBearerAuth
Body
application/json
Digital human model in real-time avatar. If you want to use a custom uploaded video, you need to call the avatar/create interface to create a template. This process takes some time to process. You can check the processing status through the avatar/detail interface. When status=3, you can use the avatar_id field to pass it in.