项目介绍
Agent 开发框架 · 2026-11-09 更新 · 本站尚未实测
Sayna 是一个用 Rust 编写的高性能实时语音处理服务器,README 将其定位为“为 AI 代理提供统一语音层”的服务端组件:对外提供统一的语音识别(STT)与语音合成(TTS)接口,并通过 WebSocket 与 REST API 供其他应用调用。
需要说明的是,Sayna 本身是一个可自行部署的服务端(server)与框架,不是可下载即用的工作流文件,也不是 MCP 服务或 Skill。它承担的是把上层业务或代理框架与底层语音模型服务商连接起来的中介角色。
核心能力
点击能力名称查看输入、输出和原文依据。
- 统一语音接口:用单一接口对接多个 STT/TTS 供应商,减少在多供应商之间切换的适配成本。
- 实时处理:基于 WebSocket 的双向音频流传输,README 说明音频输入为 16kHz、16 位 PCM 二进制数据。
- LiveKit 集成:支持基于房间的 WebRTC 音频流通信,并提供 LiveKit 参与者令牌生成与 Webhook 端点。
- VAD 与轮次检测:通过
stt-vad特性使用 Silero-VAD 做音频级静音检测,并结合基于 ONNX 的模型判断说话人轮次是否结束。 - 噪声过滤:通过可选的
noise-filter特性集成 DeepFilterNet。 - 多供应商支持:README 列出的供应商包括 Deepgram、ElevenLabs、Google Cloud(WaveNet、Neural2、Studio 音色)、Microsoft Azure(宣称 140 多种语言、400 多种神经音色)。
- 无音频模式:在未配置任何供应商凭据时,可通过发送
audio: false的配置消息运行控制面,便于调试 WebSocket 流程与界面开发。
实际应用场景
适用场景
根据 README 的描述,适合需要自建语音服务端的团队,例如为语音代理提供 STT/TTS 编排、在 LiveKit 音视频房间中处理语音、需要在多家语音供应商之间做统一接入或切换、以及在开发阶段先不接入音频、仅联调控制面与消息流的场景。
README 未给出具体性能指标、并发上限或延迟数据,实际表现需自行评估,相关结论待核验。
安装与接入
README 给出的主要获取方式是通过 Docker 运行官方镜像,需预先安装 Docker,并至少配置一个供应商凭据(无音频模式除外)。原文给出的单条运行命令为:
docker run -d \
-p 3001:3001 \
-e DEEPGRAM_API_KEY=your-key \
saynaai/sayna
服务默认监听 http://localhost:3001。也提供了 Docker Compose 与从源码构建的方式:源码构建要求 Rust 1.88.0 或更高版本,可选安装 ONNX Runtime 以支持 stt-vad 特性;README 给出的构建与运行命令包括 cargo build、cargo build --release、cargo run 与 cargo run -- -c config.yaml。
主要接入端点:WebSocket 为 /ws;REST 包括 GET /(健康检查)、GET /voices、POST /speak、POST /livekit/token、POST /livekit/webhook。客户端连接 /ws 后先发送配置消息选择供应商与参数,再传输二进制音频或文本。
认证为可选能力:AUTH_REQUIRED=true 时,受保护端点需要 Authorization: Bearer <token> 或 ?api_key=<token>,令牌校验委托给外部认证服务,相关配置包括 AUTH_SERVICE_URL、AUTH_SIGNING_KEY_PATH 等。
使用条件与限制
- 是否需要部署
- 需自行准备运行环境,具体要求见正文
- 是否需要注册
- 账号和认证要求见正文;未明确说明的项目仍待核验
- 是否需要 API Key
- 待核验
- 费用与额度
- 费用边界见正文,项目许可不代表模型或托管服务免费
- 所需权限
- 待核验
- 许可证与服务条款
- 待核验
权限费用与限制
- 凭据与密钥:使用任一音频供应商都需要对应 API Key 或凭据(Deepgram、ElevenLabs 的 API Key,Google Cloud 的服务账号凭据文件,Azure 的订阅密钥与区域)。凭据可配置在服务端,也可在每次请求或会话级别传入覆盖。
- 费用:Sayna 仓库代码本身基于 Apache-2.0 许可,但底层供应商的 STT/TTS 调用通常由各供应商计费;README 未说明 Sayna 是否有商业模块或托管服务及其价格,费用与配额需向各供应商及项目方分别核验。
- 网络与合规:所涉及的供应商均为境外服务,README 未说明国内网络可达性、数据存储地域或跨境数据传输合规问题,这些均待核验。
- 认证与安全:默认
AUTH_REQUIRED=false,即未启用认证时接口处于开放状态,部署到公网前需自行加固;SIP Webhook 转发要求配置签名密钥。README 未给出完整的安全模型说明。
国内使用情况
网友核验 用户经验分享
与站长实测独立,不代表官方认证或本站已实测。
最近核验:暂无有效核验。参与人数按当前项目有效身份去重;不同核验项分别统计,不合并成用户总结果。仅统计审核通过且未过期的记录。
分项统计、有效期与样本量
| 核验项目 | 有效人数 | 成功 / 部分 / 失败 / 无法判断 | 成功率 | 最近核验 / 有效期 |
|---|---|---|---|---|
| 官方网站访问 | 0 | 0 / 0 / 0 / 0 | 样本不足 | 暂无 / 7 天 |
| GitHub 仓库访问 | 0 | 0 / 0 / 0 / 0 | 样本不足 | 暂无 / 7 天 |
| 安装与运行 | 0 | 0 / 0 / 0 / 0 | 样本不足 | 暂无 / 30 天 |
| 官方服务国内连接 / MCP 连接 | 0 | 0 / 0 / 0 / 0 | 样本不足 | 暂无 / 30 天 |
| 国内网络情况 | 0 | 0 / 0 / 0 / 0 | 样本不足 | 暂无 / 7 天 |
| 国内模型兼容性 | 0 | 0 / 0 / 0 / 0 | 样本不足 | 暂无 / 30 天 |
| 自定义 API | 0 | 0 / 0 / 0 / 0 | 样本不足 | 暂无 / 30 天 |
| 海外服务依赖 | 0 | 0 / 0 / 0 / 0 | 样本不足 | 暂无 / 30 天 |
| 海外账号要求 | 0 | 0 / 0 / 0 / 0 | 样本不足 | 暂无 / 30 天 |
| 中文界面 | 0 | 0 / 0 / 0 / 0 | 样本不足 | 暂无 / 30 天 |
| 客户端兼容性 | 0 | 0 / 0 / 0 / 0 | 样本不足 | 暂无 / 30 天 |
| 账号及费用信息 | 0 | 0 / 0 / 0 / 0 | 样本不足 | 暂无 / 30 天 |
成功率 = 成功 ÷(成功 + 部分成功 + 失败);无法判断不计入分母。至少 5 份可判断结果才显示成功率。账号、费用、海外依赖与语言等事实项,成功表示核查结论与资料吻合,具体观察另行统计;不表示免费或没有海外依赖。不同网络、客户端和版本的结果不能直接等同。
最近有效核验
暂无审核通过且未过期的网友核验。欢迎提交真实使用记录。
查看全部有效核验 →国内实测状态:国内可用性待核验。协议兼容和官方资料说明不等于国内网络可用。
- 官方网站访问
- 尚未实测 待核验
- GitHub 仓库访问
- 尚未实测 待核验
- 官方服务国内连接
- 尚未实测 待核验
- 国内网络情况
- 尚未实测 待核验
- 国内模型兼容性
- 尚未实测 待核验
- 自定义 API
- 尚未实测 待核验
- 海外服务依赖
- 尚未实测 待核验
- 海外账号要求
- 尚未实测 待核验
- 中文界面
- 尚未实测 待核验
- 国内最后核验时间
- 尚未实测
许可与国内使用
仓库 LICENSE 文件为 Apache License 2.0,覆盖仓库内的代码。该许可不代表第三方模型、云语音服务或 Docker 镜像所依赖的外部资源同样开源或免费;其中 Docker 镜像、托管服务与供应商服务的条款需单独核验。README 未提及国内模型或国内语音供应商支持,也未说明在中国大陆的部署与合规建议,相关情况待核验。
平台支持以 Linux 容器环境为主,README 未提及 Windows 原生支持或 macOS 支持,均待核验。
项目资料与来源
字段依据与待核验事项
access:来源确认 · saynaai/sayna
project_type:来源确认 · A high-performance real-time voice processing server built in Rust that provides unified Speech-to-Text (STT) and Text-to-Speech (TTS) services through WebSocket and REST APIs.
原始 README(折叠技术参考)
# Sayna
A high-performance real-time voice processing server built in Rust that provides unified Speech-to-Text (STT) and Text-to-Speech (TTS) services through WebSocket and REST APIs.

