核心能力
- 实时语音:支持文本与音频输入输出
- 可调推理:可为语音工作流设置推理强度
- 工具调用:支持实时会话中的函数调用
- 多模态输入:支持文本、音频和图片输入
快速示例
Node.js WebSocket
Install thews package, then connect with the model query parameter and Bearer token.
Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
GPT-Realtime-2:支持推理和工具调用的实时语音模型。
ws package, then connect with the model query parameter and Bearer token.
import WebSocket from "ws";
const ws = new WebSocket(
"wss://api.mixroute.ai/v1/realtime?model=gpt-realtime-2",
{ headers: { Authorization: "Bearer YOUR_API_KEY" } },
);
ws.on("open", () => {
ws.send(JSON.stringify({
type: "response.create",
response: { modalities: ["text"] },
}));
});
ws.on("message", (data) => console.log(data.toString()));
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
model | string | 是 | 固定为 gpt-realtime-2。 |
Authorization | header | 是 | WebSocket 握手时发送的 Bearer API Key。 |
session.update | event | 否 | 配置模态、指令、工具、音频和推理。 |
response.create | event | 是 | 为当前会话启动模型生成。 |