🥝 Kivi — Unified AI Chat Interface
Provider-agnostic AI chat with token-level streaming, server-side tools, session persistence, and auto-compaction. One beautiful UI, any backend.
✨ Features
- 🔀 Provider Switching — Switch between OpenAI, vLLM, Copilot, Claude mid-conversation
- ⚡ Token-Level Streaming — Real-time token streaming for all providers (not word-level)
- 🛠️ Server-Side Tools — bash, read, write, edit, glob, grep, web_search, web_fetch
- 💾 Session Persistence — SQLite-backed sessions with full message history
- 📦 Auto-Compaction — Automatically compacts context at 75% of provider's window
- 🎨 Claude-like UI — Dark/light themes, thinking blocks, tool blocks, markdown, code highlighting, LaTeX, SVG preview
- 📊 Token Dashboard — Usage tracking with Plotly charts
- 🔧 Git Dashboard — Built-in diff viewer, commit & push
🚀 Quick Start
pip install kivi-ai
kivi
Open http://localhost:8899 in your browser. That's it.
📦 Install with SDK support
# With GitHub Copilot SDK support
pip install kivi-ai[copilot]
# With Claude Agent SDK support
pip install kivi-ai[claude]
# Everything
pip install kivi-ai[all]
⚙️ Configuration
All configuration via environment variables or CLI flags:
# Set vLLM backend URL
kivi --vllm-url http://your-server:8000
# Custom port
kivi --port 9000
# Or use environment variables
export VLLM_URL=http://your-server:8000
export OPENAI_API_KEY=sk-...
export KIVI_PORT=9000
kivi
CLI Options
kivi Start server (default: 0.0.0.0:8899)
kivi --port 9000 Custom port
kivi --host 127.0.0.1 Bind to localhost only
kivi --vllm-url URL vLLM backend URL
kivi --reload Dev mode with auto-reload
kivi --help Show help
🏗️ Architecture
kivi_ai/
├── core/ # Types, interfaces, registry
│ ├── types.py # Message, StreamChunk, ToolCall, ModelInfo, etc.
│ ├── interfaces.py # BaseProvider ABC, ToolInterface, SessionStore
│ └── registry.py # Provider & tool registry singleton
├── providers/ # Provider implementations
│ ├── openai_provider.py # OpenAI & vLLM (OpenAI-compatible)
│ ├── copilot_provider.py # GitHub Copilot SDK
│ ├── claude_provider.py # Claude Agent SDK
│ └── config.py # Context windows, costs, defaults
├── streaming/ # Stream processing
│ ├── adapter.py # Normalize streams (filter empty, ensure DONE)
│ └── sse.py # StreamChunk → SSE text
├── sessions/ # Session management
│ ├── store.py # SQLite store (async, WAL mode)
│ ├── manager.py # Session lifecycle & provider switching
│ └── compaction.py # Auto-compact at 75% context window
├── tools/ # Server-side tool system
│ └── builtins.py # bash, read, write, edit, glob, grep, web_search, web_fetch
├── frontend/
│ └── index.html # Claude-like chat UI (single file)
├── server.py # FastAPI app — unified streaming endpoint
└── cli.py # CLI entry point
Key Design Decisions
- All providers normalize to
AsyncIterator[StreamChunk]— single streaming format - Sessions are provider-agnostic — switch providers without losing history
- SQLite with WAL mode + ThreadPoolExecutor — non-blocking async I/O
- Atomic message sequencing — no race conditions on concurrent writes
- Single unified endpoint —
POST /api/chat/streamhandles all providers
🔌 Providers
| Provider | Streaming | Tools | Thinking | Backend |
|---|---|---|---|---|
vllm |
✅ Token | ✅ | ✅ | Local vLLM server |
openai |
✅ Token | ✅ | ❌ | OpenAI API |
copilot |
✅ Token | ✅ | ❌ | GitHub Copilot SDK |
claude |
✅ Token | ✅ | ✅ | Claude Agent SDK |
qwen-copilot |
✅ Token | ✅ | ❌ | Copilot SDK → vLLM |
qwen-claude |
✅ Token | ✅ | ✅ | Claude SDK → vLLM |
🌐 API
All endpoints under the server:
| Method | Endpoint | Description |
|---|---|---|
POST |
/api/chat/stream |
Unified streaming (SSE) |
GET |
/api/sessions |
List all sessions |
POST |
/api/sessions |
Create session |
GET |
/api/sessions/:id/messages |
Get messages |
DELETE |
/api/sessions/:id |
Delete session |
GET |
/api/providers |
List providers |
GET |
/api/models/:provider |
List models |
GET |
/api/tools |
List available tools |
GET |
/api/usage |
Token usage stats |
📄 License
MIT — see LICENSE
Metadata
Release files for kivi-ai 0.3.19
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| kivi_ai-0.3.19.tar.gz | 137.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| kivi_ai-0.3.19-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 297.7 kB
Release files / kivi_ai-0.3.19.tar.gz
| Download URL | kivi_ai-0.3.19.tar.gz |
|---|---|
| Size | 137.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
86b014977b2c1b9363695bb03d5c03303e79fc612231428319405d0ac527fb2c
|
|
BLAKE2b-256 checksum How to use checksums |
9f2096c6273e258850e1e11726c7d7fd82bbfada11d7702b0d926930897ba845
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|
Release files / kivi_ai-0.3.19-py3-none-any.whl
| Download URL | kivi_ai-0.3.19-py3-none-any.whl |
|---|---|
| Size | 159.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
06a45d4802b7b5f392e5230c5c00cac2226781684630a738032c729a295b307a
|
|
BLAKE2b-256 checksum How to use checksums |
aaba4d840846eb34e8ef8beb28a6738058152731dd5093eae6939de6dda2c941
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.3
|