Trace Claude Code API requests via a local reverse proxy. Inspect system prompts, messages, tools, and token usage.
Project description
claude-tap
Intercept and inspect all API traffic from Claude Code or Codex CLI. See exactly how they construct system prompts, manage conversation history, select tools, and use tokens — in a beautiful trace viewer.
Dark Mode / Diff View
Install
Requires Python 3.11+ and Claude Code (or Codex CLI for --tap-client codex).
# Recommended
uv tool install claude-tap
# Or with pip
pip install claude-tap
Upgrade: uv tool upgrade claude-tap or pip install --upgrade claude-tap
Usage
Claude Code
# Basic — launch Claude Code with tracing
claude-tap
# Live mode — watch API calls in real-time in browser
claude-tap --tap-live
# Pass any flags through to Claude Code
claude-tap -- --model claude-opus-4-6
claude-tap -c # continue last conversation
# Skip all permission prompts (auto-accept tool calls)
claude-tap -- --dangerously-skip-permissions
# Full-power combo: live viewer + skip permissions + specific model
claude-tap --tap-live -- --dangerously-skip-permissions --model claude-sonnet-4-6
Codex CLI
Codex CLI supports two authentication modes with different upstream targets:
| Auth Mode | How to authenticate | Upstream target | Notes |
|---|---|---|---|
| OAuth (ChatGPT subscription) | codex login |
https://chatgpt.com/backend-api/codex |
Default for ChatGPT Plus/Pro/Team users |
| API Key | Set OPENAI_API_KEY |
https://api.openai.com (default) |
Pay-per-use via OpenAI Platform |
# OAuth users (ChatGPT Plus/Pro/Team) — must specify target
claude-tap --tap-client codex --tap-target https://chatgpt.com/backend-api/codex
# API Key users — default target works out of the box
claude-tap --tap-client codex
# With specific model
claude-tap --tap-client codex -- --model codex-mini-latest
# Full auto-approval (skip all permission prompts)
claude-tap --tap-client codex -- --full-auto
# OAuth + full auto + live viewer
claude-tap --tap-client codex --tap-target https://chatgpt.com/backend-api/codex --tap-live -- --full-auto
Browser Preview
# Disable auto-open of HTML viewer after exit (on by default)
claude-tap --tap-no-open
# Live mode — real-time viewer opens in browser while client runs
claude-tap --tap-live
claude-tap --tap-live --tap-live-port 3000 # fixed port for live viewer
When the client exits, you can also manually open the generated viewer:
open .traces/trace_*.html
Proxy-Only Mode
Start the proxy without launching a client — useful for custom setups or connecting from a separate terminal:
# Claude Code
claude-tap --tap-no-launch --tap-port 8080
# In another terminal:
ANTHROPIC_BASE_URL=http://127.0.0.1:8080 claude
# Codex CLI (OAuth)
claude-tap --tap-client codex --tap-target https://chatgpt.com/backend-api/codex --tap-no-launch --tap-port 8080
# In another terminal:
OPENAI_BASE_URL=http://127.0.0.1:8080/v1 codex
# Codex CLI (API Key)
claude-tap --tap-client codex --tap-no-launch --tap-port 8080
# In another terminal:
OPENAI_BASE_URL=http://127.0.0.1:8080/v1 codex
Common Combos
# Trace Claude Code with live viewer and auto-accept
claude-tap --tap-live -- --dangerously-skip-permissions
# Trace Codex (OAuth) with live viewer and full auto
claude-tap --tap-client codex --tap-target https://chatgpt.com/backend-api/codex --tap-live -- --full-auto
# Save traces to a custom directory
claude-tap --tap-output-dir ./my-traces
# Keep only the last 10 trace sessions
claude-tap --tap-max-traces 10
CLI Options
All flags are forwarded to the selected client, except these --tap-* ones:
--tap-client CLIENT Client to launch: claude (default) or codex
--tap-target URL Upstream API URL (default: auto per client)
--tap-live Start real-time viewer (auto-opens browser)
--tap-live-port PORT Port for live viewer server (default: auto)
--tap-no-open Don't auto-open HTML viewer after exit (on by default)
--tap-output-dir DIR Trace output directory (default: ./.traces)
--tap-port PORT Proxy port (default: auto)
--tap-host HOST Bind address (default: 127.0.0.1, or 0.0.0.0 in --tap-no-launch mode)
--tap-no-launch Only start the proxy, don't launch client
--tap-max-traces N Max trace sessions to keep (default: 50, 0 = unlimited)
--tap-no-update-check Disable PyPI update check on startup
--tap-no-auto-update Check for updates but don't auto-download
--tap-proxy-mode MODE Proxy mode: reverse (default) or forward
Viewer Features
The viewer is a single self-contained HTML file (zero external dependencies):
- Structural diff — compare consecutive requests to see exactly what changed: new/removed messages, system prompt diffs, character-level inline highlighting
- Path filtering — filter by API endpoint (e.g.,
/v1/messagesonly) - Model grouping — sidebar groups requests by model (Opus > Sonnet > Haiku)
- Token usage breakdown — input / output / cache read / cache creation
- Tool inspector — expandable cards with tool name, description, and parameter schema
- Search — full-text search across messages, tools, prompts, and responses
- Dark mode — toggle light/dark themes (respects system preference)
- Keyboard navigation —
j/kor arrow keys - Copy helpers — one-click copy of request JSON or cURL command
- i18n — English, 简体中文, 日本語, 한국어, Français, العربية, Deutsch, Русский
Architecture
How it works:
claude-tapstarts a reverse proxy and spawns the selected client (claudeorcodex) with the provider-specific base URL pointing to it- All API requests flow through the proxy → upstream API → back through proxy
- SSE streaming responses are forwarded in real-time (zero added latency)
- Each request-response pair is recorded to
trace.jsonl - On exit, a self-contained HTML viewer is generated
- Live mode (optional) broadcasts updates to browser via SSE
Key features: 🔒 API keys auto-redacted · ⚡ Zero latency · 📦 Self-contained viewer · 🔄 Real-time live mode
Contributor Legibility Checks
Run deterministic legibility checks locally:
uv run python scripts/check_legibility.py
Strict freshness mode (promotes stale standards metadata to failures):
uv run python scripts/check_legibility.py --strict-freshness
PR Merge-Readiness Check
Run a concise merge-readiness report for a pull request:
scripts/check_pr.sh <pr_number>
Options:
# Use an explicit repo instead of current checkout
scripts/check_pr.sh <pr_number> --repo owner/repo
# Skip local gates (CI/metadata only)
scripts/check_pr.sh <pr_number> --no-tests
The script prints:
- PR metadata (title, state, draft flag, merge state, head/base branch)
- CI checks summary (
pass/fail/pendingcounts) - Local gate results (unless
--no-tests) - Final verdict line:
VERDICT: READY ...orVERDICT: NOT_READY ...
Local gates executed by default:
uv run ruff check .
uv run ruff format --check .
uv run pytest tests/ -x --timeout=60
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file claude_tap-0.1.32.tar.gz.
File metadata
- Download URL: claude_tap-0.1.32.tar.gz
- Upload date:
- Size: 122.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cb7052f9669ce5373587e307b948cc4194e0503c445533a5d3d226279af29d08
|
|
| MD5 |
d9aa391cb7c1a0bacbeaec6f483fe206
|
|
| BLAKE2b-256 |
a17722e3ae659a4252eca272cc85821deaf26d80cd4927d9739f175b235bcfc7
|
Provenance
The following attestation bundles were made for claude_tap-0.1.32.tar.gz:
Publisher:
publish.yml on liaohch3/claude-tap
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
claude_tap-0.1.32.tar.gz -
Subject digest:
cb7052f9669ce5373587e307b948cc4194e0503c445533a5d3d226279af29d08 - Sigstore transparency entry: 1350880574
- Sigstore integration time:
-
Permalink:
liaohch3/claude-tap@14b77e00dede12933fd4eaeaa10c90629e6ade0a -
Branch / Tag:
refs/heads/main - Owner: https://github.com/liaohch3
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@14b77e00dede12933fd4eaeaa10c90629e6ade0a -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file claude_tap-0.1.32-py3-none-any.whl.
File metadata
- Download URL: claude_tap-0.1.32-py3-none-any.whl
- Upload date:
- Size: 80.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d238a511dc4dd096058d511b285bf4e49ccb461429514f8619f6e48561e0126a
|
|
| MD5 |
5138461606aebd7108c60012ac795da8
|
|
| BLAKE2b-256 |
c4785bfd39ff607e252c10adc07b7ae93ff5e2a5bc2de58e5f582a93b4809c38
|
Provenance
The following attestation bundles were made for claude_tap-0.1.32-py3-none-any.whl:
Publisher:
publish.yml on liaohch3/claude-tap
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
claude_tap-0.1.32-py3-none-any.whl -
Subject digest:
d238a511dc4dd096058d511b285bf4e49ccb461429514f8619f6e48561e0126a - Sigstore transparency entry: 1350880629
- Sigstore integration time:
-
Permalink:
liaohch3/claude-tap@14b77e00dede12933fd4eaeaa10c90629e6ade0a -
Branch / Tag:
refs/heads/main - Owner: https://github.com/liaohch3
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@14b77e00dede12933fd4eaeaa10c90629e6ade0a -
Trigger Event:
workflow_dispatch
-
Statement type: