Deployment
Self-host chans on your infrastructure
Prerequisites
- Python 3.11+
- PostgreSQL 14+ with pgvector extension
- LiveKit server (cloud or self-hosted)
- LLM, STT, TTS providers – self-hosted services with OpenAI-compatible API, or cloud provider API keys
Quick Start
1. Clone the repository
git clone https://github.com/ai-chans/core.gitcd core
2. Install dependencies
pip install -e ".[dev]"
3. Configure environment
cp .env.example .env
Edit .env with your settings:
# DatabaseDATABASE_URL=postgresql://user:pass@localhost:5432/chans
# LiveKitLIVEKIT_URL=wss://your-livekit.example.comLIVEKIT_API_KEY=your-api-keyLIVEKIT_API_SECRET=your-api-secret
# Admin APICHANS_ADMIN_API_KEY=your-admin-key
4. Run database migrations
make db-apply
5. Start the services
Start the API server. This is required for the SDK to connect and for the Admin API/Panel to function:
uvicorn chans.server:app --port 8080
Once running, access the Admin Panel at http://localhost:8080/home.
Start the voice agent (in a separate terminal):
python agent.py dev # Development mode with hot reloadpython agent.py start # Production mode
6. Verify deployment
curl http://localhost:8080/health# {"status": "ok"}
Configure Provider Presets
Before creating agents, configure provider presets for LLM, STT, and TTS via the Admin Panel:
Admin Panel: http://localhost:8080/home
Navigate to Provider Presets and create presets for each type:
| Type | Description |
|---|---|
llm | Language model for generating responses |
stt | Speech-to-text for transcription |
tts | Text-to-speech for voice output |
For self-hosted providers, set provider to self-hosted and configure base_url and model in the config.
Create an Agent
In the Admin Panel, navigate to Agents and create a new agent:
- Set a name and system prompt
- Select mode:
enhanced(built-in AI) orpassthrough(webhook to your LLM) - Assign your default presets for LLM, STT, and TTS
The agent's token (e.g., agt_xxx) is used with the SDK to connect
Connecting the SDK
Point the SDK to your self-hosted endpoint:
const { connect } = useVoiceAgent({ agentToken: "agt_xxx", apiUrl: "http://localhost:8080", // Your self-hosted URL})
Environment Variables
Required
| Variable | Description |
|---|---|
DATABASE_URL | PostgreSQL connection string |
LIVEKIT_URL | LiveKit server WebSocket URL |
LIVEKIT_API_KEY | LiveKit API key |
LIVEKIT_API_SECRET | LiveKit API secret |
CHANS_ADMIN_API_KEY | Admin API authentication key |
Optional
| Variable | Default | Description |
|---|---|---|
CHANS_MODE | enhanced | Default agent mode |
CHANS_RATE_LIMIT_RPM | 60 | Requests per minute |
CHANS_LOG_LEVEL | INFO | Logging verbosity |
Database Setup
chans requires PostgreSQL with the pgvector extension:
CREATE EXTENSION IF NOT EXISTS vector;
LiveKit Options
Managed (Recommended)
Use LiveKit Cloud for production:
- Create a project
- Copy the URL, API key, and secret
- Set in your
.env
Self-hosted
Deploy your own LiveKit server. See LiveKit docs.
Coming Soon
Docker Deployment – Pre-built Docker images for containerized deployment.
Next Steps
- Admin API Reference – Full endpoint documentation
- SDK Quick Start – Connect your app