Voice Bridge Light
by @fangbb-coder
提供兼容OpenAI接口的轻量级本地STT(Whisper)和TTS(Edge TTS/Piper)语音桥接HTTP服务。
clawhub install voice-bridge-light📖 About This Skill
Voice Bridge Light
Lightweight offline voice bridging service providing OpenAI-compatible STT/TTS HTTP API.
Features
Usage
Installation
pip install -r requirements.txt
Start Service
Default using Edge TTS:
python api_server.py
Using Piper (model required):
TTS_ENGINE=piper PIPER_MODEL=models/piper/zh_CN-huayan-medium.onnx python api_server.py
API Endpoints
| Endpoint | Method | Description |
|----------|--------|-------------|
| GET /health | GET | Health check |
| POST /audio/speech | POST | TTS speech synthesis |
| POST /audio/transcriptions | POST | STT speech recognition |
Configuration Environment Variables
| Variable | Default | Description |
|----------|---------|-------------|
| VOICE_BRIDGE_HOST | 0.0.0.0 | Listen address |
| VOICE_BRIDGE_PORT | 18790 | Listen port |
| TTS_ENGINE | edge | TTS engine: edge or piper |
| EDGE_VOICE | zh-CN-XiaoxiaoNeural | Edge TTS voice |
| PIPER_MODEL | models/piper/zh_CN-huayan-medium.onnx | Piper model path |
| STT_MODEL | base | Whisper model size |
TTS Request Example
curl -X POST http://localhost:18790/audio/speech \
-H "Content-Type: application/json" \
-d '{
"input": "Hello, world!",
"voice": "zh-CN-XiaoxiaoNeural",
"response_format": "mp3"
}' \
--output speech.mp3
STT Request Example
curl -X POST http://localhost:18790/audio/transcriptions \
-F "file=@speech.mp3" \
-H "Content-Type: multipart/form-data"
OpenClaw Integration
Configure in openclaw.json:
{
"tts": {
"enabled": true,
"provider": "local-piper",
"baseUrl": "http://127.0.0.1:18790",
"apiKey": "local",
"voice": "zh-CN-XiaoxiaoNeural"
}
}
Dependencies
Service Management
systemd Service (Recommended)
[Unit]
Description=Voice Bridge Light - STT/TTS HTTP API
After=network.target[Service]
Type=simple
User=root
WorkingDirectory=/root/.openclaw/workspace/skills/voice-bridge-light
ExecStart=/usr/bin/python3 api_server.py
Restart=always
RestartSec=5
[Install]
WantedBy=multi-user.target
Enable and start:
systemctl daemon-reload
systemctl enable voice-bridge-light.service
systemctl start voice-bridge-light.service
Performance
Notes
License
MIT
💡 Examples
Installation
pip install -r requirements.txt
Start Service
Default using Edge TTS:
python api_server.py
Using Piper (model required):
TTS_ENGINE=piper PIPER_MODEL=models/piper/zh_CN-huayan-medium.onnx python api_server.py
API Endpoints
| Endpoint | Method | Description |
|----------|--------|-------------|
| GET /health | GET | Health check |
| POST /audio/speech | POST | TTS speech synthesis |
| POST /audio/transcriptions | POST | STT speech recognition |
Configuration Environment Variables
| Variable | Default | Description |
|----------|---------|-------------|
| VOICE_BRIDGE_HOST | 0.0.0.0 | Listen address |
| VOICE_BRIDGE_PORT | 18790 | Listen port |
| TTS_ENGINE | edge | TTS engine: edge or piper |
| EDGE_VOICE | zh-CN-XiaoxiaoNeural | Edge TTS voice |
| PIPER_MODEL | models/piper/zh_CN-huayan-medium.onnx | Piper model path |
| STT_MODEL | base | Whisper model size |
TTS Request Example
curl -X POST http://localhost:18790/audio/speech \
-H "Content-Type: application/json" \
-d '{
"input": "Hello, world!",
"voice": "zh-CN-XiaoxiaoNeural",
"response_format": "mp3"
}' \
--output speech.mp3
STT Request Example
curl -X POST http://localhost:18790/audio/transcriptions \
-F "file=@speech.mp3" \
-H "Content-Type: multipart/form-data"