agent-meter for Openclaw

A local-first API spend tracker that provides intent-level attribution and detailed cost analysis for Claude Code sessions.

oztenbot
v0.6.4
Mar 7, 2026
2
1.1k
0

Install & Download

1. ClawHub CLI

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

npx clawhub@latest install agent-meter

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 agent-meter 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 agent-meter?

agent-meter is a robust utility designed to give developers full visibility into their AI API expenditures. By integrating directly with Claude Code sessions, it captures granular token usage data, including complex cache-tier pricing for Opus, Sonnet, and Haiku models. This skill ensures that every token spent is accounted for, categorized by project and purpose, without requiring external network calls or compromising secrets. It is a vital addition to the ecosystem of Openclaw Skills for developers who need to manage budgets and optimize model selection based on real-world cost data.

agent-meter Use Cases

  • Monitoring project-specific API costs to stay within development budgets.
  • Analyzing model efficiency by comparing real-world costs between Claude Opus, Sonnet, and Haiku.
  • Backfilling historical session data to generate comprehensive spend reports across all active projects.
  • Attributing API spend to specific intents or human-readable tags for team-wide financial reporting.

How agent-meter Works

  1. The skill installs a session-end hook that automatically triggers whenever a Claude Code session finishes.
  2. It parses the local session transcript to extract precise token counts, including cache creation and cache read metrics.
  3. A model-aware pricing logic calculates the exact cost in USD based on the specific model used during the session.
  4. The results are appended to a local JSONL file for deduplicated, long-term storage and local querying.
  5. Users can query this data instantly using the /meter command to see a formatted summary of their usage and cost distribution.

agent-meter Setup

To install agent-meter from ClawHub, run the following command in your terminal:

clawhub install agent-meter --dir .claude/skills

Once installed, initialize the environment by running the /meter command. This will automatically configure the necessary session hooks and backfill your existing session history:

# Invoke within Claude Code
/meter

To sync your data with a hosted dashboard for visual analytics, use the optional sync script:

bash .claude/skills/agent-meter/meter-sync.sh --setup

agent-meter Data Schema & Taxonomy

The skill stores all usage records in a structured JSONL format located at ~/.agent-meter/spend.jsonl. Each record includes the following schema:

Field Description
ts ISO 8601 timestamp of the session start
model The specific model identifier (e.g., haiku, sonnet, opus)
project The directory name where the session occurred
tokens_in / tokens_out Raw input and output token counts
cache_creation / cache_read Detailed caching performance metrics
cost_usd The final estimated cost based on current pricing tiers
source Identifies if data came from a live hook or a backfill scan

agent-meter Advanced Features

  • Automated session-end hooks for zero-config tracking of future developer interactions.
  • Sophisticated cost calculation logic that accurately accounts for Anthropic's multi-tier caching discounts.
  • Powerful JQ-based query examples for custom data slicing by date ranges, model types, or project names.
  • Optional cloud dashboard synchronization for multi-machine spend visualization and management.
  • Local-first design ensures no network calls or secrets access are required for basic spend tracking.

SKILL.md


Loading

Related Openclaw Skills

Featured*