Loading page...Загружаем страницу...正在加载页面...
AtlasRepo

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

Описание и применение

Автор обнаружил, что Claude Code отправляет 27 определений инструментов с каждым запросом, что приводит к высоким расходам на токены. Он создал локальный прокси, который фильтрует неиспользуемые инструменты на основе регулярных выражений, что снизило использование токенов на 75% и стоимость с $200 до $50 в месяц.

Задача

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.

Результат

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.

Рабочий процесс

  • 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.

Доказательства

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

Источник

  • Дата записи: 2026-09-06T17:22:19.694Z