DEDUPED Hot AI repos. Real use cases. What people build. Get the Monday 5

How to track token use in your own Anthropic or OpenAI app with Optimaizr

Wrap your existing API client in one line so optimAIzr can read your app's calls.

Short answer: Install the package with npm install optimaizr in your app's project; then Wrap your client with optimaizr.wrap(new Anthropic()) or optimaizr.wrap(new OpenAI()); run your app once so it makes its usual API calls. All steps.

Who it is forA developer building an app on the Anthropic or OpenAI API who wants to see which calls spend the most tokens.

The problemAn API bill shows totals but not which calls re-send too much context or repeat work.

The outcomeYour app's API calls are wrapped so that the same optimAIzr report covers them alongside your other usage.

What you need first

  • Node.js 20.11 or later (22.13 or later to read opencode history)
  • Existing usage logs from Claude Code, Codex or opencode on this machine
  • A terminal

Steps

  1. Install the package with npm install optimaizr in your app's project. (inferred, check the README)
  2. Wrap your client with optimaizr.wrap(new Anthropic()) or optimaizr.wrap(new OpenAI()). (inferred, check the README)
  3. Run your app once so it makes its usual API calls.
  4. Run npx optimaizr to see where your tokens go.

Prompt for your agent

In the optimaizr repo, wrap the API client in <app path> with optimaizr.wrap, run the app once, then run `npx optimaizr` and report the Where it goes breakdown. Verify that the app still returns the same responses it returned before the wrap.

Caveat. The README does not say exactly what the wrapped client reports, so check the output after one run.

Use this in your AI agent

Ask your agent

Using the Deduped MCP, get the setup steps for blendbunjaku/optimaizr and "Track token use in your own Anthropic or OpenAI app"

Add Deduped to Claude Code once

claude mcp add --transport http deduped https://dedupedai.com/mcp

Cursor, ChatGPT, others

Share: X LinkedIn Hacker News Email Copy link

Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer