360 Secure SkillHub
360 安全技能中心

Openrouter Usage

通过 openrouter-usage 命令行工具查询 OpenRouter 额度余额,并解析 OpenClaw 本地会话日志,按模型统计费用与 token,生成按日、周、月或自定义区间的花费报告与预测,支持按代理过滤和 JSON 输出。

lcajigasm
lcajigasm
热度 76.74
最近更新 2026-05-11 17:27:29
分类:数据依赖:代码执行 / 读写文件 / 第三方 API应用场景:报告撰写 / 财务 / 数据处理

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add openrouter-usage-info
Metadata
name
openrouter-usage
description
Track OpenRouter API spending — credit balance, per-model cost breakdown, and spending projections from OpenClaw session logs.
metadata
{"openclaw":{"emoji":"💰","requires":{"bins":["openrouter-usage"]}}}

openrouter-usage

Track your OpenRouter spending directly from your OpenClaw agent. Shows credit balance, per-model cost/token breakdown, and spending projections.

Trigger

Use when the user asks about OpenRouter credits, costs, spending, balance, usage, billing, or the /usage command.

Commands

Full report (recommended — combines everything)

openrouter-usage report              # credits + today's usage + projection
openrouter-usage report --week       # credits + last 7 days
openrouter-usage report --month      # credits + last 30 days

Credit balance only

openrouter-usage credits

Per-model breakdown only

openrouter-usage sessions --today
openrouter-usage sessions --week
openrouter-usage sessions --month
openrouter-usage sessions --date 2026-02-25
openrouter-usage sessions --from 2026-02-01 --to 2026-02-15

Filtering and output

openrouter-usage report --agent main          # specific agent only
openrouter-usage report --format json         # JSON output
openrouter-usage sessions --today --utc       # use UTC instead of local timezone

Notes

  • API key auto-discovered from OpenClaw auth store or OPENROUTER_API_KEY env var.
  • Session parsing is fully local — reads ~/.openclaw/agents/*/sessions/*.jsonl.
  • Date filters use local timezone by default. Pass --utc to override.
  • Zero dependencies beyond Python 3 stdlib.