skills$openclaw/telegram-usage
c-drew331ā˜…

by c-drew

telegram-usage – OpenClaw Skill

telegram-usage is an OpenClaw Skills integration for ai ml workflows. Display session usage statistics (quota, session time, tokens, context)

331 stars4.2k forksSecurity L1
Updated Feb 7, 2026Created Feb 7, 2026ai ml

Skill Snapshot

nametelegram-usage
descriptionDisplay session usage statistics (quota, session time, tokens, context) OpenClaw Skills integration.
ownerc-drew
repositoryc-drew/telegram-usage
languageMarkdown
licenseMIT
topics
securityL1
installopenclaw add @c-drew/telegram-usage
last updatedFeb 7, 2026

Maintainer

c-drew

c-drew

Maintains telegram-usage in the OpenClaw Skills directory.

View GitHub profile
File Explorer
6 files
.
_meta.json
464 B
config-example.json
657 B
handler.js
6.2 KB
README.md
5.5 KB
session-reader.js
9.2 KB
SKILL.md
1.2 KB
SKILL.md

name: telegram-usage description: Display session usage statistics (quota, session time, tokens, context) metadata: {"clawdbot":{"emoji":"šŸ“Š","requires":{"bins":["node"]}}}

Telegram Usage Stats

Display comprehensive session usage statistics by running the handler script.

What it does

Shows a quick status message with:

  • Quota Remaining: Percentage of API quota left with visual indicator
  • Reset Timer: Time remaining until quota resets

How to use this skill

When the user asks for usage statistics, quota info, or session data:

node /home/drew-server/clawd/skills/telegram-usage/handler.js

This will output formatted HTML suitable for Telegram's parseMode.

Output Format

The response is formatted as a clean Telegram message with:

  • Section headers (bold)
  • Clear percentages and time remaining
  • Visual indicators (emoji)
  • All in one message for quick reference

Example Output

šŸ“Š API Usage

šŸ”‹ Quota: 🟢 47%
ā±ļø Resets in: 53m

Notes

  • Pulls real-time data from clawdbot models status
  • Updates on each invocation with current API quota values
  • Uses plain text formatting for Telegram compatibility
README.md

Telegram Usage Command Skill

A custom Telegram command that displays comprehensive session usage statistics in a clean, formatted message.

Features

āœ… Quota Remaining - Shows percentage of API quota left (provider-specific)
āœ… Session Time - Displays time remaining before session resets
āœ… Token Usage - Shows input and output tokens used in session
āœ… Context Window - Displays current context window usage
āœ… Visual Indicators - Color-coded emoji for quick status check
āœ… Single Message - All info in one clean Telegram message

Installation

Option 1: Automatic (via ClawdHub)

clawdhub install telegram-usage

Option 2: Manual (Already in workspace)

The skill is located at /skills/telegram-usage in your Clawdbot workspace.

Setup

1. Enable the Skill

Ensure the skill is enabled in ~/.clawdbot/clawdbot.json:

{
  "skills": {
    "entries": {
      "telegram-usage": {
        "enabled": true
      }
    }
  }
}

2. Add Custom Command to Telegram (Optional)

Register the command in Telegram's bot menu via config:

{
  "channels": {
    "telegram": {
      "customCommands": [
        {
          "command": "usage",
          "description": "Show session usage stats"
        }
      ]
    }
  }
}

3. Restart Gateway

clawdbot gateway restart

Or if running manually:

clawdbot gateway

Usage

In Telegram

Send any of these:

/telegram_usage
/usage          (if custom command registered)
/skill telegram-usage

Output Example

šŸ“Š Session Usage Report

šŸ”‹ Quota Remaining
🟢 82% of API quota available
Provider: anthropic

ā±ļø Session Time
3 hours 40 minutes remaining
(resets daily at 4:00 AM)

šŸŽÆ Tokens Used
4,370 total tokens
ā”œā”€ Input: 2,847
└─ Output: 1,523

šŸ“¦ Context Window
🟢 45% used
1,856 / 4,096 tokens

