I could not point Claude Code at localhost, so I MITM Bedrock on loopback
Описание и применение
Инструмент claude‑sniff позволяет перехватывать, просматривать и редактировать запросы Claude Code к Bedrock через локальный MITM‑прокси, обеспечивая контроль над ценами и безопасностью без раскрытия ключей AWS.
Задача
Claude Code on Amazon Bedrock does not expose its invoke requests to a local proxy, making it hard to inspect, edit, or cost‑track requests.
Результат
The claude-sniff tool enables local inspection, editing, and cost tracking of Claude Code requests without exposing AWS credentials, improving transparency and control for developers.
Рабочий процесс
- 1. Install dependencies with
uv syncand runuv run python main.py --aws-profile your-profileto start mitmproxy on 127.0.0.1:9090. - 2. In the same shell, set
HTTP_PROXYandHTTPS_PROXYto the mitmproxy address and launch Claude Code withclaude. - 3. Keep Proxy and Intercept disabled by default; enable Intercept only when you want to decrypt and edit requests.
- 4. Export the mitmproxy CA certificate and restart Claude Code to trust the proxy.
- 5. Intercept Bedrock
invoke/invoke-with-response-streamcalls, edit the JSON payload as needed, then forward the request. - 6. The tool re‑signs edited requests and resumes untouched JSON as-is; no calls are dropped unless explicitly configured.
Доказательства
I built claude-sniff: one Python process, mitmproxy on 127.0.0.1:9090, UI on 8765.
Intercept holds Bedrock invoke / invoke-with-response-stream that carry x-claude-code-session-id.
- Дата записи: 2026-09-07T19:59:57.141Z