What to know exactly what Claude Code is doing? Snoopty is a proxy server and visualization tool for Claude Code. Snoopty intercepts API requests from Claude Code, logs all interactions locally, and provides an interactive dashboard to analyze usage patterns, token consumption, and tool usage.
See all the messages from Claude Code with agent tagging, token counts, and various UX filtering mechanisms.
For token counts, we show the counts returned from Anthropic under System Usage and then show our custom token counting at a finer granularity under Custom Counts.
For a single request, see in details each component, each tool, and estiamted token usage.
For a given selection of logs, look at aggregate metrics of token counts and tool usage. You can even dive into MCP versus Anthropic Default tools.
What to do analysis elsewhere, hit the download to parquet function to get a dump of logs into a log dump. The logs dumped will only be those selected/filtered in the current view.
- Node.js 18+
- An Anthropic API key
npm installCreate a .env file from .env.example:
UPSTREAM_API_KEY="sk-ant-XXX"
UPSTREAM_BASE_URL=https://api.anthropic.com
PORT=8787
LOG_DIR=logs
LOG_LEVEL=info # Options: debug, info, warn, error (default: info)Configuration options:
UPSTREAM_API_KEY: Your Anthropic API key (required)UPSTREAM_BASE_URL: Anthropic API endpoint (default: https://api.anthropic.com)PORT: Port for the proxy server (default: 8787)LOG_DIR: Directory for storing interaction logs (default: logs)LOG_LEVEL: Logging verbosity level (default: info)debug: Verbose output including all internal operationsinfo: Normal operation logs (proxy requests, startup/shutdown, important events)warn: Warnings and errors onlyerror: Errors only
In development, you need to run two separate servers:
# Terminal 1 - Backend proxy server (port 8787)
npm run dev
# Terminal 2 - Frontend development server (port 5173)
npm run dev:uiWhat's happening:
-
Backend server (
npm run dev) on port 8787:- Proxies all
/v1/*requests to Anthropic API - Logs interactions to
logs/directory - Provides REST API endpoints at
/api/logs - Runs background workers for metrics processing
- Does NOT serve the UI in development mode
- Proxies all
-
Frontend server (
npm run dev:ui) on port 5173:- Serves the React UI with hot module replacement
- Automatically proxies API calls to backend on port 8787
- Access the UI at
http://localhost:5173
In production, everything runs from a single server:
# Build both backend and frontend
npm run build
# Run the production server (port 8787)
npm start
# Or explicitly set NODE_ENV for production mode:
# NODE_ENV=production npm startNote: The server automatically detects production mode when:
NODE_ENV=productionis set, OR- Running compiled JavaScript (not via ts-node-dev)
- If you see a development mode message at
/ui, ensure you've runnpm run buildfirst
Configure Claude Code to use Snoopty as the API endpoint.
IMPORTANT Anthropic will yell at you about "auth conflict". Ignore it. Do not log out. Proceed as normal.
# Use Snoopty proxy (always port 8787 for API, regardless of dev/prod mode)
# Yes, you need to give the API key here again.
ANTHROPIC_BASE_URL=http://localhost:8787 ANTHROPIC_API_KEY="sk-ant-XXX" claudeAll requests will be forwarded to Anthropic and logged locally in the logs/ directory.
- Development: Open
http://localhost:5173/ui/in your browser - Production: Open
http://localhost:8787/ui/in your browser
The UI will show all logged interactions, token usage, and provide analytics dashboards.
Snoopty consists of two main components:
-
Backend Proxy Server (Node.js + Express + TypeScript)
- Intercepts API requests from Claude Code
- Forwards requests to Anthropic API with your API key
- Logs all interactions to JSON files
- Processes metrics asynchronously in background workers
- Serves REST API for the UI
-
Frontend Dashboard (React 19 + Vite)
- Interactive timeline view of all requests
- Token usage breakdown and analytics
- Tool usage statistics
- Export functionality (Parquet format)
- Claude Code sends request to
http://localhost:8787/v1/* - Snoopty proxy:
- Captures the request
- Forwards to Anthropic API
- Streams the response back to Claude Code
- Logs the complete interaction to
logs/directory
- Background workers process logs to compute:
- Token counts per role (system, user, assistant)
- Tool usage metrics
- Agent detection and tagging
- UI polls
/api/logsto display real-time data
src/- Backend TypeScript sourceproxy.ts- Anthropic API proxy implementationlogStore.ts- Log management and queryingmetrics/- Pluggable metrics analyzersworkers/- Background processing
client/- Frontend React applicationlogs/- JSON log files (one per API interaction)dist/- Built production files
Huge shout out to Pydantic AI's Logifre. Their chat view was huge inspiration. Also thanks to Hyperparam. I used their parquet view a lot in early investigations of logs.