Model: Claude 3.5 Haiku

Configuration

No additional configuration required. The skill reads from Clawdbot's session state automatically.

Optional: Adjust Reset Time

The default session reset is 4:00 AM. Configure in ~/.clawdbot/clawdbot.json:

{
  "session": {
    "reset": {
      "mode": "daily",
      "atHour": 4
    }
  }
}

Color Indicators

  • 🟢 Green — Good (75%+ remaining)
  • 🟔 Yellow — Warning (50-75% remaining)
  • 🟠 Orange — Low (25-50% remaining)
  • šŸ”“ Red — Critical (<25% remaining)

How It Works

  1. Runs as a skill — Loads via Clawdbot's skill system
  2. Uses session data — Reads from current session store
  3. Formats with HTML — Telegram-safe HTML formatting (bold, code blocks)
  4. Single message — Returns all info in one Telegram message
  5. Real-time — Updates on each invocation with current values

Files Included

  • SKILL.md — Skill metadata and AgentSkills manifest
  • handler.js — Node.js handler for formatting usage data
  • README.md — This file
  • config-example.json — Example configuration

Testing

Manual Test (CLI)

node /home/drew-server/clawd/skills/telegram-usage/handler.js

Expected output: Formatted usage report in HTML

JSON Output

node /home/drew-server/clawd/skills/telegram-usage/handler.js json

Expected output: Raw statistics as JSON

In Telegram

  1. Send /usage in any DM with the bot
  2. Expect a formatted message with current stats
  3. Repeat to see updated values

Troubleshooting

Command not appearing in Telegram

  • Make sure the skill is enabled: clawdbot config get skills.entries.telegram-usage.enabled
  • Restart the gateway: clawdbot gateway restart
  • Check logs: clawdbot logs --follow

Stats show zero/wrong values

  • The skill reads from your current session state
  • Start a new session with /new and try again
  • Verify session file exists: ~/.clawdbot/agents/main/sessions/sessions.json

HTML formatting looks wrong

  • Telegram has limited HTML support
  • The skill uses safe tags: <b>, <i>, <code>
  • If Telegram rejects it, check gateway logs

Technical Details

Quota Source

The quota percentage comes from:

  1. Current provider's usage tracking (if enabled)
  2. Defaults to 85% if no tracking available
  3. Can be customized per provider

Session Time

  • Resets daily at configured time (default 4:00 AM local)
  • Shows time until next reset
  • Can be overridden with /reset or /new commands

Tokens

  • Input tokens: Counted from the assistant's input context
  • Output tokens: Counted from the assistant's responses
  • Total: Sum of input + output for the current session

Context Usage

  • Shows current position in context window
  • Updates as conversation grows
  • Includes messages, files, tools, and system prompts

Limitations

  • DMs only — Groups show session-specific stats but structure is the same
  • Session-based — Stats reset when session resets (daily or on explicit /reset)
  • Approximate — Percentages are rounded to nearest whole number
  • Provider-dependent — Quota details vary by API provider (Anthropic, OpenAI, etc.)

Future Enhancements

Potential improvements:

  • Graph visualization (text-based)
  • Historical tracking across sessions
  • Cost estimation per provider
  • Token burn rate (tokens/minute)
  • Context compression recommendations
  • Quota alerts when low

License

This skill is part of the Clawdbot project.

Support

Permissions & Security

Security level L1: Low-risk skills with minimal permissions. Review inputs and outputs before running in production.

Requirements

  • OpenClaw CLI installed and configured.
  • Language: Markdown
  • License: MIT
  • Topics:

FAQ

How do I install telegram-usage?

Run openclaw add @c-drew/telegram-usage in your terminal. This installs telegram-usage into your OpenClaw Skills catalog.

Does this skill run locally or in the cloud?

OpenClaw Skills execute locally by default. Review the SKILL.md and permissions before running any skill.

Where can I verify the source code?

The source repository is available at https://github.com/openclaw/skills/tree/main/skills/c-drew/telegram-usage. Review commits and README documentation before installing.