Add real-time tokens/sec (t/s) display to the Hermes Agent terminal status bar.
After applying this patch, the Hermes Agent status bar will show the token generation speed of the last API call:
⚕ deepseek-v4-flash │ 12.5K/128K │ ████░ 68% │ 3m 42s │ 15.2 t/s │ 1.2s
The 15.2 t/s appears at the end, only when:
- Terminal width >= 76 characters
- Token speed > 0
| File | Changes |
|---|---|
run_agent.py |
Track API duration + completion tokens, compute t/s |
cli.py |
Display t/s in status bar text and rich fragments |
Give this article to your Hermes agent and let it modify for you:
Prompt:
Read https://github.com/maxxqf-ai/hermes-status-bar-tps and apply the changes to add tokens-per-second display to my Hermes status bar. Back up the original files first, then restart Hermes when done.
Your agent will:
- Clone the repo or read the patch files
- Find
run_agent.pyandcli.pyin your Hermes installation - Apply all 8 changes (4 per file)
- Restart Hermes
cp run_agent.py run_agent.py.bak
cp cli.py cli.py.bakChange 1 — __init__ (around line 1554): Add tracking fields
# Token generation speed tracking
self._last_api_duration = 0.0
self._last_tokens_per_second = 0.0Change 2 — reset_session_state() (around line 1659): Initialize on session reset
self._last_api_duration = 0.0
self._last_tokens_per_second = 0.0Change 3 — API call completion (around line 8896): Save API duration
self._last_api_duration = api_durationChange 4 — After getting completion_tokens (around line 9323): Compute t/s
# Track per-call token generation speed
if self._last_api_duration > 0 and completion_tokens > 0:
self._last_tokens_per_second = completion_tokens / self._last_api_duration
else:
self._last_tokens_per_second = 0.0Change 1 — _get_status_bar_snapshot() (around line 1922): Add snapshot field
"last_tokens_per_second": 0.0,Change 2 — _get_status_bar_snapshot() (around line 1936): Read from agent
snapshot["last_tokens_per_second"] = getattr(agent, "_last_tokens_per_second", 0.0) or 0.0Change 3 — _build_status_bar_text() (around line 2086): Add text display
tps = snapshot.get("last_tokens_per_second", 0.0)
if tps > 0:
parts.append(f"{tps:.1f} t/s")Change 4 — _get_status_bar_fragments() (around line 2149): Add rich text display
# Token generation speed (last call)
tps = snapshot.get("last_tokens_per_second", 0.0)
if tps > 0:
frags.append(("class:status-bar-dim", " │ "))
frags.append(("class:status-bar-dim", f"{tps:.1f} t/s"))# Restart your Hermes Agent
hermes- Send a message to Hermes
- Watch the status bar — you should see
XX.X t/sat the end - If terminal width < 76, the t/s display will be hidden (by design)
t/s not showing:
- Check terminal width >= 76
- Verify Hermes restarted after applying changes
- Make sure you're using a streaming model (t/s calculated from streaming response)
Value is 0:
- Normal on first message after restart
- Some API providers don't return streaming timing data
Tested on:
- Hermes Agent v2026.4.16+
- macOS terminal
- Various API providers (OpenAI-compatible)
Line numbers may vary slightly between versions. The changes are minimal and self-contained.
MIT — do whatever you want with it.
