实时语音(Realtime)
curl --request GET \
--url wss://api.tennda.ai/v1/realtimeimport requests
url = "wss://api.tennda.ai/v1/realtime"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('wss://api.tennda.ai/v1/realtime', 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 => "wss://api.tennda.ai/v1/realtime",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "wss://api.tennda.ai/v1/realtime"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("wss://api.tennda.ai/v1/realtime")
.asString();require 'uri'
require 'net/http'
url = URI("wss://api.tennda.ai/v1/realtime")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body音频处理与内容安全
实时语音(Realtime)
WebSocket 实时音频对话
GET
/
v1
/
realtime
实时语音(Realtime)
curl --request GET \
--url wss://api.tennda.ai/v1/realtimeimport requests
url = "wss://api.tennda.ai/v1/realtime"
response = requests.get(url)
print(response.text)const options = {method: 'GET'};
fetch('wss://api.tennda.ai/v1/realtime', 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 => "wss://api.tennda.ai/v1/realtime",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "wss://api.tennda.ai/v1/realtime"
req, _ := http.NewRequest("GET", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("wss://api.tennda.ai/v1/realtime")
.asString();require 'uri'
require 'net/http'
url = URI("wss://api.tennda.ai/v1/realtime")
http = Net::HTTP.new(url.host, url.port)
request = Net::HTTP::Get.new(url)
response = http.request(request)
puts response.read_body简介
通过 WebSocket 建立实时语音对话会话,兼容 OpenAI Realtime API。需使用 WebSocket 协议连接,而非普通 HTTP POST。认证
在建立 WebSocket 连接时携带 Bearer Token(具体方式以 OpenAI Realtime 规范为准,通常为连接头或首条鉴权消息)。连接示例
wss://api.tennda.ai/v1/realtime?model=gpt-4o-realtime-preview
string
实时模型,如
gpt-4o-realtime-preview常用说明
- 协议升级响应:101 Switching Protocols 表示连接成功
- 连接后按 Realtime 事件协议发送/接收音频与文本
- 适用于低延迟语音助手、实时翻译等场景
⌘I
