Skip to content
This repository was archived by the owner on Apr 27, 2026. It is now read-only.

aptratcn/skill-api-cost-tracker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 

Repository files navigation

API Cost Tracker 💰

Stop guessing your AI spend. Track costs per task, model, and project. Know your ROI.

License: MIT Zero Dependencies Skill

The Problem

AI costs are invisible until the bill arrives.

What you see What you don't see
Monthly API bill Cost per task/project
"You used 2M tokens" Which sessions cost most
Rate limit errors Cost efficiency of each model

Real costs add up fast:

  • Single coding session: $5-50
  • Multi-agent system per day: $100s
  • Monthly bill surprise: $500+

The Solution

TRACK    → Log every API call (model, tokens, cost, project)
ANALYZE  → Weekly review: top costs, model efficiency, trends
OPTIMIZE → Route tasks to cost-efficient models

Quick Start

1. Create cost-log.yaml

entries:
  - timestamp: 2026-04-27T03:00:00Z
    task: "Code review: auth module"
    model: claude-3-opus
    input_tokens: 8500
    output_tokens: 2200
    cost_usd: 0.68
    project: myapp-backend

2. Add to Your Agent

After every API call, log to cost-log.yaml:
timestamp, task, model, input_tokens, output_tokens, cost_usd, project

3. Analyze Weekly

Ask your agent:

"Analyze cost-log.yaml: top 5 expensive tasks, cost by model, weekly trend"

Pricing Reference (2026)

Model Input ($/1M) Output ($/1M) Best For
Claude 3 Opus $15 $75 Complex reasoning
Claude 3 Sonnet $3 $15 General use
GPT-4 Turbo $10 $30 Code, analysis
GPT-3.5 Turbo $0.50 $1.50 Simple tasks

What You Get

  • 📊 Visibility: Know exactly where your money goes
  • 🎯 Attribution: Cost per project, not just total
  • Optimization: Data-driven model selection
  • 🔮 Forecasting: Predict monthly spend before surprise

Anti-Patterns

❌ Bad ✅ Good
Check bill later Log every session
Expensive model for simple tasks Route by complexity
No project tags Tag every entry

Every dollar saved is a dollar for more valuable AI tasks.

Install

# Claude Code
cp SKILL.md .claude/skills/api-cost-tracker/

# OpenClaw
cp SKILL.md ~/.openclaw/workspace/skills/api-cost-tracker/

# Cursor
cp SKILL.md .cursor/rules/api-cost-tracker.mdc

License

MIT — Use freely, attribute if you like.

About

Track AI API costs per task, model, and project. Stop guessing your spend.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors