grinev/opencode-telegram-bot

OpenCode mobile client via Telegram: run and monitor AI coding tasks from your phone while everything runs locally on your machine. OpenCode V2 support.

OpenCode Telegram Bot – What It Is

OpenCode Telegram Bot is a Node‑JS application that lets you control the OpenCode AI‑coding assistant (a local CLI tool) from a Telegram chat. It runs on the same machine as the OpenCode server and talks to Telegram’s Bot API, so no ports need to be opened to the internet.

Core capabilities

  • Remote prompting – send a text, voice, or file to the bot and have OpenCode generate code, which is returned as Telegram files.
  • Session handling – create, switch, abort, or detach from OpenCode sessions directly from chat commands.
  • Live tracking – the bot follows a running OpenCode session, showing progress, sub‑agent activity, and model usage in real time.
  • Model & agent switching – pick favourite models or change between Plan and Build agent modes on the fly.
  • File browsing – use /ls to explore the project’s directory tree, download files, or attach them to the next prompt.
  • Scheduled tasks – pre‑define prompts that run later or on a recurring interval.
  • Voice input – optional Whisper‑compatible speech‑to‑text conversion.
  • Security – only the Telegram user ID you specify can interact with the bot.
  • Localization – UI available in 12 languages.
  • Docker support – can be run inside a container while the OpenCode server stays on the host.

How you get it running

  1. Create a Telegram bot with @BotFather and note the token.
  2. Install OpenCode (the AI‑coding CLI) and start its server (opencode serve).
  3. Install the bot via npm (npx @grinev/opencode-telegram-bot@latest or a global install) and run the interactive wizard, which asks for the bot token, your Telegram user ID, OpenCode version (V1 or V2), API URL, and credentials.
  4. Chat with the bot – any plain text message becomes a prompt unless a blocking interaction (e.g., a menu) is active.

Main Telegram commands (selected)

Command What it does
/status Shows bot version, server health, current project, session and model
/new Starts a new OpenCode session
/abort Cancels the current task
/sessions Browse and switch recent sessions
/ls Interactive file browser
/settings Adjust runtime preferences
/task / /tasklist Create and manage scheduled prompts
/opencode_start / /opencode_stop Control the local OpenCode server from Telegram

Configuration

  • Environment variables or an .env file (stored in the OS‑specific app‑data folder) supply the bot token, allowed user ID, proxy settings, OpenCode server URL, version, and optional limits (e.g., TASK_LIMIT).
  • Local JSON command files placed in <appHome>/local-commands/ become custom /command shortcuts that run arbitrary shell commands on the host.

Who it’s for

Developers who already use OpenCode for AI‑assisted coding and want a convenient, secure way to interact with it from their phone while the server runs locally. It is not a standalone AI model; it is a thin client that forwards commands to the existing OpenCode service.


All details above are taken directly from the repository’s README.

Related

  • Project
  • Project
  • Project
  • Project
  • Project