This release is a pre-release and may not be stable for production use.
Your Digital Companion. Not a Tool. A Partner.
Self-hosted, asynchronous Telegram bot that orchestrates multiple AI providers, tools, and sub-agents to get real work done.
🌍 Read this in other languages:
Español •
Português (Brasil) •
Українська •
Bahasa Indonesia •
Türkçe •
Русский •
日本語 •
繁體中文 •
简体中文
Chibi is built for the moment you realize you need more than “an AI tool.” You need a partner that can coordinate models, run work in the background, and integrate with your systems - without you babysitting prompts.
Chibi is an asynchronous, self-hosted Telegram-based digital companion that orchestrates multiple AI providers and tools to deliver outcomes: code changes, research syntheses, media generation, and operational tasks.
Why Chibi
- One interface (Telegram). Mobile/desktop/web, always with you.
- Provider-agnostic. Use the best model for each task - without vendor lock-in.
- Autonomous execution. Sub-agents work in parallel; long tasks run asynchronously.
- Tool-connected. Filesystem + terminal + MCP integrations (GitHub, browser, DBs, etc.).
- Self-hosted. Your data, your keys, your rules.
Supported AI providers (and endpoints)
Chibi supports multiple providers behind a single conversation. Add one key or many - Chibi can route per task.
LLM providers
First-party model providers:
- Alibaba Cloud (Qwen)
- Anthropic (Claude)
- DeepSeek
- Google (Gemini)
- MiniMax
- Mistral AI
- Moonshot AI (Kimi)
- OpenAI (GPT models)
- Xiaomi (MiMo models)
- xAI (Grok)
- ZhipuAI (GLM models)
Model resellers and inference aggregators:
- Baseten
- Cheaper Inference
- Cloudflare Workers AI
- DeepInfra
- Featherless
- Fireworks AI
- GreenPT
- Lyceum
- Melious
- Nebius
- Novita AI
- OpenRouter
- Parasail
- SambaNova
- SiliconFlow
- Together AI
OpenAI-compatible endpoints (self-host / local)
- Ollama
- vLLM
- LM Studio
- Any OpenAI-compatible API
Multimodal providers (optional)
- Images: Google (Imagen, Nano Banana), OpenAI (GPT Image), Alibaba (Qwen Image, Wan), xAI (Grok Imagine), ZhipuAI (GLM Image, CogView), MiniMax (Image-01), and any reseller-aggregator providing access to image generation models
- Music: Suno, ElevenLabs Music
- Voice (TTS/STT): ElevenLabs, OpenAI (GPT-4o Transcribe / TTS), Gemini (Transcribe), Together AI (Whisper, Kokoro), Xiaomi (MiMo TTS), Custom OpenAI-compatible (self-hosted)
Exact model availability depends on your configured provider keys and enabled features.
🚀 Quick Start (pip)
Install Chibi via pip and run it as a command-line application:
# Install the package
pip install chibi-bot
# Set up the agent (add API keys, update settings, etc)
chibi config
# Start the bot
chibi start
The bot will run as a background service. Use CLI commands to manage it.
CLI Commands
| Command | Description |
|---|---|
chibi start |
Start the bot as a background service |
chibi stop |
Stop the running bot |
chibi restart |
Restart the bot |
chibi config |
Generate or edit configuration |
chibi logs |
View bot logs |
Local client frontends
Chibi can serve its local clients over the versioned local JSONL protocol:
chibi stdio --tui
chibi stdio --vscode
chibi stdio --pycharm
chibi stdio --neovim
The command is intended to be started by the client frontend, not used interactively. Chibi owns the v1
protocol and supports compatible clients that negotiate the same version. The stdio process writes protocol
frames only to stdout and diagnostics to stderr. Existing Chibi command, tool, permission and moderation
behavior remains authoritative; the client adds no tool policy layer.
🚀 Quick start (Docker)
Create docker-compose.yml:
version: '3.8'
services:
chibi:
image: pysergio/chibi:latest
restart: unless-stopped
environment:
TELEGRAM_BOT_TOKEN: ${TELEGRAM_BOT_TOKEN} # Required
OPENAI_API_KEY: ${OPENAI_API_KEY} # Or any other provider
# Add more API keys as needed
volumes:
- chibi_data:/app/data
volumes:
chibi_data: {}
-
Get a bot token from @BotFather
-
Put secrets into
.env -
Run:
docker-compose up -d
Next:
- Installation guide: https://chibi.bot/installation
- Configuration reference: https://chibi.bot/configuration
🔑 Getting API Keys
Each provider requires its own API key. Here are the direct links:
First-party model providers:
- Alibaba (Qwen, Wan): modelstudio.console.alibabacloud.com
- Anthropic (Claude): console.anthropic.com
- DeepSeek: platform.deepseek.com
- Google (Gemini, Nano Banana, Imagen, Voice): aistudio.google.com/apikey
- MiniMax (Voice, MiniMax-M2.x): minimax.io
- Mistral AI: console.mistral.ai
- Moonshot (Kimi): platform.moonshot.cn
- OpenAI (GPT, DALL·E): platform.openai.com/api-keys
- xAI (Grok): console.x.ai
- ZhipuAI (GLM, CogView): z.ai/manage-apikey/apikey-list
Model resellers and inference aggregators:
- Baseten: baseten.co
- Cheaper Inference: cheaperinference.com
- Cloudflare Workers AI: dash.cloudflare.com/profile/api-tokens
- DeepInfra: deepinfra.com
- Featherless: featherless.ai
- Fireworks AI: fireworks.ai
- GreenPT: greenpt.com
- Lyceum: lyceum.technology
- Melious: melious.ai
- Nebius: nebius.com
- Novita AI: novita.ai
- OpenRouter: openrouter.ai/settings/keys
- Parasail: parasail.io
- SambaNova: sambanova.ai
- SiliconFlow: siliconflow.com
- Together AI: together.ai
Creative Tools:
- ElevenLabs (Voice): elevenlabs.io
- Suno (Music, unofficial): sunoapi.org
📖 Full guide with setup instructions: chibi.bot/guides/get-api-keys
Try this in the first 5 minutes
Paste these into Telegram after you deploy.
- Planning + execution
Ask me 3 questions to clarify my goal, then propose a plan and execute step 1.
- Parallel work (sub-agents)
Spawn 3 sub-agents: one to research options, one to draft a recommendation, one to list risks. Return a single decision.
- Agent mode (tools)
Inspect the project files and summarize what this repo does. Then propose 5 improvements and open a checklist.
- Background task
Start a background task: gather sources on X and deliver a synthesis in 30 minutes. Keep me updated.
What makes Chibi different
🎭 Multi-provider orchestration
Chibi can keep context while switching providers mid-thread, or choose the best model per step - balancing cost, capability, and speed.
🤖 Autonomous agent capabilities
- Recursive delegation: spawn sub-agents that can spawn their own sub-agents
- Background processing: long-running tasks execute asynchronously
- Filesystem access: read/write/search/organize files
- Terminal execution: run commands with LLM-moderated security
- Persistent memory: conversation history survives restarts with context management/summarization
- Skills: built-in skills ship inside the package and work out of the box after install; drop your own
.mdfiles into theskills_dirto add custom ones (a same-name file overrides a built-in) — the agent can load them into its system prompt on demand (load_skill)
🔌 Extensible via MCP (Model Context Protocol)
Connect Chibi to external tools and services (or build your own):
- GitHub (PRs, issues, code review)
- Browser automation
- Docker / cloud services
- Databases
- Creative tools (Blender, Figma)
If a tool can be exposed via MCP, Chibi can learn to use it.
🎨 Rich content generation
- Images: Nano Banana, Imagen, Qwen, Wan, GPT Image, Grok Imagine, GLM Image
- Music: Suno (including custom mode: style/lyrics/vocals)
- Voice: transcription + text-to-speech (ElevenLabs, OpenAI)
Use cases
Developers
You: “Run the tests and fix what’s broken. I’ll work on the frontend.”
Chibi: *spawns sub-agent, executes tests, analyzes failures, proposes fixes*
Researchers
You: “Research the latest developments in quantum computing. I need a synthesis by tomorrow.”
Chibi: *spawns multiple research agents, aggregates sources, delivers a report*
Creators
You: “Generate a cyberpunk cityscape and compose a synthwave track to match.”
Chibi: *generates an image, creates music, delivers both*
Teams
You: “Review this PR and update the documentation accordingly.”
Chibi: *analyzes changes, suggests improvements, updates docs via MCP*
Privacy, control, and safety
- Self-hosted: your data stays on your infrastructure
- Public Mode: users can bring their own API keys (no shared master key required)
- Access control: whitelist users/groups/models
- Storage options: local volumes, Redis, or DynamoDB
- Tool safety: agent tools are configurable; terminal execution is moderated and can be restricted
MAX_HISTORY_TOKENS — context summarization threshold (breaking default change)
MAX_HISTORY_TOKENS is the threshold at which Chibi auto-summarizes a conversation to keep context manageable. Its semantics changed: it now compares against the real, provider-reported prompt token count (the entire outgoing request: system prompt + activated skills + tool schemas + tool-call arguments + per-message structural overhead + conversation content) instead of the old heuristic that measured only conversation content + role. The real figure is ~4.8x larger than the old estimate for an identical conversation (see fix_context_size/context_size_accounting_analysis.md for the measured breakdown).
- Default re-based:
64000->100000. The new value protects the smallest commonly-supported context window (128k tokens):100000is ~78% of a 128k window (so summarization fires before a 128k model overflows) and ~50% of a 200k window (leaving comfortable headroom). The old64000was a history-only estimate that was never hit before a real overflow, because the estimate under-counts Cyrillic ~2x and excludes the fixed per-turn overhead (system prompt ~3.7k, tool schemas ~6.8k, activated skills ~5.9k,user_info~0.75–3k) — so a 128k model overflowed at ~128k real tokens while the heuristic still reported well under 64k. - Migration: if you set
MAX_HISTORY_TOKENSexplicitly in your.env, your old value was tuned against the old history-only estimate and now compares against a truthful figure that is ~4.8x larger for the same conversation. Re-tune it to the ~100k scale (e.g.64000->100000) so summarization fires before your smallest model's context window overflows, not after. If you never set it, the new default applies automatically. - The cold-start fallback (first turn after a process restart, when no provider data is cached yet) still uses the old heuristic so summarization remains functional.
REACTIVE_CONTEXT_RECOVERY — one-shot retry after context overflow
REACTIVE_CONTEXT_RECOVERY (default: true) is the reactive safety net that complements the proactive MAX_HISTORY_TOKENS threshold. When a provider rejects a request with a typed context_length_exceeded error, Chibi automatically summarizes the conversation history and retries the turn exactly once. If the retry succeeds, the user receives a normal answer (with a short note that context was compressed). If the retry overflows again or recovery fails for any reason, the turn falls back to the existing apology path — the summarization+retry loop can never run more than once per original turn. Set to false to disable reactive recovery and keep the pre-existing behavior (log + apology, no retry).
Working directory is thread-scoped (WORKING_DIR)
The agent's working directory - used for terminal commands and reported to the model as its current CWD - is thread-scoped, mirroring how the selected LLM model is bound per thread.
- Default: comes from the
WORKING_DIRsetting (default~/chibi) through the legacy user-level value; fresh deployments inherit the setting directly. - Per-thread override: any thread/conversation can override its working directory in isolation via the agent's
set_working_dirtool (LLM-driven only - there is no slash command, available whenFILESYSTEM_ACCESSis enabled). This lets two agents in different threads work on different projects simultaneously without interfering. - Resolution order: thread override → legacy user-level directory →
WORKING_DIRsetting. - Path normalization: values you set are expanded to absolute paths on save (
~/xbecomes/abs/x); untouched defaults keep their raw form. - Sub-agents spawned within a thread share that thread's working directory - the same effective path is injected into their system prompts and tool calls.
- Overrides survive thread cloning:
/new_thread_with_current_contextcarries the working directory over together with messages and model preferences.
Corporate proxies / TLS inspection: connection resets (WinError 64)
On corporate networks with TLS-inspecting (MITM) proxies, long single-shot LLM requests (30–120 s with no visible traffic) can be killed as "idle" — you see ConnectionResetError / WinError 64 in the logs or a generic connection error in the chat. Chibi automatically retries such failures 4 times with growing waits (~30 s → 180 s) on every provider family and, if all retries fail, reports a clear "connection was interrupted" message instead of a generic error. If the problem persists, set HTTPS_PROXY to your corporate proxy (if it whitelists the AI API hosts) or ask IT to whitelist the provider hosts (api.openai.com, api.anthropic.com, *.googleapis.com, api.mistral.ai).
A note on Gemini specifically: the google-genai SDK silently switches its async transport to aiohttp whenever aiohttp happens to be importable in the environment. In a Chibi install that is always the case — aiohttp arrives as a hard dependency via two independent chains (dashscope, and chromadb → kubernetes), so the issue is not dashscope-only. The bare aiohttp session has no MITM-aware proxy/transport handling, and its keep-alive connections get killed by TLS-inspecting proxies with raw aiohttp.client_exceptions.ServerDisconnectedError tracebacks. Chibi now forces all Gemini async traffic onto its MITM-aware httpx client (client-level HttpOptions(httpx_async_client=...) on every google.genai.Client construction), so Gemini connections go through the same proxy-aware, retrying transport as the other providers.
Documentation
- Start here: https://chibi.bot
- Introduction & philosophy: https://chibi.bot/introduction
- Installation: https://chibi.bot/installation
- Configuration: https://chibi.bot/configuration
- Agent mode: https://chibi.bot/agent-mode
- MCP guide: https://chibi.bot/guides/mcp
- Support / troubleshooting: https://chibi.bot/support
System requirements
- Minimum: Raspberry Pi 4 / AWS EC2 t4g.nano (2 vCPU, 512MB RAM)
- Architectures:
linux/amd64,linux/arm64 - Dependencies: Docker (and optionally Docker Compose)
Contributing
- Issues: https://github.com/s-nagaev/chibi/issues
- PRs: https://github.com/s-nagaev/chibi/pulls
- Discussions: https://github.com/s-nagaev/chibi/discussions
Please read CONTRIBUTING.md before submitting.
License
MIT - see LICENSE.
Ready to meet your digital companion?
Get Started →
Metadata
Release files for chibi-bot 1.16.1.dev202609230728
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| chibi_bot-1.16.1.dev202609230728.tar.gz | 217.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| chibi_bot-1.16.1.dev202609230728-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 482.5 kB
Release files / chibi_bot-1.16.1.dev202609230728.tar.gz
| Download URL | chibi_bot-1.16.1.dev202609230728.tar.gz |
|---|---|
| Size | 217.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
4674aa8e20152ac8ae15a390a2142db65c92c237dde13abd112918b428b4a45c
|
|
BLAKE2b-256 checksum How to use checksums |
dd9ebaddd086ccb324ebb4aa37acf4455be47a007751774e00abb3c1bed3927e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.5.1 CPython/3.11.16 Linux/6.17.0-1022-azure
|
Release files / chibi_bot-1.16.1.dev202609230728-py3-none-any.whl
| Download URL | chibi_bot-1.16.1.dev202609230728-py3-none-any.whl |
|---|---|
| Size | 265.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
b6f92e329d0a67d4a7ec5cabaa39286122e1614b0a65d41516be4716cb675fe8
|
|
BLAKE2b-256 checksum How to use checksums |
c48b6444346bd44da6b841e3d46e203caa8a0f0c3d81aa8a7f1312f479e6ab3f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/2.5.1 CPython/3.11.16 Linux/6.17.0-1022-azure
|