claude-cost-cli
Query Claude API usage and cost reports from the command line. Secure macOS Keychain storage for Admin API key. Table/JSON output.
Why use this skill?
Efficiently monitor your Anthropic Claude API spending and token usage with this secure macOS CLI tool. Features Keychain storage and JSON output for easy reporting.
Install via CLI (Recommended)
clawhub install openclaw/skills/skills/cyberash-dev/claude-cost-cliWhat This Skill Does
claude-cost-cli is a powerful command-line interface designed for monitoring, auditing, and managing Anthropic Admin API usage and expenses. By interacting directly with the Anthropic Admin API, this tool allows developers and system administrators to retrieve detailed breakdowns of token consumption and monetary spend. It prioritizes security by utilizing macOS Keychain for the persistent storage of sensitive Admin API keys, ensuring credentials are never stored in plaintext files. Whether you need to track daily model usage, analyze costs by workspace, or export raw data for automated reporting, this tool provides a robust, scriptable interface.
Installation
This skill requires Node.js (version 18 or higher) and a macOS environment. The package is available via npm and can be installed globally using: npm install -g claude-cost-cli. For transparency, you may audit the source code by cloning the GitHub repository: git clone https://github.com/cyberash-dev/claude-cost-cli.git, then running npm install && npm run build && npm link. After installation, execute claude-cost config set-key to securely save your API credentials to your Keychain.
Use Cases
This skill is perfect for:
- Cloud Cost Optimization: Identifying which projects, workspaces, or specific API keys are driving the highest expenditure.
- Usage Auditing: Performing granular analysis on token usage patterns, such as verifying the ratio of cached tokens versus standard input tokens.
- Automated Reporting: Piping JSON output from the CLI into custom dashboards, spreadsheet automation tools, or logging systems to track monthly spend across multiple enterprise projects.
- Security Hardening: Ensuring that sensitive API keys are not hard-coded in scripts by leveraging native OS credential management.
Example Prompts
- "Check the total cost for all my Claude API usage over the last 30 days and output it as a summary."
- "Show me a detailed usage report grouped by model for the previous month, outputting the result in JSON format for my dashboard."
- "List all costs associated with my primary workspace for the current week to help me stay within my budget."
Tips & Limitations
- Security: Always use the built-in configuration commands to manage your API keys; do not store your
sk-ant-adminkeys in environment variables or configuration files. - Scope: This tool currently requires the Anthropic Admin API and is limited to macOS systems due to its reliance on Keychain services.
- Precision: When performing analysis, utilize the
--bucketflag for time-series granularity or the--group-byflag to drill down into specific cost drivers like workspace IDs.
Metadata
Not sure this is the right skill?
Describe what you want to build — we'll match you to the best skill from 16,000+ options.
Find the right skillPaste this into your clawhub.json to enable this plugin.
{
"plugins": {
"official-cyberash-dev-claude-cost-cli": {
"enabled": true,
"auto_update": true
}
}
}Tags(AI)
Flags: external-api
Related Skills
caldav-cli
Manage CalDAV calendars (iCloud, Google, Yandex) from the command line. Supports OAuth2 and Basic auth, multi-account, table/JSON output.
claude-usage-cli
Query Claude API usage and cost reports from the command line. Secure macOS Keychain storage for Admin API key. Table/JSON output.
grok-image-cli
Generate and edit images via Grok API from the command line. Cross-platform secure credential storage for xAI API key. Supports batch generation, aspect ratios, and style transfer.
tg-cli
Read-only Telegram CLI via MTProto. Lists chats, fetches messages, downloads media, manages local accounts/sessions. Does not send messages or modify Telegram data. Use when the user asks to read Telegram chats, fetch messages, download media, or automate Telegram data extraction.