CodeForBreakfast

Claude Usage Exporter — AI skill for Claude Code

AI community

Prometheus/OTEL exporter for Claude.ai session and weekly usage metrics, with adaptive polling.

How to install Claude Usage Exporter

This entry records only its repository, not the path inside it, so there is no exact command to give. Open CodeForBreakfast/claude-usage-exporter and copy the folder into ~/.claude/skills/, or the file into ~/.claude/agents/.

What Claude Usage Exporter does

Prometheus/OTEL exporter for Claude.ai session and weekly usage metrics, with adaptive polling.

Alternatives in AI

  • Ccstatusline — by sirmalloc - A highly customizable status line formatter for Claude Code CLI that displays model info, git b 5.5k ★
  • Claude Chat Exporter — Claude Chat Exporter is a JavaScript tool that allows you to export your conversations with Claude AI into a w 407 ★
  • Codebase Digest — 🗜️ Codebase-digest is your AI-friendly codebase packer and analyzer 375 ★

README

claude-usage-exporter

Prometheus and OpenTelemetry exporter for Claude.ai session and weekly usage metrics. Polls the Claude.ai usage API for each configured account and exposes utilization percentages and reset timestamps as metrics.

image

Inspired by [claude-multi-account-usage](https://github.com/erkantaylan/claude-multi-account-usage).

How it works

The exporter reads account credentials from `accounts.yaml`, then polls the Claude.ai usage API for each account on independent goroutines. Results are exposed as OpenTelemetry metrics via a Prometheus `/metrics` endpoint (and optionally pushed over OTLP).

Adaptive polling

Poll frequency adjusts automatically based on activity:

State Behaviour
Active Polls every activeInterval (default 30 s) whenever usage values change between polls
Idle back-off After idleThreshold (default 3) consecutive unchanged polls, the interval doubles on each poll up to idleInterval (default 5 m)
Reset burst When a usage window reset is less than resetBurstWindow (default 2 m) away, the interval snaps back to activeInterval regardless of idle state

Any change in the session or weekly utilization value immediately resets the interval to `activeInterval`.

Metrics

All metrics carry an `account` label (the account name from your config) and an `org_id` label (the organization ID). The `org_id` is the join key between these metrics and Claude Code OTEL metrics, which emit `organization.id` as a resource attribute — enabling correlation of which CC host is consuming which account's quota.

Metric Type Unit Description
claude_usage_session_utilization_percent Gauge % 5-hour session window utilization (0–100)
claude_usage_weekly_utilization_percent Gauge % 7-day wee