实时语音
实时语音
通过 WebSocket 建立实时语音会话,兼容 OpenAI Realtime API。
连接
wss://ai.czmanong.com/v1/realtime?model=<model_name>
Authorization: Bearer <API_KEY>
将 model 替换为网关已启用的实时语音模型名称。
会话流程
- 建立 WebSocket 连接
- 发送
session.update配置会话参数 - 发送
input_audio_buffer.append追加音频 - 发送
response.create触发模型响应 - 接收
response.audio.delta等事件
示例事件
{
"type": "session.update",
"session": {
"modalities": ["text", "audio"],
"voice": "alloy"
}
}
说明
实时语音对网络延迟敏感,建议在稳定网络环境下使用;具体可用模型以网关配置为准。