## Features
- **Unified Voice API**: Single interface for multiple STT/TTS providers
- **Real-time Processing**: WebSocket-based bidirectional audio streaming
- **LiveKit Integration**: WebRTC audio streaming with room-based communication
- **VAD + Turn Detection**: Silero-VAD for audio-level silence detection with integrated ML-based end-of-turn detection (`stt-vad` feature)
- **Advanced Noise Filtering**: Optional DeepFilterNet integration (`noise-filter` feature)
- **Provider Flexibility**: Pluggable architecture supporting multiple providers
- Deepgram (STT/TTS)
- ElevenLabs (STT/TTS)
- Google Cloud (STT/TTS) - WaveNet, Neural2, and Studio voices
- Microsoft Azure (STT/TTS) - 400+ neural voices across 140+ languages
- **Audio-Disabled Mode**: Development mode without API keys
## Quick Start
### Prerequisites
- Docker
- At least one provider credential source (server config/env or per-request/session auth override; optional in audio-disabled mode)
### Run with Docker
```bash
docker run -d \
-p 3001:3001 \
-e DEEPGRAM_API_KEY=your-key \
saynaai/sayna
```
The server will be available at `http://localhost:3001`.
### Docker Compose
```yaml
version: "3.9"
services:
sayna:
image: saynaai/sayna
ports:
- "3001:3001"
environment:
DEEPGRAM_API_KEY: ${DEEPGRAM_API_KEY}
ELEVENLABS_API_KEY: ${ELEVENLABS_API_KEY}
CACHE_PATH: /data/cache
volumes:
- sayna-cache:/data/cache
volumes:
sayna-cache: {}
```
For complete Docker documentation including LiveKit integration, see [docs/docker.md](docs/docker.md).
### Running Without API Keys (Audio-Disabled Mode)
You can run Sayna without provider credentials by using audio-disabled mode. This is useful when you want to exercise the control plane without STT/TTS initialization. Send a WebSocket configuration message with `audio: false`:
```json
{
"type": "config",
"audio": false
}
```
This mode is useful for:
- Local development and testing
- UI/UX development without audio processing
- Testing WebSocket message flows
- Debugging non-audio features
## Authentication (Optional)
Sayna supports customer-based authentication that delegates token validation to an external authentication service. When enabled, protected API endpoints require a valid token provided either as `Authorization: Bearer <token>` or as `?api_key=<token>`.
### Enabling Authentication
Add to your `.env` file:
```env
AUTH_REQUIRED=true
AUTH_SERVICE_URL=https://your-auth-service.com/auth
AUTH_SIGNING_KEY_PATH=/path/to/auth_private_key.pem
AUTH_TIMEOUT_SECONDS=5
```
Generate signing keys:
```bash
# Generate RSA private key
openssl genrsa -out auth_private_key.pem 2048
# Extract public key (share with auth service)
openssl rsa -in auth_private_key.pem -pubout -out auth_public_key.pem
```
### Making Authenticated Requests
```bash
# Authorization header
curl -X POST http://localhost:3001/speak \
-H "Authorization: Bearer <API_KEY>" \
-H "Content-Type: application/json" \
-d '{
"text": "Hello world",
"tts_config": {
"provider": "deepgram",
"model": "aura-asteria-en"
}
}'
# Query parameter alternative
curl -X POST "http://localhost:3001/speak?api_key=your-token-here" \
-H "Content-Type: application/json" \
-d '{
"text": "Hello world",
"tts_config": {
"provider": "deepgram",
"model": "aura-asteria-en"
}
}'
```
For complete authentication setup and architecture details, see [docs/authentication.md](docs/authentication.md).
## API Endpoints
### WebSocket
- **Endpoint**: `/ws`
- **Protocol**: WebSocket
- **Purpose**: Real-time bidirectional audio streaming and control
#### Message Types
**Configuration Message**:
```json
{
"type": "config",
"audio": true,
"stt_config": {
"provider": "deepgram",
"language": "en-US",
"sample_rate": 16000,
"channels": 1,
"punctuation": true,
"encoding": "linear16",
"model": "nova-3",
"auth": {
"api_key": "<API_KEY>"
}
},
"tts_config": {
"provider": "elevenlabs",
"voice_id": "voice_id_here",
"model": "eleven_flash_v2_5",
"audio_format": "mp3_44100_128",
"sample_rate": 44100,
"auth": {
"api_key": "<API_KEY>"
}
}
}
```
`stt_config.auth` and `tts_config.auth` are optional. If omitted, or sent as `{}`, Sayna falls back to the server-configured provider credentials. If an auth object is provided, it must be complete for that provider. Current shapes are:
- API key providers: `{ "api_key": "..." }`
- Google Cloud: `{ "credentials": "/path/to/creds.json" }` or `{ "credentials": { ...service account json... } }`
- Azure Speech: `{ "api_key": "...", "region": "eastus" }`
**Audio Input**: Binary audio data (16kHz, 16-bit PCM)
**Text Input**:
```json
{
"type": "text",
"text": "Convert this text to speech"
}
```
### REST API
- **Health Check**: `GET /` - Server health check endpoint
- **Voices**: `GET /voices` - List available TTS voices (requires auth if `AUTH_REQUIRED=true`)
- **Speak**: `POST /speak` - Generate speech from text (requires auth if `AUTH_REQUIRED=true`)
- **LiveKit Token**: `POST /livekit/token` - Generate LiveKit participant token (requires auth if `AUTH_REQUIRED=true`)
- **LiveKit Webhook**: `POST /livekit/webhook` - Webhook endpoint for LiveKit events (unauthenticated, uses LiveKit signature verification)
- Called by LiveKit to deliver room and participant events
- Validates requests using LiveKit's JWT signature mechanism
- Logs SIP-related attributes for phone call troubleshooting
- See [docs/livekit_webhook.md](docs/livekit_webhook.md) for details
## Architecture Overview
### Core Components
- **VoiceManager**: Central coordinator for all voice processing operations
- **Provider System**: Trait-based abstraction for pluggable STT/TTS providers
- **WebSocket Handler**: Real-time communication and message routing
- **LiveKit Integration**: WebRTC audio streaming and room management
- **DeepFilterNet**: Advanced noise reduction with adaptive processing
### Request Flow
1. Client establishes WebSocket connection to `/ws`
2. Client sends configuration with provider selection
3. Audio processing pipeline:
- **STT**: Audio � Noise Filter (optional) � STT Provider � Text
- **TTS**: Text � TTS Provider � Audio � Client
4. LiveKit mode enables room-based audio streaming
## Development
For local development, you can build and run from source.
### Prerequisites
- Rust 1.88.0 or later
- Optional: ONNX Runtime (for `stt-vad` feature which includes VAD and turn detection)
### Building from Source
```bash
# Development build
cargo build
# Release build (optimized)
cargo build --release
# Run the server
cargo run
# Run with a config file
cargo run -- -c config.yaml
```
### Feature Flags
Sayna exposes several Cargo features that gate heavyweight subsystems:
- `stt-vad`: Silero-VAD voice activity detection with integrated ONNX-based turn detection. When enabled, VAD monitors audio for silence and triggers the turn detection model to confirm if the speaker's turn is complete.
- `noise-filter`: DeepFilterNet noise suppression pipeline
- `openapi`: OpenAPI 3.1 specification generation
```bash
# Run with VAD and turn detection
cargo run --features stt-vad
# Run with noise filter
cargo run --features noise-filter
# Run with multiple features
cargo run --features stt-vad,noise-filter,openapi
```
The Docker image includes `stt-vad` and `noise-filter` by default.
### Testing
```bash
# Run all tests
cargo test
# Run specific test
cargo test test_name
# Run with output
cargo test -- --nocapture
```
### Code Quality
```bash
# Format code
cargo fmt
# Run linter
cargo clippy
# Check for security vulnerabilities
cargo audit
```
### Building Docker Image Locally
```bash
# Build Docker image
docker build -t sayna .
# Run container
docker run -p 3001:3001 --env-file .env sayna
```
## Configuration
### Environment Variables
| Variable | Description | Default | Required |
|----------|-------------|---------|----------|
| `DEEPGRAM_API_KEY` | Deepgram API authentication | - | No* |
| `ELEVENLABS_API_KEY` | ElevenLabs API authentication | - | No* |
| `GOOGLE_APPLICATION_CREDENTIALS` | Path to Google Cloud service account JSON | - | No* |
| `AZURE_SPEECH_SUBSCRIPTION_KEY` | Azure Speech Services subscription key | - | No* |
| `AZURE_SPEECH_REGION` | Azure region (e.g., eastus, westeurope) | `eastus` | No* |
| `LIVEKIT_URL` | LiveKit server WebSocket URL | `ws://localhost:7880` | No |
| `LIVEKIT_API_KEY` | LiveKit API key (for webhooks and token generation) | - | No*** |
| `LIVEKIT_API_SECRET` | LiveKit API secret (for webhooks and token generation) | - | No*** |
| `HOST` | Server bind address | `0.0.0.0` | No |
| `PORT` | Server port | `3001` | No |
| `AUTH_REQUIRED` | Enable authentication | `false` | No |
| `AUTH_API_SECRETS_JSON` | API secrets JSON array (`[{id, secret}]`) | - | Yes** |
| `AUTH_API_SECRET` | Legacy single API secret | - | No**** |
| `AUTH_API_SECRET_ID` | Legacy API secret id for `AUTH_API_SECRET` | `default` | No |
| `AUTH_SERVICE_URL` | External auth service endpoint | - | Yes** |
| `AUTH_SIGNING_KEY_PATH` | Path to JWT signing private key | - | Yes** |
| `AUTH_TIMEOUT_SECONDS` | Auth request timeout | `5` | No |
*Not required when using audio-disabled mode
**Required when `AUTH_REQUIRED=true` for the auth method you choose
***Required for LiveKit webhook validation and token generation features
****Legacy single-secret fallback; prefer `AUTH_API_SECRETS_JSON`
### SIP Configuration (Optional)
Sayna supports first-class SIP configuration for managing SIP-specific settings. See [docs/sip_config.md](docs/sip_config.md) for detailed documentation.
**YAML Configuration:**
```yaml
sip:
room_prefix: "sip-"
allowed_addresses:
- "192.168.1.0/24"
- "10.0.0.1"
hook_secret: "your-signing-secret" # Required if hooks configured
hooks:
- host: "example.com"
url: "https://webhook.example.com/events"
```
**Important:** All SIP webhook forwarding requests are signed with HMAC-SHA256. You **must** configure `hook_secret` (or per-hook `secret` overrides) if using `sip.hooks`. See [docs/livekit_webhook.md#webhook-signing](docs/livekit_webhook.md#webhook-signing) for signature verification examples.
**Environment Variables:**
- `SIP_ROOM_PREFIX`: Room name prefix for SIP calls (required if SIP enabled)
- `SIP_ALLOWED_ADDRESSES`: Comma-separated IP addresses/CIDRs
- `SIP_HOOK_SECRET`: Global signing secret for webhook authentication (min 16 chars)
- `SIP_HOOKS_JSON`: JSON array of webhook configurations (with optional per-hook `secret` field)
## Performance Considerations
- **DeepFilterNet**: CPU-intensive processing uses thread pooling
- **Audio Buffering**: Optimized chunk processing for low latency
- **Connection Reuse**: Provider connections are maintained for efficiency
- **Async Processing**: Non-blocking WebSocket message handling
- **Memory Management**: Careful buffer management in audio loops
## Contributing
1. Review the development rules in `.cursor/rules/`:
- `rust.mdc`: Rust best practices
- `core.mdc`: Business logic specifications
- `axum.mdc`: Framework patterns
- `livekit.mdc`: LiveKit integration details
2. Follow the existing code patterns and conventions
3. Add tests for new features
4. Ensure `cargo fmt` and `cargo clippy` pass
## Support
For issues, questions, or contributions, please visit the [GitHub repository](https://github.com/saynaai/sayna).
历史前置条件说明(补充参考)
前置环境:Docker(推荐)或 Rust 1.88.0 及以上用于源码构建,可选 ONNX Runtime 以支持 stt-vad 特性;权限:默认无需认证,启用 AUTH_REQUIRED 后需外部认证服务与 JWT 签名私钥;模型/API Key:至少一个供应商凭据(Deepgram 或 ElevenLabs API Key、Google Cloud 服务账号凭据、Azure 订阅密钥与区域),无音频模式可不配置;费用:仓库代码 Apache-2.0,供应商语音调用计费,Sayna 商业模块与托管服务价格待核验;境外依赖:所列供应商均为境外服务,国内可达性与数据合规待核验。
项目来源与清单版权许可
https://github.com/SaynaAI/sayna
整理来源:https://github.com/slavakurilyak/awesome-ai-agents
清单版权与许可:
MIT License
Copyright (c) 2024 Slava Kurilyak
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.