POST /v1/realtime/client_secrets
curl --request POST \
--url https://api.example.com/v1/realtime/client_secrets \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"expires_after": {
"anchor": "<string>",
"seconds": 1
},
"session": {
"type": "realtime",
"audio": {
"input": {
"format": {
"rate": 123,
"type": "audio/pcm"
},
"noise_reduction": {},
"transcription": {
"keywords": [
"<string>"
],
"language": "<string>",
"languages": [
"<string>"
],
"model": "<string>",
"prompt": "<string>"
},
"turn_detection": {
"type": "server_vad",
"create_response": true,
"idle_timeout_ms": 123,
"interrupt_response": true,
"prefix_padding_ms": 123,
"silence_duration_ms": 123,
"threshold": 123
}
},
"output": {
"format": {
"rate": 123,
"type": "audio/pcm"
},
"speed": 123,
"voice": "<string>"
}
},
"include": [
"item.input_audio_transcription.logprobs"
],
"instructions": "<string>",
"max_output_tokens": 123,
"model": "<string>",
"output_modalities": [],
"parallel_tool_calls": true,
"prompt": {
"id": "<string>",
"variables": {},
"version": "<string>"
},
"reasoning": {},
"tools": [
{
"description": "<string>",
"name": "<string>",
"parameters": "<unknown>",
"type": "function"
}
],
"tracing": "auto"
}
}
'import requests
url = "https://api.example.com/v1/realtime/client_secrets"
payload = {
"expires_after": {
"anchor": "<string>",
"seconds": 1
},
"session": {
"type": "realtime",
"audio": {
"input": {
"format": {
"rate": 123,
"type": "audio/pcm"
},
"noise_reduction": {},
"transcription": {
"keywords": ["<string>"],
"language": "<string>",
"languages": ["<string>"],
"model": "<string>",
"prompt": "<string>"
},
"turn_detection": {
"type": "server_vad",
"create_response": True,
"idle_timeout_ms": 123,
"interrupt_response": True,
"prefix_padding_ms": 123,
"silence_duration_ms": 123,
"threshold": 123
}
},
"output": {
"format": {
"rate": 123,
"type": "audio/pcm"
},
"speed": 123,
"voice": "<string>"
}
},
"include": ["item.input_audio_transcription.logprobs"],
"instructions": "<string>",
"max_output_tokens": 123,
"model": "<string>",
"output_modalities": [],
"parallel_tool_calls": True,
"prompt": {
"id": "<string>",
"variables": {},
"version": "<string>"
},
"reasoning": {},
"tools": [
{
"description": "<string>",
"name": "<string>",
"parameters": "<unknown>",
"type": "function"
}
],
"tracing": "auto"
}
}
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({
expires_after: {anchor: '<string>', seconds: 1},
session: {
type: 'realtime',
audio: {
input: {
format: {rate: 123, type: 'audio/pcm'},
noise_reduction: {},
transcription: {
keywords: ['<string>'],
language: '<string>',
languages: ['<string>'],
model: '<string>',
prompt: '<string>'
},
turn_detection: {
type: 'server_vad',
create_response: true,
idle_timeout_ms: 123,
interrupt_response: true,
prefix_padding_ms: 123,
silence_duration_ms: 123,
threshold: 123
}
},
output: {format: {rate: 123, type: 'audio/pcm'}, speed: 123, voice: '<string>'}
},
include: ['item.input_audio_transcription.logprobs'],
instructions: '<string>',
max_output_tokens: 123,
model: '<string>',
output_modalities: [],
parallel_tool_calls: true,
prompt: {id: '<string>', variables: {}, version: '<string>'},
reasoning: {},
tools: [
{
description: '<string>',
name: '<string>',
parameters: '<unknown>',
type: 'function'
}
],
tracing: 'auto'
}
})
};
fetch('https://api.example.com/v1/realtime/client_secrets', 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/realtime/client_secrets",
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([
'expires_after' => [
'anchor' => '<string>',
'seconds' => 1
],
'session' => [
'type' => 'realtime',
'audio' => [
'input' => [
'format' => [
'rate' => 123,
'type' => 'audio/pcm'
],
'noise_reduction' => [
],
'transcription' => [
'keywords' => [
'<string>'
],
'language' => '<string>',
'languages' => [
'<string>'
],
'model' => '<string>',
'prompt' => '<string>'
],
'turn_detection' => [
'type' => 'server_vad',
'create_response' => true,
'idle_timeout_ms' => 123,
'interrupt_response' => true,
'prefix_padding_ms' => 123,
'silence_duration_ms' => 123,
'threshold' => 123
]
],
'output' => [
'format' => [
'rate' => 123,
'type' => 'audio/pcm'
],
'speed' => 123,
'voice' => '<string>'
]
],
'include' => [
'item.input_audio_transcription.logprobs'
],
'instructions' => '<string>',
'max_output_tokens' => 123,
'model' => '<string>',
'output_modalities' => [
],
'parallel_tool_calls' => true,
'prompt' => [
'id' => '<string>',
'variables' => [
],
'version' => '<string>'
],
'reasoning' => [
],
'tools' => [
[
'description' => '<string>',
'name' => '<string>',
'parameters' => '<unknown>',
'type' => 'function'
]
],
'tracing' => 'auto'
]
]),
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/realtime/client_secrets"
payload := strings.NewReader("{\n \"expires_after\": {\n \"anchor\": \"<string>\",\n \"seconds\": 1\n },\n \"session\": {\n \"type\": \"realtime\",\n \"audio\": {\n \"input\": {\n \"format\": {\n \"rate\": 123,\n \"type\": \"audio/pcm\"\n },\n \"noise_reduction\": {},\n \"transcription\": {\n \"keywords\": [\n \"<string>\"\n ],\n \"language\": \"<string>\",\n \"languages\": [\n \"<string>\"\n ],\n \"model\": \"<string>\",\n \"prompt\": \"<string>\"\n },\n \"turn_detection\": {\n \"type\": \"server_vad\",\n \"create_response\": true,\n \"idle_timeout_ms\": 123,\n \"interrupt_response\": true,\n \"prefix_padding_ms\": 123,\n \"silence_duration_ms\": 123,\n \"threshold\": 123\n }\n },\n \"output\": {\n \"format\": {\n \"rate\": 123,\n \"type\": \"audio/pcm\"\n },\n \"speed\": 123,\n \"voice\": \"<string>\"\n }\n },\n \"include\": [\n \"item.input_audio_transcription.logprobs\"\n ],\n \"instructions\": \"<string>\",\n \"max_output_tokens\": 123,\n \"model\": \"<string>\",\n \"output_modalities\": [],\n \"parallel_tool_calls\": true,\n \"prompt\": {\n \"id\": \"<string>\",\n \"variables\": {},\n \"version\": \"<string>\"\n },\n \"reasoning\": {},\n \"tools\": [\n {\n \"description\": \"<string>\",\n \"name\": \"<string>\",\n \"parameters\": \"<unknown>\",\n \"type\": \"function\"\n }\n ],\n \"tracing\": \"auto\"\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/realtime/client_secrets")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"expires_after\": {\n \"anchor\": \"<string>\",\n \"seconds\": 1\n },\n \"session\": {\n \"type\": \"realtime\",\n \"audio\": {\n \"input\": {\n \"format\": {\n \"rate\": 123,\n \"type\": \"audio/pcm\"\n },\n \"noise_reduction\": {},\n \"transcription\": {\n \"keywords\": [\n \"<string>\"\n ],\n \"language\": \"<string>\",\n \"languages\": [\n \"<string>\"\n ],\n \"model\": \"<string>\",\n \"prompt\": \"<string>\"\n },\n \"turn_detection\": {\n \"type\": \"server_vad\",\n \"create_response\": true,\n \"idle_timeout_ms\": 123,\n \"interrupt_response\": true,\n \"prefix_padding_ms\": 123,\n \"silence_duration_ms\": 123,\n \"threshold\": 123\n }\n },\n \"output\": {\n \"format\": {\n \"rate\": 123,\n \"type\": \"audio/pcm\"\n },\n \"speed\": 123,\n \"voice\": \"<string>\"\n }\n },\n \"include\": [\n \"item.input_audio_transcription.logprobs\"\n ],\n \"instructions\": \"<string>\",\n \"max_output_tokens\": 123,\n \"model\": \"<string>\",\n \"output_modalities\": [],\n \"parallel_tool_calls\": true,\n \"prompt\": {\n \"id\": \"<string>\",\n \"variables\": {},\n \"version\": \"<string>\"\n },\n \"reasoning\": {},\n \"tools\": [\n {\n \"description\": \"<string>\",\n \"name\": \"<string>\",\n \"parameters\": \"<unknown>\",\n \"type\": \"function\"\n }\n ],\n \"tracing\": \"auto\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/realtime/client_secrets")
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 \"expires_after\": {\n \"anchor\": \"<string>\",\n \"seconds\": 1\n },\n \"session\": {\n \"type\": \"realtime\",\n \"audio\": {\n \"input\": {\n \"format\": {\n \"rate\": 123,\n \"type\": \"audio/pcm\"\n },\n \"noise_reduction\": {},\n \"transcription\": {\n \"keywords\": [\n \"<string>\"\n ],\n \"language\": \"<string>\",\n \"languages\": [\n \"<string>\"\n ],\n \"model\": \"<string>\",\n \"prompt\": \"<string>\"\n },\n \"turn_detection\": {\n \"type\": \"server_vad\",\n \"create_response\": true,\n \"idle_timeout_ms\": 123,\n \"interrupt_response\": true,\n \"prefix_padding_ms\": 123,\n \"silence_duration_ms\": 123,\n \"threshold\": 123\n }\n },\n \"output\": {\n \"format\": {\n \"rate\": 123,\n \"type\": \"audio/pcm\"\n },\n \"speed\": 123,\n \"voice\": \"<string>\"\n }\n },\n \"include\": [\n \"item.input_audio_transcription.logprobs\"\n ],\n \"instructions\": \"<string>\",\n \"max_output_tokens\": 123,\n \"model\": \"<string>\",\n \"output_modalities\": [],\n \"parallel_tool_calls\": true,\n \"prompt\": {\n \"id\": \"<string>\",\n \"variables\": {},\n \"version\": \"<string>\"\n },\n \"reasoning\": {},\n \"tools\": [\n {\n \"description\": \"<string>\",\n \"name\": \"<string>\",\n \"parameters\": \"<unknown>\",\n \"type\": \"function\"\n }\n ],\n \"tracing\": \"auto\"\n }\n}"
response = http.request(request)
puts response.read_body{
"expires_at": 1,
"session": {
"id": "<string>",
"object": "realtime.session",
"type": "realtime",
"audio": {
"input": {
"format": {
"rate": 123,
"type": "audio/pcm"
},
"noise_reduction": {
"type": "near_field"
},
"transcription": {
"delay": "minimal",
"keywords": [
"<string>"
],
"language": "<string>",
"languages": [
"<string>"
],
"model": "<string>",
"prompt": "<string>"
},
"turn_detection": {
"type": "server_vad",
"create_response": true,
"idle_timeout_ms": 123,
"interrupt_response": true,
"prefix_padding_ms": 123,
"silence_duration_ms": 123,
"threshold": 123
}
},
"output": {
"format": {
"rate": 123,
"type": "audio/pcm"
},
"speed": 123,
"voice": "<string>"
}
},
"expires_at": 123,
"include": [
"item.input_audio_transcription.logprobs"
],
"instructions": "<string>",
"max_output_tokens": 123,
"model": "<string>",
"output_modalities": [
"text"
],
"prompt": {
"id": "<string>",
"variables": {},
"version": "<string>"
},
"reasoning": {
"effort": "minimal"
},
"tool_choice": "none",
"tools": [
{
"description": "<string>",
"name": "<string>",
"parameters": "<unknown>",
"type": "function"
}
],
"tracing": "auto",
"truncation": "auto"
},
"value": "<string>"
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}Forwarding
POST /v1/realtime/client_secrets
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
/
realtime
/
client_secrets
POST /v1/realtime/client_secrets
curl --request POST \
--url https://api.example.com/v1/realtime/client_secrets \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"expires_after": {
"anchor": "<string>",
"seconds": 1
},
"session": {
"type": "realtime",
"audio": {
"input": {
"format": {
"rate": 123,
"type": "audio/pcm"
},
"noise_reduction": {},
"transcription": {
"keywords": [
"<string>"
],
"language": "<string>",
"languages": [
"<string>"
],
"model": "<string>",
"prompt": "<string>"
},
"turn_detection": {
"type": "server_vad",
"create_response": true,
"idle_timeout_ms": 123,
"interrupt_response": true,
"prefix_padding_ms": 123,
"silence_duration_ms": 123,
"threshold": 123
}
},
"output": {
"format": {
"rate": 123,
"type": "audio/pcm"
},
"speed": 123,
"voice": "<string>"
}
},
"include": [
"item.input_audio_transcription.logprobs"
],
"instructions": "<string>",
"max_output_tokens": 123,
"model": "<string>",
"output_modalities": [],
"parallel_tool_calls": true,
"prompt": {
"id": "<string>",
"variables": {},
"version": "<string>"
},
"reasoning": {},
"tools": [
{
"description": "<string>",
"name": "<string>",
"parameters": "<unknown>",
"type": "function"
}
],
"tracing": "auto"
}
}
'import requests
url = "https://api.example.com/v1/realtime/client_secrets"
payload = {
"expires_after": {
"anchor": "<string>",
"seconds": 1
},
"session": {
"type": "realtime",
"audio": {
"input": {
"format": {
"rate": 123,
"type": "audio/pcm"
},
"noise_reduction": {},
"transcription": {
"keywords": ["<string>"],
"language": "<string>",
"languages": ["<string>"],
"model": "<string>",
"prompt": "<string>"
},
"turn_detection": {
"type": "server_vad",
"create_response": True,
"idle_timeout_ms": 123,
"interrupt_response": True,
"prefix_padding_ms": 123,
"silence_duration_ms": 123,
"threshold": 123
}
},
"output": {
"format": {
"rate": 123,
"type": "audio/pcm"
},
"speed": 123,
"voice": "<string>"
}
},
"include": ["item.input_audio_transcription.logprobs"],
"instructions": "<string>",
"max_output_tokens": 123,
"model": "<string>",
"output_modalities": [],
"parallel_tool_calls": True,
"prompt": {
"id": "<string>",
"variables": {},
"version": "<string>"
},
"reasoning": {},
"tools": [
{
"description": "<string>",
"name": "<string>",
"parameters": "<unknown>",
"type": "function"
}
],
"tracing": "auto"
}
}
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({
expires_after: {anchor: '<string>', seconds: 1},
session: {
type: 'realtime',
audio: {
input: {
format: {rate: 123, type: 'audio/pcm'},
noise_reduction: {},
transcription: {
keywords: ['<string>'],
language: '<string>',
languages: ['<string>'],
model: '<string>',
prompt: '<string>'
},
turn_detection: {
type: 'server_vad',
create_response: true,
idle_timeout_ms: 123,
interrupt_response: true,
prefix_padding_ms: 123,
silence_duration_ms: 123,
threshold: 123
}
},
output: {format: {rate: 123, type: 'audio/pcm'}, speed: 123, voice: '<string>'}
},
include: ['item.input_audio_transcription.logprobs'],
instructions: '<string>',
max_output_tokens: 123,
model: '<string>',
output_modalities: [],
parallel_tool_calls: true,
prompt: {id: '<string>', variables: {}, version: '<string>'},
reasoning: {},
tools: [
{
description: '<string>',
name: '<string>',
parameters: '<unknown>',
type: 'function'
}
],
tracing: 'auto'
}
})
};
fetch('https://api.example.com/v1/realtime/client_secrets', 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/realtime/client_secrets",
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([
'expires_after' => [
'anchor' => '<string>',
'seconds' => 1
],
'session' => [
'type' => 'realtime',
'audio' => [
'input' => [
'format' => [
'rate' => 123,
'type' => 'audio/pcm'
],
'noise_reduction' => [
],
'transcription' => [
'keywords' => [
'<string>'
],
'language' => '<string>',
'languages' => [
'<string>'
],
'model' => '<string>',
'prompt' => '<string>'
],
'turn_detection' => [
'type' => 'server_vad',
'create_response' => true,
'idle_timeout_ms' => 123,
'interrupt_response' => true,
'prefix_padding_ms' => 123,
'silence_duration_ms' => 123,
'threshold' => 123
]
],
'output' => [
'format' => [
'rate' => 123,
'type' => 'audio/pcm'
],
'speed' => 123,
'voice' => '<string>'
]
],
'include' => [
'item.input_audio_transcription.logprobs'
],
'instructions' => '<string>',
'max_output_tokens' => 123,
'model' => '<string>',
'output_modalities' => [
],
'parallel_tool_calls' => true,
'prompt' => [
'id' => '<string>',
'variables' => [
],
'version' => '<string>'
],
'reasoning' => [
],
'tools' => [
[
'description' => '<string>',
'name' => '<string>',
'parameters' => '<unknown>',
'type' => 'function'
]
],
'tracing' => 'auto'
]
]),
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/realtime/client_secrets"
payload := strings.NewReader("{\n \"expires_after\": {\n \"anchor\": \"<string>\",\n \"seconds\": 1\n },\n \"session\": {\n \"type\": \"realtime\",\n \"audio\": {\n \"input\": {\n \"format\": {\n \"rate\": 123,\n \"type\": \"audio/pcm\"\n },\n \"noise_reduction\": {},\n \"transcription\": {\n \"keywords\": [\n \"<string>\"\n ],\n \"language\": \"<string>\",\n \"languages\": [\n \"<string>\"\n ],\n \"model\": \"<string>\",\n \"prompt\": \"<string>\"\n },\n \"turn_detection\": {\n \"type\": \"server_vad\",\n \"create_response\": true,\n \"idle_timeout_ms\": 123,\n \"interrupt_response\": true,\n \"prefix_padding_ms\": 123,\n \"silence_duration_ms\": 123,\n \"threshold\": 123\n }\n },\n \"output\": {\n \"format\": {\n \"rate\": 123,\n \"type\": \"audio/pcm\"\n },\n \"speed\": 123,\n \"voice\": \"<string>\"\n }\n },\n \"include\": [\n \"item.input_audio_transcription.logprobs\"\n ],\n \"instructions\": \"<string>\",\n \"max_output_tokens\": 123,\n \"model\": \"<string>\",\n \"output_modalities\": [],\n \"parallel_tool_calls\": true,\n \"prompt\": {\n \"id\": \"<string>\",\n \"variables\": {},\n \"version\": \"<string>\"\n },\n \"reasoning\": {},\n \"tools\": [\n {\n \"description\": \"<string>\",\n \"name\": \"<string>\",\n \"parameters\": \"<unknown>\",\n \"type\": \"function\"\n }\n ],\n \"tracing\": \"auto\"\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/realtime/client_secrets")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"expires_after\": {\n \"anchor\": \"<string>\",\n \"seconds\": 1\n },\n \"session\": {\n \"type\": \"realtime\",\n \"audio\": {\n \"input\": {\n \"format\": {\n \"rate\": 123,\n \"type\": \"audio/pcm\"\n },\n \"noise_reduction\": {},\n \"transcription\": {\n \"keywords\": [\n \"<string>\"\n ],\n \"language\": \"<string>\",\n \"languages\": [\n \"<string>\"\n ],\n \"model\": \"<string>\",\n \"prompt\": \"<string>\"\n },\n \"turn_detection\": {\n \"type\": \"server_vad\",\n \"create_response\": true,\n \"idle_timeout_ms\": 123,\n \"interrupt_response\": true,\n \"prefix_padding_ms\": 123,\n \"silence_duration_ms\": 123,\n \"threshold\": 123\n }\n },\n \"output\": {\n \"format\": {\n \"rate\": 123,\n \"type\": \"audio/pcm\"\n },\n \"speed\": 123,\n \"voice\": \"<string>\"\n }\n },\n \"include\": [\n \"item.input_audio_transcription.logprobs\"\n ],\n \"instructions\": \"<string>\",\n \"max_output_tokens\": 123,\n \"model\": \"<string>\",\n \"output_modalities\": [],\n \"parallel_tool_calls\": true,\n \"prompt\": {\n \"id\": \"<string>\",\n \"variables\": {},\n \"version\": \"<string>\"\n },\n \"reasoning\": {},\n \"tools\": [\n {\n \"description\": \"<string>\",\n \"name\": \"<string>\",\n \"parameters\": \"<unknown>\",\n \"type\": \"function\"\n }\n ],\n \"tracing\": \"auto\"\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.example.com/v1/realtime/client_secrets")
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 \"expires_after\": {\n \"anchor\": \"<string>\",\n \"seconds\": 1\n },\n \"session\": {\n \"type\": \"realtime\",\n \"audio\": {\n \"input\": {\n \"format\": {\n \"rate\": 123,\n \"type\": \"audio/pcm\"\n },\n \"noise_reduction\": {},\n \"transcription\": {\n \"keywords\": [\n \"<string>\"\n ],\n \"language\": \"<string>\",\n \"languages\": [\n \"<string>\"\n ],\n \"model\": \"<string>\",\n \"prompt\": \"<string>\"\n },\n \"turn_detection\": {\n \"type\": \"server_vad\",\n \"create_response\": true,\n \"idle_timeout_ms\": 123,\n \"interrupt_response\": true,\n \"prefix_padding_ms\": 123,\n \"silence_duration_ms\": 123,\n \"threshold\": 123\n }\n },\n \"output\": {\n \"format\": {\n \"rate\": 123,\n \"type\": \"audio/pcm\"\n },\n \"speed\": 123,\n \"voice\": \"<string>\"\n }\n },\n \"include\": [\n \"item.input_audio_transcription.logprobs\"\n ],\n \"instructions\": \"<string>\",\n \"max_output_tokens\": 123,\n \"model\": \"<string>\",\n \"output_modalities\": [],\n \"parallel_tool_calls\": true,\n \"prompt\": {\n \"id\": \"<string>\",\n \"variables\": {},\n \"version\": \"<string>\"\n },\n \"reasoning\": {},\n \"tools\": [\n {\n \"description\": \"<string>\",\n \"name\": \"<string>\",\n \"parameters\": \"<unknown>\",\n \"type\": \"function\"\n }\n ],\n \"tracing\": \"auto\"\n }\n}"
response = http.request(request)
puts response.read_body{
"expires_at": 1,
"session": {
"id": "<string>",
"object": "realtime.session",
"type": "realtime",
"audio": {
"input": {
"format": {
"rate": 123,
"type": "audio/pcm"
},
"noise_reduction": {
"type": "near_field"
},
"transcription": {
"delay": "minimal",
"keywords": [
"<string>"
],
"language": "<string>",
"languages": [
"<string>"
],
"model": "<string>",
"prompt": "<string>"
},
"turn_detection": {
"type": "server_vad",
"create_response": true,
"idle_timeout_ms": 123,
"interrupt_response": true,
"prefix_padding_ms": 123,
"silence_duration_ms": 123,
"threshold": 123
}
},
"output": {
"format": {
"rate": 123,
"type": "audio/pcm"
},
"speed": 123,
"voice": "<string>"
}
},
"expires_at": 123,
"include": [
"item.input_audio_transcription.logprobs"
],
"instructions": "<string>",
"max_output_tokens": 123,
"model": "<string>",
"output_modalities": [
"text"
],
"prompt": {
"id": "<string>",
"variables": {},
"version": "<string>"
},
"reasoning": {
"effort": "minimal"
},
"tool_choice": "none",
"tools": [
{
"description": "<string>",
"name": "<string>",
"parameters": "<unknown>",
"type": "function"
}
],
"tracing": "auto",
"truncation": "auto"
},
"value": "<string>"
}{
"error": {
"code": "<string>",
"message": "<string>"
}
}授权
beareranthropicKeygoogleKeyqueryKey
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
请求体
application/json