Skip to content

VISystems/cost-tracker

Repository files navigation

@visystems/claude-cost-tracker

Analyze Anthropic API usage for cost optimization. Identify batch API candidates, model downtier opportunities, cache optimization, and prompt reduction.

Installation

npm install -g @visystems/claude-cost-tracker

Quick Start

# Analyze a usage log
claude-cost-tracker analyze usage.jsonl

# Generate optimization report
claude-cost-tracker report usage.jsonl --format json

# Estimate cost for an eval spec
claude-cost-tracker estimate my-eval.eval.yaml

Usage Log Format

JSONL with one record per line:

{"timestamp":"2026-04-01T10:00:00Z","model":"claude-sonnet-4-6","inputTokens":1500,"outputTokens":300,"cacheReadTokens":500}

Supported Models (as of 2026-04-30)

Model Input Output Cache Read
claude-opus-4-7 $5/MTok $25/MTok $0.50/MTok
claude-sonnet-4-6 $3/MTok $15/MTok $0.30/MTok
claude-haiku-4-5 $1/MTok $5/MTok $0.10/MTok

Recommendation Types

  • Batch API — High-volume workloads that could use 50% batch discount
  • Model downtier — Expensive models used for simple tasks
  • Cache optimization — Low cache hit rates with repeated prompts
  • Prompt reduction — Outlier input token counts

License

Apache 2.0

About

Cost/cache analysis CLI for Anthropic API usage. Maps to Catalog item 07 (40 SEU).

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors