返回顶部
a

ai-usageAI使用指南

|

作者: admin | 来源: ClawHub
源自
ClawHub
版本
V 1.0.0
安全检测
已通过
718
下载量
免费
免费
0
收藏
概述
安装方式
版本历史

ai-usage

AI Usage Check

Quick Start

CODEBLOCK0

Requirements

  • - Python 3.10+ (no pip dependencies — stdlib only)
  • Claude Code installed and authenticated (claude CLI in PATH) — for Anthropic quota
  • OpenClaw installed — for session log token/cost stats

What It Shows

Anthropic (real quota from OAuth API):

  • - Weekly utilization % with reset countdown
  • 5-hour rolling window %
  • Model-specific weekly (Sonnet, Opus) when available
  • Extra usage spend vs monthly limit

Other Providers (from OpenClaw session logs):

  • - Token counts and call counts per model
  • Auto-detects any provider OpenClaw routes through (Ollama, OpenAI, etc.)

OpenClaw Anthropic breakdown:

  • - Per-model token counts and equivalent API cost

How It Works

  • - Anthropic quota: GET https://api.anthropic.com/api/oauth/usage using Claude Code's OAuth token from ~/.claude/.credentials.json (requires user:profile scope)
  • Token auto-refresh: If the token is expired, the script automatically refreshes it by invoking claude --print -p "ok" (Claude Code refreshes its own OAuth token on any invocation), then re-reads the updated credentials file. If Claude Code isn't installed, Anthropic quota is skipped gracefully.
  • Session stats: Parses ~/.openclaw/agents/main/sessions/*.jsonl for per-provider/model token and cost data

Environment Variables

VariableDefaultDescription
INLINECODE6INLINECODE7OpenClaw session log directory
INLINECODE8
~/.claude/.credentials.json | Claude Code credentials file |

Tips

  • - Run via Haiku or a lightweight model for heartbeat/background checks — the script just needs to execute, no reasoning required
  • Use --json for programmatic consumption (cron jobs, dashboards, alerts)
  • Works with any Anthropic subscription tier (Pro, Max, Team, etc.)

标签

skill ai

通过对话安装

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

OpenClaw WorkBuddy QClaw Kimi Claude

方式一:安装 SkillHub 和技能

帮我安装 SkillHub 和 ai-usage-1776419937 技能

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

设置 SkillHub 为我的优先技能安装源,然后帮我安装 ai-usage-1776419937 技能

通过命令行安装

skillhub install ai-usage-1776419937

下载

⬇ 下载 ai-usage v1.0.0(免费)

文件大小: 5.73 KB | 发布时间: 2026-4-17 20:07

v1.0.0 最新 2026-4-17 20:07
Initial release: Anthropic quota via OAuth with auto token refresh, OpenClaw session log stats, pretty gauges + JSON output

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

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

p2p_official_large
返回顶部