I was paying to send 27 unused tools to Claude. So I filtered them.
Description and use
The author discovered that Claude Code sends 27 tool definitions with every request, leading to high token costs. They built a local proxy that filters unused tools based on regex, reducing token usage by 75% and cutting monthly costs from $200 to $50.
Problem
Claude Code sends 27 tool definitions with every single request, consuming ~1,200 tokens of JSON schemas even for simple tasks like fixing a typo. This results in paying for unused tool definitions, causing high API costs.
Outcome
By implementing a local proxy that filters tool definitions based on message content, the author reduced token usage by 75% (from 1,200 to 300 tokens per request) and cut monthly API costs from $200 to $50. The solution uses simple regex matching and requires no LLM calls for classification.
Workflow
- Clone the Dynamic Tool Proxy repository from GitHub.
- Install required dependencies (fastapi, httpx, uvicorn).
- Run the standalone proxy script on port 8090.
- Configure the Claude Code client to use the proxy as the base URL (ANTHROPIC_BASE_URL=http://localhost:8090).
- The proxy analyzes the user's message using regex to determine the required tool category.
- The proxy forwards only the relevant tools to the API provider.
- The provider processes the request and returns the result.
- The proxy passes the response back to the client.
Evidence
Cost went from $200 to $50. Same code. Same quality.
WITHOUT proxy: 27 tools ~1,200 tokens WITH proxy: 6 tools ~300 tokens Saved: ~900 tokens per request (75%)
I tracked it for a week. Here's what I saw: Monthly cost saved $150
- Record date: 2026-09-06T17:22:19.694Z