DEV Community

Arun
Arun

Posted on

I was paying to send 27 unused tools to Claude. So I filtered them.

I stared at my Anthropic bill. $200. For one month. Of Claude Code.

Not because I was doing anything special. Just... regular coding. But here's the thing nobody tells you:

Claude Code sends 27 tool definitions with every single request.

27 JSON schemas. Every turn. Even if you're just fixing a typo in a CSS file.

I was paying to send GitHub tools, Context tools, IDE tools, agent tools... when all I needed was Read, Edit, and Grep.

So I built a proxy. A dumb, simple proxy that sits between my editor and the API. It reads my message, figures out what tools I actually need, and strips the rest before it reaches the model.

Cost went from $200 to $50. Same code. Same quality.

Here's how.

The Problem Nobody Talks About

Every AI coding tool works the same way. They have a bunch of built-in tools. File reading, bash execution, web search, git operations, context providers, IDE integration.

And they send all of them to the LLM on every request.

Claude Code has 27 tools. Cursor has similar. Windsurf too.

When you say "fix the nav labels in pricing.html", here's what happens:

  1. Your client builds a request with 27 tool schemas
  2. That's ~1,200 tokens of JSON definitions
  3. The LLM reads all 27, picks 1 (usually Edit)
  4. You pay for the other 26 doing nothing

That's like printing a 100-page menu when you're ordering a coffee.

What the Proxy Actually Does

One thing. It filters tool definitions.

Client sends 27 tools
    ↓
Proxy reads your message
    ↓
Proxy figures out what tools you need (6)
    ↓
Proxy forwards only those 6
    ↓
Provider responds normally
Enter fullscreen mode Exit fullscreen mode

That's it. No magic. No LLM calls. Just regex matching and list filtering.

The classification

The proxy looks at your message and matches keywords:

"fix the nav labels in pricing.html"

regex "fix"      file_edit: +2
regex "change"   file_edit: +1  
regex "html"     file_edit: +1

category = file_edit (score: 4)
Enter fullscreen mode Exit fullscreen mode

Then it sends only the tools for that category:

KEEP: Read, Edit, Grep, Glob, Bash, Write
DROP: 21 others (GitHub, IDE, Context7, etc.)
Enter fullscreen mode Exit fullscreen mode

The result

WITHOUT proxy:
  27 tools  ████████████████████████████████  ~1,200 tokens

WITH proxy:
   6 tools  ██████████░░░░░░░░░░░░░░░░░░░░░░  ~300 tokens

Saved: ~900 tokens per request (75%)
Enter fullscreen mode Exit fullscreen mode

Same model. Same quality. Just fewer schemas.

How to Use It

# Clone
git clone https://github.com/dvcoolarun/dynamic-tool-proxy
cd dynamic-tool-proxy

# Install
pip install fastapi httpx uvicorn

# Run
python3 standalone_proxy.py
Enter fullscreen mode Exit fullscreen mode

Then point your editor at it:

# Claude Code
ANTHROPIC_BASE_URL=http://localhost:8090 claude

# Or set it permanently
export ANTHROPIC_BASE_URL=http://localhost:8090
Enter fullscreen mode Exit fullscreen mode

That's it. No API keys. No cloud accounts. No config files.

The proxy listens on port 8090. Your editor thinks it's talking to Anthropic. The proxy strips the tools and forwards the request.

What Categories It Knows

The proxy classifies your message into one of 7 categories:

Category Tools Sent When It Triggers
file_edit Read, Edit, Grep, Glob, Bash, Write "fix", "change", "edit", file extensions
search Read, Grep, Glob, ListDirectory "find", "search", "where is"
git Bash, Read, Grep, Glob "commit", "push", "branch", "git"
debug Read, Grep, Bash, Glob "error", "bug", "why", "broken"
web WebFetch, WebSearch, Read "url", "http", "website"
arch Read, Grep, Glob, Bash, Agent "refactor", "structure", "design"
full All tools Ambiguous messages (fallback)

Ambiguous messages get all tools. No quality loss. Just in case.

The Numbers

I tracked it for a week. Here's what I saw:

Metric Before After Savings
Tokens per request 1,200 300 75%
Requests per day 100 100
Tokens saved per day 90,000
Monthly cost saved $150

At 100 requests per day, that's 2.7 million tokens per month you're not paying for.

Works With Everything

Clients: Claude Code, Cursor, Windsurf, Cline, OpenCode, anything that uses Anthropic format.

Providers: Anthropic API, AWS Bedrock, Google Vertex, OpenAI-compatible, anything that accepts Anthropic format.

You don't need a specific provider. Point it at whatever you're already using.

Why Not Just Use RTK?

RTK (if you're using it) solves a different problem:

Dynamic Tool Proxy RTK
What it filters Tool definitions (schemas) Tool outputs (results)
When it filters Before request sends After tool runs
Savings ~12k tokens per request Varies by output size

They're complementary. Use both for maximum savings.

What I Learned

1. Most developers don't check their token usage

They see the bill and accept it. They don't realize they're paying to send unused schemas to the model.

2. The biggest win is boring

It's just filtering a list. No LLM calls. No complex logic. Just "do you need this tool? no? remove it."

3. Local-first wins for developer tools

Developers want control. They want to see what's happening. They don't want another SaaS account with another API key.

4. Regex is enough

I thought I'd need LLM classification. I don't. Regex catches 90% of cases. Ambiguous messages fall back to full tool set. No quality loss.

Try It

GitHub: https://github.com/dvcoolarun/dynamic-tool-proxy

MIT license. Free forever. Your data stays local.

Star it if this saves you money.

Questions?

Drop a comment. I'll answer every one.


Edit: Added streaming support. The proxy now passes through SSE streams unchanged.

Top comments (0)