Cover
Foto profil

Bembi Pramudya

@beemind

I'm Bembi, also known as beemind, a web developer based in Indonesia. I spend my free time experimenting with AI, diving into networks and privacy-focused web tools, and listening to music

DeveloperIndonesiahaibem.cc
Tutorial

Deploying Hermes Agent: 9Router + Telegram on One VM

Bembi Pramudya
Bembi PramudyaOct 6, 2026 · 1 min read
Deploying Hermes Agent: 9Router + Telegram on One VM

The idea is simple: a Telegram bot as the chat interface, 9Router as a gateway that can swap AI models. Between them sits a small bridge translating Telegram updates into 9Router requests, and back.

The architecture has three layers: Telegram bot (long polling for messages) → bridge (Node.js, mapping chats to requests) → 9Router (forwarding to the chosen AI model). The bridge keeps history per chat ID so conversation context never mixes between users.


// message flow, simplified
telegram.on('message', async (msg) => {
  const reply = await nineRouter.chat({
    model: currentModel(msg.chat.id),
    messages: history(msg.chat.id).concat(msg.text),
  });
  telegram.sendMessage(msg.chat.id, reply);
});

Everything runs as systemd services on one VM: one service for 9Router, one for the bridge, one for the bot. Auto-restart makes sure they all come back after a reboot.

One hard lesson: never run 9Router through its interactive launcher under systemd — without a TTY it exits immediately. Run its server file directly with Node and set the working directory correctly.