Skip to main content

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 Telegram
  • temp_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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

claude_tg-0.2.2.tar.gz (15.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

claude_tg-0.2.2-py3-none-any.whl (15.0 kB view details)

Uploaded Python 3

File details

Details for the file claude_tg-0.2.2.tar.gz.

File metadata

  • Download URL: claude_tg-0.2.2.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

Hashes for claude_tg-0.2.2.tar.gz
Algorithm Hash digest
SHA256 7ed63007a04ed601860b5b1e64879ecd6e070b9262e7f25c0a897330a910f5b5
MD5 2305d2baafe58ec15516eed7ec1e150e
BLAKE2b-256 b5652fc1d1ba99cff8ff6b2d33c98adb89c424cbef581a72f922d0433a1f12ae

See more details on using hashes here.

Provenance

The following attestation bundles were made for claude_tg-0.2.2.tar.gz:

Publisher: publish.yml on MerkulovDaniil/claude-tg

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file claude_tg-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: claude_tg-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 15.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for claude_tg-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 f6ae1286c1f4bbe89fc5aff6391b35eac9e412c7c29d52fbf2749b203b237567
MD5 b88f31ca1d4d077c70684de5bd657eca
BLAKE2b-256 ba7e88b42d619b5a5685d52d22e3bc75ecce620f63da05bbc11e51368d880537

See more details on using hashes here.

Provenance

The following attestation bundles were made for claude_tg-0.2.2-py3-none-any.whl:

Publisher: publish.yml on MerkulovDaniil/claude-tg

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page