Files
Xin Wang 56b574d987
Quality gate / backend (push) Canceled after 0s
Quality gate / frontend (push) Canceled after 0s
docs: clarify realtime interaction positioning and capability status
2026-09-24 02:49:46 +08:00

28 lines
2.1 KiB
Plaintext
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
---
title: 接入方式
description: 区分公开 Realtime 接口、Responses 文本接口和平台调试通道。
icon: plug
---
# 接入方式
新业务客户端使用 `/v1/` 下的公开接口。请求中的 `model` 是 `assistant:<助手 ID>`;底层模型、凭证、提示词和工具由服务端助手配置决定。
| 用途 | 接口 | 鉴权与数据 |
| --- | --- | --- |
| 浏览器或移动端实时音频 | `POST /v1/realtime/client_secrets`、`POST /v1/realtime/calls` | 业务后端用长期 Key 签发短期令牌;客户端用 WebRTC 媒体轨道传音频、DataChannel 传事件。 |
| 服务端或自定义客户端实时会话 | `/v1/realtime?model=assistant:<id>` WebSocket | 使用 Bearer Key;JSON 文本帧承载事件,音频为 Base64 PCM16。 |
| Pipeline 助手的文本调用 | `POST /v1/responses` | 长期 Bearer Key;支持 JSON 或 SSE、多轮 `previous_response_id`。 |
| 查询可调用助手 | `GET /v1/models` | 长期 Bearer Key;返回助手 ID 和其 `responses`/`realtime` 能力。 |
公开 Realtime 接口是 **OpenAI-compatible subset v1**,并附有可协商的 `x.interactive_media.*` 扩展。客户端可更新的会话字段有限;助手身份、模型、提示词、音色和工具等以服务端配置为准。WebSocket 暂只支持指定格式的音频与图片项,不支持连续视频;连续摄像头输入使用协商后的 WebRTC 视频轨道。
## 管理界面和旧通道
| 通道 | 当前用途 | 与公开接口的区别 |
| --- | --- | --- |
| `/api/webrtc/offer`、`/ws/voice` | 管理界面 WebRTC 预览和现有集成 | 使用管理员鉴权及平台信令/RTVI 消息。 |
| `/ws/stream` | 裸音频 WebSocket、内部调试和既有自定义客户端 | 使用管理员鉴权;先发启动 JSON,之后传二进制音频帧,不是 OpenAI Realtime JSON 事件协议。 |
这些通道目前仍在使用。文档建议移除的是**把它们写成第三方首选公开接口的旧表述**,不是立即删除端点。接入前请以开发者文档中的 `openai-compatibility.mdx`、`realtime-protocol.mdx` 和 `responses-api.mdx` 为字段及事件依据。