核心能力
- 即時語音:支援文字與音訊輸入輸出
- 可調推理:可為語音工作流程設定推理強度
- 工具呼叫:支援即時工作階段中的函式呼叫
- 多模態輸入:支援文字、音訊與圖片輸入
快速範例
Node.js WebSocket
Install thews package, then connect with the model query parameter and Bearer token.
Documentation Index
Fetch the complete documentation index at: /docs/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 | 是 | 為目前工作階段啟動模型生成。 |