POST /v1/live/sessions
curl --request POST \
--url https://api.example.com/v1/live/sessions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"session": {
"model": "<string>",
"audio": {
"input": {
"format": {
"type": "<string>",
"rate": 1
}
},
"output": {
"format": {
"type": "<string>",
"rate": 1
},
"voice": "<string>"
}
},
"client": {
"data_channel": {
"allowed_client_events": "<string>",
"allowed_server_events": "<string>"
}
},
"delegation": {
"type": "client"
},
"initial_items": [
"<unknown>"
],
"instructions": "<string>",
"triggers": [
{
"decisions": {
"questions": [
{
"instructions": "<string>",
"type": "predicate",
"name": "<string>"
}
]
},
"type": "decisions"
}
]
},
"transport": {
"sdp": "<string>",
"type": "webrtc"
}
}
'import requests
url = "https://api.example.com/v1/live/sessions"
payload = {
"session": {
"model": "<string>",
"audio": {
"input": { "format": {
"type": "<string>",
"rate": 1
} },
"output": {
"format": {
"type": "<string>",
"rate": 1
},
"voice": "<string>"
}
},
"client": { "data_channel": {
"allowed_client_events": "<string>",
"allowed_server_events": "<string>"
} },
"delegation": { "type": "client" },
"initial_items": ["<unknown>"],
"instructions": "<string>",
"triggers": [
{
"decisions": { "questions": [
{
"instructions": "<string>",
"type": "predicate",
"name": "<string>"
}
] },
"type": "decisions"
}
]
},
"transport": {
"sdp": "<string>",
"type": "webrtc"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
session: {
model: '<string>',
audio: {
input: {format: {type: '<string>', rate: 1}},
output: {format: {type: '<string>', rate: 1}, voice: '<string>'}
},
client: {
data_channel: {allowed_client_events: '<string>', allowed_server_events: '<string>'}
},
delegation: {type: 'client'},
initial_items: ['<unknown>'],
instructions: '<string>',
triggers: [
{
decisions: {questions: [{instructions: '<string>', type: 'predicate', name: '<string>'}]},
type: 'decisions'
}
]
},
transport: {sdp: '<string>', type: 'webrtc'}
})
};
fetch('https://api.example.com/v1/live/sessions', 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://api.example.com/v1/live/sessions",
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([
'session' => [
'model' => '<string>',
'audio' => [
'input' => [
'format' => [
'type' => '<string>',
'rate' => 1
]
],
'output' => [
'format' => [
'type' => '<string>',
'rate' => 1
],
'voice' => '<string>'
]
],
'client' => [
'data_channel' => [
'allowed_client_events' => '<string>',
'allowed_server_events' => '<string>'
]
],
'delegation' => [
'type' => 'client'
],
'initial_items' => [
'<unknown>'
],
'instructions' => '<string>',
'triggers' => [
[
'decisions' => [
'questions' => [
[
'instructions' => '<string>',
'type' => 'predicate',
'name' => '<string>'
]
]
],
'type' => 'decisions'
]
]
],
'transport' => [
'sdp' => '<string>',
'type' => 'webrtc'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://api.example.com/v1/live/sessions"
payload := strings.NewReader("{\n \"session\": {\n \"model\": \"<string>\",\n \"audio\": {\n \"input\": {\n \"format\": {\n \"type\": \"<string>\",\n \"rate\": 1\n }\n },\n \"output\": {\n \"format\": {\n \"type\": \"<string>\",\n \"rate\": 1\n },\n \"voice\": \"<string>\"\n }\n },\n \"client\": {\n \"data_channel\": {\n \"allowed_client_events\": \"<string>\",\n \"allowed_server_events\": \"<string>\"\n }\n },\n \"delegation\": {\n \"type\": \"client\"\n },\n \"initial_items\": [\n \"<unknown>\"\n ],\n \"instructions\": \"<string>\",\n \"triggers\": [\n {\n \"decisions\": {\n \"questions\": [\n {\n \"instructions\": \"<string>\",\n \"type\": \"predicate\",\n \"name\": \"<string>\"\n }\n ]\n },\n \"type\": \"decisions\"\n }\n ]\n },\n \"transport\": {\n \"sdp\": \"<string>\",\n \"type\": \"webrtc\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://api.example.com/v1/live/sessions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"session\": {\n \"model\": \"<string>\",\n \"audio\": {\n \"input\": {\n \"format\": {\n \"type\": \"<string>\",\n \"rate\": 1\n }\n },\n \"output\": {\n \"format\": {\n \"type\": \"<string>\",\n \"rate\": 1\n },\n \"voice\": \"<string>\"\n }\n },\n \"client\": {\n \"data_channel\": {\n \"allowed_client_events\": \"<string>\",\n \"allowed_server_events\": \"<string>\"\n }\n },\n \"delegation\": {\n \"type\": \"client\"\n },\n \"initial_items\": [\n \"<unknown>\"\n ],\n \"instructions\": \"<string>\",\n \"triggers\": [\n {\n \"decisions\": {\n \"questions\": [\n {\n \"instructions\": \"<string>\",\n \"type\": \"predicate\",\n \"name\": \"<string>\"\n }\n ]\n },\n \"type\": \"decisions\"\n }\n ]\n },\n \"transport\": {\n \"sdp\": \"<string>\",\n \"type\": \"webrtc\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/live/sessions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"session\": {\n \"model\": \"<string>\",\n \"audio\": {\n \"input\": {\n \"format\": {\n \"type\": \"<string>\",\n \"rate\": 1\n }\n },\n \"output\": {\n \"format\": {\n \"type\": \"<string>\",\n \"rate\": 1\n },\n \"voice\": \"<string>\"\n }\n },\n \"client\": {\n \"data_channel\": {\n \"allowed_client_events\": \"<string>\",\n \"allowed_server_events\": \"<string>\"\n }\n },\n \"delegation\": {\n \"type\": \"client\"\n },\n \"initial_items\": [\n \"<unknown>\"\n ],\n \"instructions\": \"<string>\",\n \"triggers\": [\n {\n \"decisions\": {\n \"questions\": [\n {\n \"instructions\": \"<string>\",\n \"type\": \"predicate\",\n \"name\": \"<string>\"\n }\n ]\n },\n \"type\": \"decisions\"\n }\n ]\n },\n \"transport\": {\n \"sdp\": \"<string>\",\n \"type\": \"webrtc\"\n }\n}"
response = http.request(request)
puts response.read_body{
"session": {
"id": "<string>"
},
"transport": {
"sdp": "<string>",
"type": "webrtc"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}Forwarding
POST /v1/live/sessions
Available at the instance root or under a provider/namespace prefix. Shared paths select the wire dialect from client headers; without dialect evidence, the first listed route wins.
POST
/
v1
/
live
/
sessions
POST /v1/live/sessions
curl --request POST \
--url https://api.example.com/v1/live/sessions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"session": {
"model": "<string>",
"audio": {
"input": {
"format": {
"type": "<string>",
"rate": 1
}
},
"output": {
"format": {
"type": "<string>",
"rate": 1
},
"voice": "<string>"
}
},
"client": {
"data_channel": {
"allowed_client_events": "<string>",
"allowed_server_events": "<string>"
}
},
"delegation": {
"type": "client"
},
"initial_items": [
"<unknown>"
],
"instructions": "<string>",
"triggers": [
{
"decisions": {
"questions": [
{
"instructions": "<string>",
"type": "predicate",
"name": "<string>"
}
]
},
"type": "decisions"
}
]
},
"transport": {
"sdp": "<string>",
"type": "webrtc"
}
}
'import requests
url = "https://api.example.com/v1/live/sessions"
payload = {
"session": {
"model": "<string>",
"audio": {
"input": { "format": {
"type": "<string>",
"rate": 1
} },
"output": {
"format": {
"type": "<string>",
"rate": 1
},
"voice": "<string>"
}
},
"client": { "data_channel": {
"allowed_client_events": "<string>",
"allowed_server_events": "<string>"
} },
"delegation": { "type": "client" },
"initial_items": ["<unknown>"],
"instructions": "<string>",
"triggers": [
{
"decisions": { "questions": [
{
"instructions": "<string>",
"type": "predicate",
"name": "<string>"
}
] },
"type": "decisions"
}
]
},
"transport": {
"sdp": "<string>",
"type": "webrtc"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
session: {
model: '<string>',
audio: {
input: {format: {type: '<string>', rate: 1}},
output: {format: {type: '<string>', rate: 1}, voice: '<string>'}
},
client: {
data_channel: {allowed_client_events: '<string>', allowed_server_events: '<string>'}
},
delegation: {type: 'client'},
initial_items: ['<unknown>'],
instructions: '<string>',
triggers: [
{
decisions: {questions: [{instructions: '<string>', type: 'predicate', name: '<string>'}]},
type: 'decisions'
}
]
},
transport: {sdp: '<string>', type: 'webrtc'}
})
};
fetch('https://api.example.com/v1/live/sessions', 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://api.example.com/v1/live/sessions",
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([
'session' => [
'model' => '<string>',
'audio' => [
'input' => [
'format' => [
'type' => '<string>',
'rate' => 1
]
],
'output' => [
'format' => [
'type' => '<string>',
'rate' => 1
],
'voice' => '<string>'
]
],
'client' => [
'data_channel' => [
'allowed_client_events' => '<string>',
'allowed_server_events' => '<string>'
]
],
'delegation' => [
'type' => 'client'
],
'initial_items' => [
'<unknown>'
],
'instructions' => '<string>',
'triggers' => [
[
'decisions' => [
'questions' => [
[
'instructions' => '<string>',
'type' => 'predicate',
'name' => '<string>'
]
]
],
'type' => 'decisions'
]
]
],
'transport' => [
'sdp' => '<string>',
'type' => 'webrtc'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://api.example.com/v1/live/sessions"
payload := strings.NewReader("{\n \"session\": {\n \"model\": \"<string>\",\n \"audio\": {\n \"input\": {\n \"format\": {\n \"type\": \"<string>\",\n \"rate\": 1\n }\n },\n \"output\": {\n \"format\": {\n \"type\": \"<string>\",\n \"rate\": 1\n },\n \"voice\": \"<string>\"\n }\n },\n \"client\": {\n \"data_channel\": {\n \"allowed_client_events\": \"<string>\",\n \"allowed_server_events\": \"<string>\"\n }\n },\n \"delegation\": {\n \"type\": \"client\"\n },\n \"initial_items\": [\n \"<unknown>\"\n ],\n \"instructions\": \"<string>\",\n \"triggers\": [\n {\n \"decisions\": {\n \"questions\": [\n {\n \"instructions\": \"<string>\",\n \"type\": \"predicate\",\n \"name\": \"<string>\"\n }\n ]\n },\n \"type\": \"decisions\"\n }\n ]\n },\n \"transport\": {\n \"sdp\": \"<string>\",\n \"type\": \"webrtc\"\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://api.example.com/v1/live/sessions")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"session\": {\n \"model\": \"<string>\",\n \"audio\": {\n \"input\": {\n \"format\": {\n \"type\": \"<string>\",\n \"rate\": 1\n }\n },\n \"output\": {\n \"format\": {\n \"type\": \"<string>\",\n \"rate\": 1\n },\n \"voice\": \"<string>\"\n }\n },\n \"client\": {\n \"data_channel\": {\n \"allowed_client_events\": \"<string>\",\n \"allowed_server_events\": \"<string>\"\n }\n },\n \"delegation\": {\n \"type\": \"client\"\n },\n \"initial_items\": [\n \"<unknown>\"\n ],\n \"instructions\": \"<string>\",\n \"triggers\": [\n {\n \"decisions\": {\n \"questions\": [\n {\n \"instructions\": \"<string>\",\n \"type\": \"predicate\",\n \"name\": \"<string>\"\n }\n ]\n },\n \"type\": \"decisions\"\n }\n ]\n },\n \"transport\": {\n \"sdp\": \"<string>\",\n \"type\": \"webrtc\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/live/sessions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"session\": {\n \"model\": \"<string>\",\n \"audio\": {\n \"input\": {\n \"format\": {\n \"type\": \"<string>\",\n \"rate\": 1\n }\n },\n \"output\": {\n \"format\": {\n \"type\": \"<string>\",\n \"rate\": 1\n },\n \"voice\": \"<string>\"\n }\n },\n \"client\": {\n \"data_channel\": {\n \"allowed_client_events\": \"<string>\",\n \"allowed_server_events\": \"<string>\"\n }\n },\n \"delegation\": {\n \"type\": \"client\"\n },\n \"initial_items\": [\n \"<unknown>\"\n ],\n \"instructions\": \"<string>\",\n \"triggers\": [\n {\n \"decisions\": {\n \"questions\": [\n {\n \"instructions\": \"<string>\",\n \"type\": \"predicate\",\n \"name\": \"<string>\"\n }\n ]\n },\n \"type\": \"decisions\"\n }\n ]\n },\n \"transport\": {\n \"sdp\": \"<string>\",\n \"type\": \"webrtc\"\n }\n}"
response = http.request(request)
puts response.read_body{
"session": {
"id": "<string>"
},
"transport": {
"sdp": "<string>",
"type": "webrtc"
}
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}授权
beareranthropicKeygoogleKeyqueryKey
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
请求体
application/json