Kivi โ Unified AI chat interface. Provider-agnostic streaming chat with tools, sessions, auto-compaction. Supports OpenAI, vLLM, GitHub Copilot SDK, Claude Agent SDK.
Project description
๐ฅ 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
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file kivi_ai-0.1.5.tar.gz.
File metadata
- Download URL: kivi_ai-0.1.5.tar.gz
- Upload date:
- Size: 59.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a9ea773b9b5171217b05f9f6e8c603197677e2b3a141dd6d893de7f1f078e37e
|
|
| MD5 |
84fe7deac663e48f85f70e6f2a0d7069
|
|
| BLAKE2b-256 |
172d5b52ac8e870c9b25496b98c1b58f393a206c2a05b0cdefdfa86b51b98a77
|
File details
Details for the file kivi_ai-0.1.5-py3-none-any.whl.
File metadata
- Download URL: kivi_ai-0.1.5-py3-none-any.whl
- Upload date:
- Size: 65.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d0c2e23b719b6c1b6ab68a6ee6248c441b03cafa6ab0253fe0cce157374c278e
|
|
| MD5 |
4ed3a8494e10ae10ef8574823af3d211
|
|
| BLAKE2b-256 |
4c02013c4b8e99907fe487509399db886c74e93417796ebadf30e3bc760e3f1b
|