Claude Usage CLI for Openclaw

A command-line interface for monitoring Anthropic Admin API usage and spend directly from your terminal.

cyberash-dev
v0.2.0
Feb 14, 2026
0
2.3k
0

Install & Download

1. ClawHub CLI

The fastest way to install a skill directly from the registry.

npx clawhub@latest install claude-usage-cli

2. Manual Installation

Copy the skill folder to one of these locations

Global
~/.openclaw/skills/
Workspace
<project>/skills/

Priority: Workspace > Local > Bundled

3. Prompt Installation

Copy this prompt to OpenClaw to install it automatically.

Help me install claude-usage-cli using Clawhub. If Clawhub is not installed, install it first (npm i -g clawhub).

Prefer to download?

Get the raw skill files in a ZIP archive.

What is Claude Usage CLI?

claude-usage-cli is a powerful utility within the Openclaw Skills ecosystem designed for developers and teams who need granular visibility into their Anthropic API expenditures. By interfacing directly with the Anthropic Admin API, it provides real-time data on token consumption and costs, allowing users to stay within budget and optimize their model usage. This tool is built to handle sensitive data responsibly, utilizing secure system-level storage for authentication.

The skill specifically targets macOS environments, leveraging the system Keychain to ensure your sensitive Admin API keys remain secure and encrypted. While this specific tool is now superseded by claude-cost-cli, it remains a robust example of how Openclaw Skills can simplify the management of AI infrastructure costs through automated reporting and secure credential handling.

Claude Usage CLI Use Cases

  • Monitor daily or monthly Anthropic API token usage across different models like Claude 3.5 Sonnet.
  • Generate cost breakdown reports to identify high-spend workspaces or specific API keys.
  • Export usage data to JSON for integration into custom billing dashboards or internal reporting systems.
  • Securely manage Admin API credentials on macOS without relying on plaintext configuration files.

How Claude Usage CLI Works

  1. The user installs the package globally via npm and initializes the configuration with an Anthropic Admin API key.
  2. The API key is securely stored in the macOS Keychain under the claude-usage-cli service identifier.
  3. When a user executes a usage or cost command, the tool retrieves the key and sends an authenticated HTTPS request to the Anthropic Admin API endpoints.
  4. The raw API response is processed to calculate totals, group data by dimensions, and convert token counts into USD amounts.
  5. The tool outputs the processed data to the terminal as an organized ASCII table or a structured JSON object for further processing.

Claude Usage CLI Setup

To get started with this skill, ensure you have Node.js 18+ and macOS. Install the package globally using npm:

npm install -g claude-usage-cli

Once installed, configure your Admin API key (prefixed with sk-ant-admin) using the secure interactive prompt:

claude-usage config set-key

Claude Usage CLI Data Schema & Taxonomy

The skill organizes data into two primary reporting structures as part of the Openclaw Skills data management workflow:

Report Type Key Fields
Usage Date, Model, Input Tokens, Cached Tokens, Output Tokens, Web Searches
Cost Date, Description, Model, Amount (USD), Token Type, Tier

Users can also filter and group data using a variety of metadata dimensions including workspace_id, api_key_id, and service_tier.

Claude Usage CLI Advanced Features

  • Multi-dimensional grouping (e.g., grouping by both workspace and model simultaneously).
  • Granular time-bucketing options including daily (1d), hourly (1h), and minute-by-minute (1m) increments.
  • Support for shorthand period flags like 7d, 30d, and 90d for rapid reporting.
  • Full JSON output mode to facilitate automated scripting and multi-agent interoperability.
  • Secure macOS Keychain integration to prevent API key exposure in shell history or config files.

SKILL.md


Loading

Related Openclaw Skills

METADATA

Github Stars: 0
forks: 0

Featured*