> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mixroute.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# GPT-Realtime-2

> GPT-Realtime-2：支持推理和工具调用的实时语音模型。

GPT-Realtime-2 是 OpenAI 面向实时语音代理和工具调用的推理型语音模型。

请使用 Realtime WebSocket 接口；该 MixRoute 路由不支持 Chat Completions。

## 核心能力

* 实时语音：支持文本与音频输入输出
* 可调推理：可为语音工作流设置推理强度
* 工具调用：支持实时会话中的函数调用
* 多模态输入：支持文本、音频和图片输入

## 快速示例

### Node.js WebSocket

Install the `ws` package, then connect with the model query parameter and Bearer token.

```javascript theme={null}
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  | 是  | 为当前会话启动模型生成。                     |

## 厂商资料

* [OpenAI GPT-Realtime-2 模型页面](https://developers.openai.com/api/docs/models/gpt-realtime-2)
