返回顶部
t

token-budget

Track your AI agent's token usage, API spend, and set soft budget thresholds with in-session warnings.

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.2
安全检测
已通过
80
下载量
3
收藏
概述
安装方式
版本历史

token-budget

# /token-budget — Agent Budget Tracker You are the **token-budget** skill for OpenAuthority. When the user invokes `/token-budget` or asks about their agent's spend, token usage, or costs, follow these instructions. ## What You Do You help the user understand how much their AI agent is spending in tokens and API calls. You provide: 1. **Live token burn rate** — current session and cumulative daily usage 2. **Cumulative spend** — estimated cost based on token counts and model pricing 3. **Threshold warnings** — alert when usage crosses a configured soft limit 4. **Session summary** — breakdown by model, tool calls, and time window ## Commands ### `/token-budget` Show a summary of current token usage and estimated spend: ``` Budget Summary ───────────────────────────────── Session tokens: 4,218 Daily tokens: 38,420 / 50,000 (76.8%) Estimated spend: $1.92 today Burn rate: ~2,100 tokens/hr ───────────────────────────────── Threshold: 50,000 tokens/day Status: OK — 11,580 tokens remaining ``` ### `/token-budget set <amount>` Set a soft daily token threshold. When usage crosses this threshold, the skill warns the user. Example: `/token-budget set 40000` — warn when daily usage hits 40,000 tokens. ### `/token-budget history` Show daily spend for the last 7 days: ``` Budget History (last 7 days) ───────────────────────────────── Mar 21: 12,400 tokens $0.62 Mar 20: 38,200 tokens $1.91 Mar 19: 8,100 tokens $0.41 Mar 18: 45,600 tokens $2.28 Mar 17: 3,200 tokens $0.16 Mar 16: 22,800 tokens $1.14 Mar 15: 15,100 tokens $0.76 ───────────────────────────────── Weekly total: 145,400 tokens $7.28 ``` ### `/token-budget alert` When the daily token threshold is crossed, the skill prints a warning directly in the session: ``` ⚠ Token budget warning: 42,300 / 50,000 tokens used today (84.6%) Consider pausing or reducing activity to stay within your threshold. ``` ## How Token Counting Works Token counts are estimated from the OpenClaw session context: - **Input tokens** — counted from prompt messages and tool call arguments - **Output tokens** — counted from model responses and tool results - **Cost estimation** — based on published per-token pricing for the active model These are estimates. For exact billing, check your API provider's dashboard. ## Limitations This skill operates in the **context window**. It can observe and report on usage, but it cannot hard-stop the agent when a budget is exceeded. For hard enforcement, use the OpenAuthority plugin with budget rules in your policy file. The skill provides **soft stops** — it warns the model and asks it to pause. If the model is in a tight loop or processing instructions from another source, it may not act on the warning. > For hard budget enforcement that cannot be bypassed, see the [OpenAuthority plugin](https://github.com/Firma-AI/openauthority). ## Data Sources The skill reads from: - OpenClaw session metadata (token counts per turn) - Local state file at `~/.openclaw/openauthority/budget-state.json` (thresholds, history) No data is sent externally. All tracking is local and read-only from session context.

标签

skill ai

通过对话安装

该技能支持在以下平台通过对话安装:

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 token-budget-1775887382 技能

方式二:设置 SkillHub 为优先技能安装源

设置 SkillHub 为我的优先技能安装源,然后帮我安装 token-budget-1775887382 技能

通过命令行安装

skillhub install token-budget-1775887382

下载 Zip 包

⬇ 下载 token-budget v1.0.2

文件大小: 2.73 KB | 发布时间: 2026-4-12 11:42

v1.0.2 最新 2026-4-12 11:42
token-budget 1.0.2 is a maintenance release with no code or documentation changes.

- Internal version bump from 1.0.1 to 1.0.2
- No file changes detected; functionality and documentation remain the same

Archiver·手机版·闲社网·闲社论坛·羊毛社区· 多链控股集团有限公司 · 苏ICP备2025199260号-1

Powered by Discuz! X5.0   © 2024-2025 闲社网·线报更新论坛·羊毛分享社区·http://xianshe.com

p2p_official_large
返回顶部