
gittech. site
for different kinds of informations and explorations.
Realtime-AI/OpenAI-realtime-WebRTC-go – OpenAI Client in Go
Published at
Dec 29, 2024
openai-realtime-webrtc-go
使用 Go 语言实现的 OpenAI Realtime API WebRTC 客户端,支持实时语音交互。
功能
- 基于 WebRTC 的实时音频通信
- 本地音频采集(使用 Pion MediaDevices)
- 远程音频播放(使用 Oto)
- Opus 音频编解码
- 支持 OpenAI 临时令牌认证
快速开始
前置要求
- Go 1.21+
- OpenAI API Key
安装
git clone https://github.com/realtime-ai/openai-realtime-webrtc-go.git
cd openai-realtime-webrtc-go
go mod tidy
运行
- 设置环境变量:
export OPENAI_API_KEY=your_api_key
- 运行程序:
go run .
技术栈
- Pion WebRTC: WebRTC 实现
- Pion MediaDevices: 音频设备管理
- Opus: 音频编解码
- Oto: 音频播放
License
MIT