Telegram bot with AI: product recipe
For a Telegram bot that chats with a model, remembers users, and runs around the clock. Every service below is from AgentGid's catalog, with the price and free tier from its official page; the first pick in each part ranks best on free tier, official MCP server, real use and price.
agent.md Copied.
What it costs
How it fits together
- Create the bot with @BotFather and keep its token on the server.
- Receive updates by webhook (serverless hosting works) or long polling (needs an always-on worker).
- Key memory and history by the Telegram user id; send recent context to the model through the gateway.
- Rate-limit per user and cap spending at the gateway.
Telegram Bot API
| Telegram Bot API first pick | HTTP API for building Telegram bots that send and receive messages in chats and groups.
Free: Bots are able to message their users at no cost (about 30 messages per second broadcast limit) · Paid broadcasts: 0.1 Stars per message over the free 30 per second (up to 1000 messages per second)
agent.md |
|---|
LLM gateway (one key, many models)
| OpenRouter first pick MCP |
One OpenAI-compatible API for 500+ models across 80+ providers with routing and fallbacks.
Free: 25+ free models, 50 requests/day · Provider list price per token (no markup); fee on credit purchases: 5.5% Standard, 8% Business · in 29 public agent repos
npm install @openrouter/sdk pip install openrouter agent.md |
|---|---|
| LiteLLM | Open-source proxy and SDK that calls 100+ LLMs in OpenAI format with keys, budgets and logging.
Free: Open-source gateway free to self-host · in 657 public agent repos
pip install litellm agent.md |
Also fits: Vercel AI Gateway, Cloudflare AI Gateway, Portkey, Helicone · all llm gateways and routers
Memory for the bot
| Supermemory first pick MCP |
Memory and retrieval API that builds per-user memory graphs from text, files and connectors.
Free: $5 of credits/month · paid from $19/mo · Memory $5 per 1M SM tokens (plain text), $10 (rich); SuperRAG $1-$2 per 1M tokens; search $5 per 1M queries · in 21 public agent repos
npm install supermemory pip install supermemory agent.md |
|---|---|
| Mem0 MCP |
Memory layer that extracts, stores and retrieves user and agent memories for LLM apps.
Free: Hobby: 10,000 add requests and 1,000 retrieval requests/month · paid from $19/mo · Starter $19/month: 50,000 adds + 5,000 retrievals; Pro $249/month: 500,000 adds + 50,000 retrievals · in 359 public agent repos
npm install mem0ai pip install mem0ai agent.md |
Also fits: Letta, Zep · all memory for agents
Database
| Neon first pick MCP |
Managed Postgres database with autoscaling compute, storage, and backend services.
Free: 1 GB storage, 100 CU-hours compute/month per project, 100 projects, 5 GB Object Storage, 1M function invocations · $0.106 per CU-hr (Launch), $0.222 per CU-hr (Scale); $0.35 per GB-month storage; $0.023 per GB-month Object S… · in 306 public agent repos
npm install @neondatabase/serverless agent.md |
|---|---|
| Upstash Redis | Managed Redis database with global replication and vector search capabilities.
Free: 250 MB data, 500K commands/month · paid from $10/mo · $0.20 per 100K commands, $0.25 per GB storage (after 1GB free), $0.03 per GB bandwidth (after 200GB free) · in 218 public agent repos
npm install @upstash/redis agent.md |
Also fits: Redis, Convex, Firebase, Appwrite · all databases and backends
Hosting (webhook or always-on worker)
| Vercel first pick MCP |
Hosting for web apps and Next.js with a CDN and serverless functions.
Free: Hobby: $0/month · paid from $20/mo · in 102 public agent repos
npm install vercel agent.md |
|---|---|
| Azure Functions MCP server page |
Run event-driven serverless functions on Azure, billed per execution and GB-second.
Free: Flex Consumption: 250,000 executions and 100,000 GB-s per month (Consumption plan: 1 million executions and 400,000 GB-s) · Flex Consumption on-demand (East US): $0.000026 per GB-s, $0.40 per million executions; Consumption plan: $0.… · in 38 public agent repos
npm install @azure/functions pip install azure-functions agent.md |
Also fits: DigitalOcean App Platform, Netlify, Heroku, Cloudflare Workers · all hosting and deployment
Traces and evals
| LangSmith first pick MCP |
Tracing, evaluation and monitoring of LLM apps and agents, including prompt and dataset management.
Free: Developer plan: 1 seat, up to 5k base traces / mo, then pay-as-you-go · paid from $39/mo · Plus: $39 / seat per month incl. up to 10k base traces / mo; trace overage is pay-as-you-go (rate not listed … · in 678 public agent repos
npm install langsmith pip install langsmith agent.md |
|---|
Also fits: LangWatch, W&B Weave, Ragas, Pydantic Logfire · all llm observability and evals
Model
| Default: fast and cheap | Claude Haiku 5.5 · $0.1 input / $0.5 output per 1M tokens · or GPT-6 Luna, MiMo V2.6 Flash |
|---|---|
| Harder questions | Gemini 3.8 Flash · $0.75 input / $3.75 output per 1M tokens · or Kimi K2.7 Code, DeepSeek V4 Pro |
| Hardest work | Kimi K3 · $3 input / $15 output per 1M tokens · or Claude Opus 5.5, Claude Fable 5.1 |
The cheapest model of each price tier that can call tools, from model prices. Try the default first and move up only for the questions it gets wrong.
Libraries
| aiogram | Asynchronous framework for building Telegram bots with modern async/await patterns.pip install aiogram · MIT · Gid Score 50 |
|---|---|
| python-telegram-bot | Python wrapper library for building Telegram bots with the Telegram Bot API.pip install python-telegram-bot · LGPL-3.0-only · Gid Score 64 |
| grammY | Telegram Bot Framework for building bots with JavaScript/TypeScript.npm install grammy · MIT · Gid Score 51 |
| Telegraf | Modern Telegram Bot Framework for building bots with intuitive APIs.npm install telegraf · MIT · Gid Score 40 |
Coding agent to build it
Also on AgentGid
Before you ship
- Keep API keys on the server, never in the browser or app; set spending limits where the provider offers them.
- Read each service's terms for your use: data retention, commercial use, rate limits.
- Log model calls (traces) and test with your own real inputs before launch.
The brief
# Product recipe: Telegram bot with AI (AgentGid) For a Telegram bot that chats with a model, remembers users, and runs around the clock. Parts were picked from AgentGid's catalog by rules: free tier, official MCP server, use in public projects built with AI agents, downloads, price. Prices are list prices from the official pages (see each card for the check date); confirm before you commit. ## What it costs - Start: $0 a month on the free tiers of the first picks (their limits apply). - If you outgrow the free tiers, the lowest paid plans of the first picks are Supermemory $19, Vercel $20, LangSmith $39 (together about $78/month); usage beyond a plan's credits is billed on top. - Billed by usage (grows with traffic): Telegram Bot API, OpenRouter, Neon. - Model, default: fast and cheap: about $0.35 per 1,000 messages with Claude Haiku 5.5 (AgentGid estimate at ~2,000 input + 300 output tokens each). - Model, harder questions: about $2.62 per 1,000 messages with Gemini 3.8 Flash (AgentGid estimate at ~2,000 input + 300 output tokens each). - Prices of the picks below were checked on the official pages between 2026-10-09 and 2026-10-22. ## How it fits together 1. Create the bot with @BotFather and keep its token on the server. 2. Receive updates by webhook (serverless hosting works) or long polling (needs an always-on worker). 3. Key memory and history by the Telegram user id; send recent context to the model through the gateway. 4. Rate-limit per user and cap spending at the gateway. ## Telegram Bot API - Telegram Bot API: free: Bots are able to message their users at no cost (about 30 messages per second broadcast limit) · usage: Paid broadcasts: 0.1 Stars per message over the free 30 per second (up to 1000 messages per second) · card https://agentgid.com/apis/telegram-bot-api/agent.md ## LLM gateway (one key, many models) - OpenRouter: free: 25+ free models, 50 requests/day · usage: Provider list price per token (no markup); fee on credit purchases: 5.5% Standard, 8% Business · official MCP https://mcp.openrouter.ai/mcp · npm @openrouter/sdk · pip openrouter · card https://agentgid.com/apis/openrouter/agent.md - LiteLLM: free: Open-source gateway free to self-host · pip litellm · card https://agentgid.com/apis/litellm/agent.md - Also fits: Vercel AI Gateway, Cloudflare AI Gateway, Portkey, Helicone (https://agentgid.com/apis/llm-gateway/) ## Memory for the bot - Supermemory: free: $5 of credits/month · paid from $19/mo · usage: Memory $5 per 1M SM tokens (plain text), $10 (rich); SuperRAG $1-$2 per 1M tokens; search $5 per 1M queries · official MCP https://mcp.supermemory.ai/mcp · npm supermemory · pip supermemory · card https://agentgid.com/apis/supermemory/agent.md - Mem0: free: Hobby: 10,000 add requests and 1,000 retrieval requests/month · paid from $19/mo · usage: Starter $19/month: 50,000 adds + 5,000 retrievals; Pro $249/month: 500,000 adds + 50,000 retrievals · official MCP https://mcp.mem0.ai/mcp · npm mem0ai · pip mem0ai · card https://agentgid.com/apis/mem0/agent.md - Also fits: Letta, Zep (https://agentgid.com/apis/memory/) ## Database - Neon: free: 1 GB storage, 100 CU-hours compute/month per project, 100 projects, 5 GB Object Storage, 1M function invocations · usage: $0.106 per CU-hr (Launch), $0.222 per CU-hr (Scale); $0.35 per GB-month storage; $0.023 per GB-month Object Storage; $0.60 per 1M invocations · official MCP · npm @neondatabase/serverless · card https://agentgid.com/apis/neon/agent.md - Upstash Redis: free: 250 MB data, 500K commands/month · paid from $10/mo · usage: $0.20 per 100K commands, $0.25 per GB storage (after 1GB free), $0.03 per GB bandwidth (after 200GB free) · npm @upstash/redis · card https://agentgid.com/apis/upstash/agent.md - Also fits: Redis, Convex, Firebase, Appwrite (https://agentgid.com/apis/backend-db/) ## Hosting (webhook or always-on worker) - Vercel: free: Hobby: $0/month · paid from $20/mo · official MCP https://mcp.vercel.com · npm vercel · card https://agentgid.com/apis/vercel/agent.md - Azure Functions: free: Flex Consumption: 250,000 executions and 100,000 GB-s per month (Consumption plan: 1 million executions and 400,000 GB-s) · usage: Flex Consumption on-demand (East US): $0.000026 per GB-s, $0.40 per million executions; Consumption plan: $0.000016 per GB-s, $0.20 per million executions · official MCP @azure/mcp · npm @azure/functions · pip azure-functions · card https://agentgid.com/apis/azure-functions/agent.md · MCP server card https://agentgid.com/mcp/servers/com-microsoft-azure/agent.md - Also fits: DigitalOcean App Platform, Netlify, Heroku, Cloudflare Workers (https://agentgid.com/apis/hosting/) ## Traces and evals - LangSmith: free: Developer plan: 1 seat, up to 5k base traces / mo, then pay-as-you-go · paid from $39/mo · usage: Plus: $39 / seat per month incl. up to 10k base traces / mo; trace overage is pay-as-you-go (rate not listed on pricing page); 1 LSU = $1 (Deployment/Fleet/Sandbox usage) · official MCP https://docs.langchain.com/langsmith/langsmith-mcp-server · npm langsmith · pip langsmith · card https://agentgid.com/apis/langsmith/agent.md - Also fits: LangWatch, W&B Weave, Ragas, Pydantic Logfire (https://agentgid.com/apis/observability/) ## Model (all of these can call tools; prices per 1M tokens) - Default: fast and cheap: Claude Haiku 5.5 ($0.1 in / $0.5 out) · https://agentgid.com/models/claude-haiku-5-5/agent.md · or GPT-6 Luna, MiMo V2.6 Flash - Harder questions: Gemini 3.8 Flash ($0.75 in / $3.75 out) · https://agentgid.com/models/gemini-3-8-flash/agent.md · or Kimi K2.7 Code, DeepSeek V4 Pro - Hardest work: Kimi K3 ($3 in / $15 out) · https://agentgid.com/models/kimi-k3/agent.md · or Claude Opus 5.5, Claude Fable 5.1 ## Libraries - `pip install aiogram`: aiogram (MIT) · https://agentgid.com/tools/aiogram/agent.md - `pip install python-telegram-bot`: python-telegram-bot (LGPL-3.0-only) · https://agentgid.com/tools/python-telegram-bot/agent.md - `npm install grammy`: grammY (MIT) · https://agentgid.com/tools/grammy/agent.md - `npm install telegraf`: Telegraf (MIT) · https://agentgid.com/tools/telegraf/agent.md ## Coding agent to build it - OpenAI Codex: free tier, from $8/mo · https://agentgid.com/agents/openai-codex/agent.md - Claude Code: from $20/mo · https://agentgid.com/agents/claude-code/agent.md - OpenCode: free tier, from $10/mo · https://agentgid.com/agents/opencode/agent.md ## Also on AgentGid - Telegram news bot kit: https://agentgid.com/build/kits/news-bot/ ## Before you ship - Keep API keys on the server, never in the client; set spending limits where the provider offers them. - Read each service's terms for your use (data retention, commercial use, rate limits). - Log model calls (traces) and test with your own real inputs before launch. Recipe page: https://agentgid.com/build/recipes/telegram-ai-bot/ · all product recipes: https://agentgid.com/build/recipes/agent.md
Other recipes
AI assistant over your documents (RAG) Voice agent (phone or web) AI chatbot for a website or app AI support agent for your customers Web research and scraping agent Data analyst agent Solana trading or alert bot Video from a prompt Design recipes
Picked by rules from AgentGid's catalog, not paid placement. Prices are list prices from the official pages, checked between 2026-10-09 and 2026-10-22; check them before you commit.