Set Up AstrBot and Connect It to Telegram
Install AstrBot from source, with Docker or with the desktop app, add a model provider, create a Telegram bot, and set history limits, admin ID and group behaviour sensibly.
Verification
- Test environment
- Unknown
- Tested on
- Unknown
- Last updated
- 2026-11-22
AstrBot connects AI models to messaging platforms and supports one of the widest ranges of them. This guide covers installation and a basic Telegram setup. Windows users can skip to the desktop app section.
Suggested server: 2 CPU cores and 4 GB of RAM, outside mainland China if you use overseas platforms such as Telegram. Real needs depend on your plugins and traffic. A remote server makes sense if you want the bot online 24/7 for several platforms.
Option A: Linux from source
The author used Debian 12; the commands are the same on Ubuntu. The official source guide requires Python 3.12 or later.
sudo apt install git
git clone https://github.com/AstrBotDevs/AstrBot.git
cd AstrBot
Install the uv package manager by following its official instructions, then install dependencies and start AstrBot from the project folder:
uv sync
uv run main.py
The admin panel listens on port 6185: open http://localhost:6185, or your server's IP address instead of localhost. Current versions print a random initial password in the startup log (the username is usually astrbot); the old astrbot/astrbot default only applied to early releases. Change the password right after you log in, and don't leave the panel open to the whole internet without protection.
Option B: Docker
Install Docker by following the official instructions, then use the Compose file that ships with the repository:
git clone https://github.com/AstrBotDevs/AstrBot
cd AstrBot
sudo docker compose up -d
See the Docker guide for alternatives such as docker run or deploying alongside NapCat.
Option C: Windows desktop app
Download the current installer from the AstrBot Desktop releases page. The original post linked version 4.23.0 beta 1, which is now out of date.
Add a model provider
Go to Model Providers → Chat → Add. You need an API provider of your own. Fill in an ID (usually the provider's name) and the API key, click Fetch model list, enable the model you want and test the connection. The original post suggested NVIDIA's free developer API (weaker results) or SiliconFlow, which gave sign-up credit after identity verification. Offers like these change, so check the provider's input and output prices before you start.
Create a Telegram bot
The author recommends Telegram, since other platforms may need extra components (QQ needs NapCat, for example).
- In the sidebar, open Bots and click Create bot in the top-right corner. Choose Telegram.
- Message @BotFather, send
/newbot, then enter a display name and a username. When it replies "Done!", copy the long HTTP API token into AstrBot. Keep the token private. - Leave the remaining fields at their defaults. At the bottom, create a new configuration profile, name it and save.
Configure the bot
Under Configuration → General, select your profile:
- Default chat model: the provider you just added.
- Persona: this is the system prompt. It's worth creating one so the bot has a personality; see How to write AI character cards.
- Streaming output: Telegram supports it. Showing reasoning is optional.
- Context management: more remembered history means more tokens per message. With pay-as-you-go billing, keep it to 100 turns or fewer.
- Content safety mode: you can turn it off for personal use; turn it on if many people will use the bot, because providers, especially those in mainland China, may suspend accounts that break their rules.
In the platform settings, set the admin ID to your own Telegram user ID (a bot such as @userinfobot can tell you yours). That gives you admin commands inside Telegram. Turn off keyword detection.
In groups, you can enable context awareness and proactive replies so the bot joins the conversation on its own. It's fun, but it uses a lot of tokens, so test it in a private chat first.
Adapted from the XMLans blog: AstrBot Setup Guide: Linux, Windows, and Telegram (Chinese original: Astrbot小白部署教程).
Sources
- Astrbot小白部署教程(星梦博客)www
.xmlans .com (opens in a new tab) · checked 2026-11-22 - AstrBot Setup Guide: Linux, Windows, and Telegram (XMLans blog)en
.xmlans .com (opens in a new tab) · checked 2026-11-22 - AstrBotDevs/AstrBot (GitHub)github
.com (opens in a new tab) · checked 2026-11-22 - AstrBot docs: deploy from sourcedocs
.astrbot .app (opens in a new tab) · checked 2026-11-22 - AstrBot docs: deploy with Dockerdocs
.astrbot .app (opens in a new tab) · checked 2026-11-22 - AstrBot docs: Telegramdocs
.astrbot .app (opens in a new tab) · checked 2026-11-22