LLM Cost Profiler: Open-source tool tracks API spending to make case for local models

LLM Cost Profiler is an open-source Python tool that tracks every API call your code makes to OpenAI and Anthropic, showing exactly what you're spending, where, and why. The tool exposes which tasks are overpriced relative to their complexity, providing concrete data to make the case for local inference.
Key Features and Findings
The tool stores everything in local SQLite and is MIT licensed. According to the source, it found several specific examples of API call waste:
- A classifier using GPT-4o that outputs one of 5 labels — a task any decent 7B local model handles easily. Cost: ~$89/week on API calls.
- Thousands of duplicate calls to the same prompt — zero caching. Local inference with caching would make this effectively free.
- A summarizer where 34% of calls were retries from format errors. A well-tuned local model with constrained generation eliminates this entire class of waste.
The author notes this tool gives teams concrete ammunition for investing in local inference infrastructure: "Here's the exact dollar amount we'd save by moving X task to a local model."
The tool is available on GitHub at https://github.com/BuildWithAbid/llm-cost-profiler. The author is planning to add support for tracking local model inference costs too (compute time based costing) and asked the community if this would be useful.
This type of cost profiling tool is particularly relevant for developers using AI coding agents, as it provides data-driven insights into where API spending might be inefficient compared to local alternatives.
📖 Read the full source: r/LocalLLaMA
👀 See Also

8 Advanced Claude Code Tips: Cost Saving, Context Management, Custom Commands
Practical tips from heavy daily use of Claude Code, covering git workflow automation, multimodal image input, API usage tracking, context compaction, session resumption, rule management, thinking triggers, and custom commands.

Book-Librarian: Track Your Reading, Get Spoiler-Free Recommendations
An OpenClaw skill that tracks your reading life, recommends from your owned books first, and learns your taste drift over time.

Prompt-Master: Claude Skill for Generating Accurate AI Tool Prompts
Prompt-Master is a free Claude skill that writes accurate prompts for various AI tools including Cursor, Claude Code, GPT, Midjourney, Kling, and Eleven Labs. The tool has reached 600+ stars on GitHub and processes 4000+ traffic.

Open Source SQLite-Based Persistent Memory System for Claude
A developer has released memchat, a GPL-licensed local system that extracts knowledge from Claude sessions at checkpoints, stores it in SQLite, and reassembles it for new sessions to maintain context across conversations.