Claude Code <-> Telegram bridge
Project description
claude-tg
Claude Code CLI <-> Telegram bridge. Full terminal experience through Telegram with token-level streaming.
Install
pip install claude-tg
# With voice message support:
pip install claude-tg[voice]
Quick Start
export TELEGRAM_BOT_TOKEN="your_bot_token" # from @BotFather
export TELEGRAM_CHAT_ID="your_chat_id" # your Telegram user ID
export CLAUDE_WORK_DIR="/path/to/project" # optional, defaults to cwd
claude-tg
On first run, the MCP server for file sending is auto-registered in Claude Code.
Commands
| Command | Description |
|---|---|
/clear |
Reset session (new context) |
/compact |
Compact conversation context |
/cancel |
Stop current task |
/cost |
Show session cost |
/model <name> |
Switch model (no args = show current) |
Inline Cancel button is shown on every message during processing.
Media
- Photos — send a photo to the bot, it gets passed to Claude as a file reference
- Documents — same for files (PDF, code, etc.)
- Voice — transcribed via Groq Whisper API and sent as text to Claude (requires
GROQ_API_KEY)
Claude sees the file path and can read/analyze it with its built-in tools.
File Sending (MCP)
Claude can send files back to you via the built-in MCP server:
send_telegram_file(file_path, caption?, temp_file?)— sends a file to your Telegramtemp_file=True(default) — file is deleted after sending (for generated/temporary files)temp_file=False— file is preserved (for existing project files)
The MCP server (claude-tg-mcp) is auto-registered on first launch. No manual configuration needed.
Configuration
| Env var | Default | Description |
|---|---|---|
TELEGRAM_BOT_TOKEN |
required | Bot token from @BotFather |
TELEGRAM_CHAT_ID |
required | Your Telegram user ID |
CLAUDE_WORK_DIR |
cwd |
Working directory for Claude |
CLAUDE_TG_VERBOSE |
0 |
Show tool results (1 to enable) |
CLAUDE_TG_MODEL |
— | Override Claude model |
CLAUDE_TG_MAX_BUDGET |
— | Max budget in USD |
CLAUDE_TG_SESSION_TIMEOUT |
3600 |
Auto-reset after N seconds of inactivity |
CLAUDE_TG_UPDATE_INTERVAL |
2.0 |
Telegram message update interval (seconds) |
GROQ_API_KEY |
— | Groq API key for voice transcription |
CLI Flags
claude-tg --work-dir /path/to/project --verbose
Features
- Token-level streaming with adaptive rate limiting
- Automatic message chaining for long outputs (splits at ~3800 chars)
- Photo and file uploads passed to Claude as file references
- MCP server for sending files back to the user
- Inline cancel button on every message
- Message queuing — send messages while Claude is working, they process after
- Session auto-reset after inactivity
- Compact tool call display with emoji icons
- Voice message transcription via Groq Whisper API
- Auto-registration of MCP server in Claude Code
Requirements
- Python 3.11+
- Claude Code CLI installed and authenticated
- Telegram bot token from @BotFather
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 claude_tg-0.2.1.tar.gz.
File metadata
- Download URL: claude_tg-0.2.1.tar.gz
- Upload date:
- Size: 15.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d047584cb92f39c950213727870c0ceaad571a1d634cc424c48b44d4629f3c28
|
|
| MD5 |
9c2131feb39c0e455ccb8fac125559a6
|
|
| BLAKE2b-256 |
b9fb4c07b025d16bd44cea2f91f14ea7946b0e535baeb2ab4662d9ed2a8dda5d
|
Provenance
The following attestation bundles were made for claude_tg-0.2.1.tar.gz:
Publisher:
publish.yml on MerkulovDaniil/claude-tg
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
claude_tg-0.2.1.tar.gz -
Subject digest:
d047584cb92f39c950213727870c0ceaad571a1d634cc424c48b44d4629f3c28 - Sigstore transparency entry: 927213128
- Sigstore integration time:
-
Permalink:
MerkulovDaniil/claude-tg@b253e2007228013b6aad055ea548e03bd881f418 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/MerkulovDaniil
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b253e2007228013b6aad055ea548e03bd881f418 -
Trigger Event:
push
-
Statement type:
File details
Details for the file claude_tg-0.2.1-py3-none-any.whl.
File metadata
- Download URL: claude_tg-0.2.1-py3-none-any.whl
- Upload date:
- Size: 14.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5cccc3a912c87ca684e1e66c430a80c49467c03869a82640a8b8879c006c3b08
|
|
| MD5 |
160924e894db663e2cefd2b9837f0f2a
|
|
| BLAKE2b-256 |
4255bd6cb439a0c82efb983305fc741873d1a367a2a0fb3fa49fe8a2307607bc
|
Provenance
The following attestation bundles were made for claude_tg-0.2.1-py3-none-any.whl:
Publisher:
publish.yml on MerkulovDaniil/claude-tg
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
claude_tg-0.2.1-py3-none-any.whl -
Subject digest:
5cccc3a912c87ca684e1e66c430a80c49467c03869a82640a8b8879c006c3b08 - Sigstore transparency entry: 927213139
- Sigstore integration time:
-
Permalink:
MerkulovDaniil/claude-tg@b253e2007228013b6aad055ea548e03bd881f418 -
Branch / Tag:
refs/tags/v0.2.1 - Owner: https://github.com/MerkulovDaniil
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@b253e2007228013b6aad055ea548e03bd881f418 -
Trigger Event:
push
-
Statement type: