npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@reaatech/llm-cost-telemetry-cli

v0.2.0

Published

CLI for LLM cost telemetry — reporting, budget checking, and export triggering

Readme

@reaatech/llm-cost-telemetry-cli

npm version License: MIT CI

Status: Pre-1.0 — APIs may change in minor versions. Pin to a specific version in production.

CLI tool for LLM cost telemetry operations — generate cost reports, check budget status, and trigger exports to observability platforms. Reads cost spans from JSON files or stdin.

Installation

npm install -g @reaatech/llm-cost-telemetry-cli
# or
pnpm add -g @reaatech/llm-cost-telemetry-cli

Feature Overview

  • Cost reports — aggregate cost spans and output as JSON or human-readable tables
  • Budget checks — verify tenant budget status with configurable thresholds
  • Export triggering — push cost data to CloudWatch, Cloud Monitoring, or Phoenix/Loki
  • Pipe-friendly — reads spans from stdin for shell pipeline integration
  • JSON input — accepts arrays of cost span objects from files or pipes

Commands

report — Generate Cost Reports

llm-cost-telemetry report --tenant acme-corp --period day
llm-cost-telemetry report --feature chat-support --period month --format table
llm-cost-telemetry report --input spans.json --format json

Aggregates cost spans and displays a cost summary grouped by configurable dimensions.

Options:

| Option | Type | Default | Description | |--------|------|---------|-------------| | --tenant | string | — | Filter by tenant | | --feature | string | — | Filter by feature | | --route | string | — | Filter by route | | --period | string | "day" | Time period: hour, day, week, month | | --input | string | — | Path to JSON file containing cost spans | | --format | string | "json" | Output format: json or table |

Example output (table format):

┌──────────────┬──────────┬───────────┬────────────┐
│ Tenant       │ Feature  │ Provider  │ Cost (USD) │
├──────────────┼──────────┼───────────┼────────────┤
│ acme-corp    │ support  │ openai    │ $42.50     │
│ acme-corp    │ support  │ anthropic │ $12.30     │
│ startup-inc  │ onboard  │ openai    │ $8.20      │
├──────────────┼──────────┼───────────┼────────────┤
│ Total        │          │           │ $63.00     │
└──────────────┴──────────┴───────────┴────────────┘

check — Check Budget Status

llm-cost-telemetry check --tenant acme-corp
llm-cost-telemetry check --tenant startup-inc --threshold 0.8

Verifies budget status for a tenant against configured limits.

Options:

| Option | Type | Default | Description | |--------|------|---------|-------------| | --tenant | string | (required) | Tenant to check | | --threshold | number | 0.9 | Alert threshold override (0.0–1.0) |

Example output:

Tenant: acme-corp
  Daily:   $42.50 / $100.00 (42.5%)  OK
  Monthly: $142.30 / $2000.00 (7.1%) OK

export — Trigger Export

llm-cost-telemetry export --exporter cloudwatch --period hour
llm-cost-telemetry export --exporter phoenix --input spans.json
llm-cost-telemetry export --exporter cloudwatch --dry-run

Builds aggregated cost records and pushes them to the specified exporter.

Options:

| Option | Type | Default | Description | |--------|------|---------|-------------| | --exporter | string | (required) | Exporter: cloudwatch, cloud-monitoring, phoenix | | --period | string | "hour" | Time period to export | | --input | string | — | Path to JSON file containing cost spans | | --dry-run | boolean | false | Build records without sending to an exporter |

config — Show Configuration

llm-cost-telemetry config

Displays the effective configuration loaded from environment variables.

version — Show Version

llm-cost-telemetry version

Prints the CLI version number.

Usage Patterns

Pipe Spans from stdin

curl -s https://api.example.com/cost-spans | llm-cost-telemetry report

Scripted Budget Checks

#!/bin/bash
status=$(llm-cost-telemetry check --tenant acme-corp --format json)
percentage=$(echo "$status" | jq -r '.dailyPercentage')

if (( $(echo "$percentage > 80" | bc -l) )); then
  echo "WARNING: acme-corp at ${percentage}% of daily budget"
  exit 1
fi

Export to Multiple Targets

llm-cost-telemetry export --exporter cloudwatch --input spans.json
llm-cost-telemetry export --exporter phoenix --input spans.json

Batch Processing with Dry Run

# Preview what would be exported without actually sending
llm-cost-telemetry export --exporter cloudwatch --dry-run

Environment Variables

The CLI reads configuration from the same environment variables as @reaatech/llm-cost-telemetry:

| Variable | Description | |----------|-------------| | DEFAULT_DAILY_BUDGET | Default daily budget cap | | DEFAULT_MONTHLY_BUDGET | Default monthly budget cap | | TENANT_BUDGETS | JSON object of per-tenant budget overrides | | AWS_REGION | AWS region for CloudWatch exporter | | GCP_PROJECT_ID | GCP project for Cloud Monitoring exporter | | LOKI_HOST | Loki host for Phoenix exporter |

Related Packages

License

MIT