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

@ozperium/aicost-tracker

v0.1.3

Published

Local-first CLI to track AI token usage and costs across projects

Readme

AICost Tracker

Local-first CLI to track AI token usage and costs across projects

npm version npm downloads License: MIT

Know exactly how much you're spending on AI APIs. No cloud, no account, no telemetry. Just a simple CLI that logs your token usage and shows you the cost breakdown.

Quick start

npm install -g @ozperium/aicost-tracker

Auto-logging (recommended)

Install as a library and wrap your AI client — every call is logged automatically:

npm install @ozperium/aicost-tracker
import OpenAI from 'openai';
import { track } from '@ozperium/aicost-tracker';

const openai = track(new OpenAI(), { project: 'myapp' });

// All calls now auto-logged — no manual logging needed
const response = await openai.chat.completions.create({ model: 'gpt-4o', messages: [...] });

Works with Anthropic too:

import Anthropic from '@anthropic-ai/sdk';
import { track } from '@ozperium/aicost-tracker';

const anthropic = track(new Anthropic(), { project: 'myapp' });
const response = await anthropic.messages.create({ model: 'claude-3-5-sonnet-20241022', ... });

Manual logging (CLI)

Log an API call:

aicost log myapp gpt-4o 1500 800 "generated README"

See your costs:

aicost summary

Output:

  AI Cost Tracker — Summary
  ══════════════════════════════════════════════════
  Total entries:    3
  Total cost:       $0.0359
  Input tokens:     4,000
  Output tokens:    2,200

  By Project:
  ──────────────────────────────────────────────────
  myapp                $    0.0358  2 calls
  agentspec            $    0.0002  1 calls

  By Model:
  ──────────────────────────────────────────────────
  claude-3.5-sonnet    $    0.0240  1 calls
  gpt-4o               $    0.0118  1 calls

Commands

aicost log <project> <model> <input_tokens> <output_tokens> [note]
aicost summary [--project <name>]
aicost models
aicost clear [--project <name>]
aicost version

Supported models

Pricing data included for:

  • OpenAI: gpt-4o, gpt-4o-mini, gpt-4-turbo, gpt-4, gpt-3.5-turbo, o1, o1-mini
  • Anthropic: claude-3.5-sonnet, claude-3.5-haiku, claude-3-opus, claude-3-sonnet, claude-3-haiku
  • Google: gemini-1.5-pro, gemini-1.5-flash
  • Local: ollama, local (free)

Data storage

All data is stored locally at ~/.aicost/usage.jsonl — one JSON entry per line. Simple, portable, greppable.

Why AICost?

  • Local-first — no cloud, no account, no telemetry
  • Simple — just a CLI, no dashboard to maintain
  • Multi-project — track costs across all your projects
  • Multi-model — supports OpenAI, Anthropic, Google, and local models
  • Portable data — JSONL format, easy to export or analyze

Part of the AI Dev Workflow Stack

AICostTracker is one tool in a three-part observability stack for AI development:

| Tool | What it does | Install | |------|-------------|---------| | AgentSpec | Test AI agent behavior — catch regressions before production | npm i -g @ozperium/agentspec | | AICostTracker | Track token usage and costs across projects | npm i -g @ozperium/aicost-tracker | | quota | Monitor AI rate limits — know what's left before it stops you | npm i -g @ozperium/quota |

License

MIT