Powered by Ollama and python-telegram-bot
- Local Processing: Your data stays on your machine. No cloud API subscriptions required.
- Persistent History: Automatically saves conversation history per user.
- Configurable: Easily swap models, adjust context windows, or change history depth.
- Type Awareness: Displays a "typing..." status while the AI is thinking.
- Install Ollama from ollama.com/download.
- Pull a model using
ollama pull <model_name>.- For example:
ollama pull gemma3
- For example:
- Pip install
pip install -r requirements.txt
- Rename .env.copy to .env
mv .env.copy .env
- Fill in your Telegram bot token in .env
- The .env file has the right bot token. Run
/newbotat: t.me/botfather - The .env file has a model that you have downloaded (check with
ollama ls)
- Run bot.py
python bot.py
You can customize the behavior by editing the .env file:
| Variable | Description | Default |
|---|---|---|
TELEGRAM_BOT_TOKEN |
Your unique Bot API token. | Required |
OLLAMA_MODEL |
The model name (must be downloaded). | gemma3 |
MAX_HISTORY |
Number of messages to remember for context. | 10 |
CONTEXT_WINDOW |
The num_ctx passed to Ollama. |
2048 |
KEEP_ALIVE |
How long to keep the model in memory. | -1 (infinite) |
This project is licensed under the MIT License. See the LICENSE file for more details.