{
 "schema_version": 1,
 "generated": "2026-10-20",
 "id": "blendbunjaku-optimaizr--add-token-tracking-to-own-api-app",
 "repo": "blendbunjaku/optimaizr",
 "repo_url": "https://github.com/blendbunjaku/optimaizr",
 "repo_slug": "blendbunjaku-optimaizr",
 "title": "Track token use in your own Anthropic or OpenAI app",
 "page_title": "How to track token use in your own Anthropic or OpenAI app with Optimaizr",
 "summary": "Wrap your existing API client in one line so optimAIzr can read your app's calls.",
 "who": "A developer building an app on the Anthropic or OpenAI API who wants to see which calls spend the most tokens.",
 "problem": "An API bill shows totals but not which calls re-send too much context or repeat work.",
 "outcome": "Your app's API calls are wrapped so that the same optimAIzr report covers them alongside your other usage.",
 "steps": [
  "Install the package with `npm install optimaizr` in your app's project. (inferred, check the README)",
  "Wrap your client with `optimaizr.wrap(new Anthropic())` or `optimaizr.wrap(new OpenAI())`. (inferred, check the README)",
  "Run your app once so it makes its usual API calls.",
  "Run `npx optimaizr` to see where your tokens go."
 ],
 "agent_prompt": "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.",
 "agents": [
  "any"
 ],
 "difficulty": "Intermediate",
 "time": "30 minutes",
 "basis": "readme",
 "caveat": "The README does not say exactly what the wrapped client reports, so check the output after one run.",
 "category": "Software and DevOps",
 "tags": [
  "Software and DevOps"
 ],
 "lang": "typescript",
 "requirements": [
  "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"
 ],
 "risk": "none",
 "seen_in_the_wild": false,
 "mentioned_publicly": false,
 "risks": [],
 "best": false,
 "score": 0.8,
 "evidence": [],
 "url": "https://dedupedai.com/use-cases/blendbunjaku-optimaizr/add-token-tracking-to-own-api-app/",
 "md": "https://dedupedai.com/use-cases/blendbunjaku-optimaizr/add-token-tracking-to-own-api-app/index.md",
 "disclaimer": "Deduped lists open-source repositories that belong to other people. We do not own, maintain, audit, or vouch for any of them, and a repo appearing here is not an endorsement or a safety check. The use cases, steps, and prompts are written by AI and may be incomplete, outdated, or just wrong. Where a use case is marked \"Seen in the wild\", we link to public posts where someone described something similar, but we have not verified those posts and the use case itself is still our AI's own write-up. Use all of this at your own risk. Only run code, commands, or agents on systems and accounts you are authorized to use, and read the code and every command before you run it, especially anything that touches credentials, files, or the network. Nothing here is professional, security, legal, or financial advice. All trademarks and project names belong to their respective owners, and their use here does not imply affiliation. Content is provided as is, without warranties of any kind. Found a mistake, a safety problem, or something you want removed? Email hello@dedupedai.com and we will look at it promptly.",
 "api": "https://dedupedai.com/api/v1/usecases/blendbunjaku-optimaizr--add-token-tracking-to-own-api-app.json",
 "api_version": "v1"
}
