Intercept and inspect Coding Agent API traffic from Claude Code, Codex CLI, Gemini CLI, Cursor CLI, OpenCode, Kimi/Kimi Code, Pi, and Hermes in a local trace vi
Intercept and inspect Coding Agent API traffic from Claude Code, Codex CLI, Gemini CLI, Cursor CLI, OpenCode, Kimi/Kimi Code, Pi, and Hermes in a local trace vi
claude-tap is a local proxy and trace viewer for AI coding agents. Run your CLI through it, or listen to local app transcripts, then inspect the real API traffic and agent context: system prompts, conversation history, tool schemas, tool calls, streaming responses, token usage, and request diffs.
Website: Local AI Agent Trace Viewer · Guide: How to view agent traces locally
It works with Claude Code, Codex CLI, Codex App, Gemini CLI, Grok Build CLI, Kimi CLI, MiMo Code, OpenCode, OpenClaw, Pi, Hermes Agent, Cursor CLI, Qoder CLI, Antigravity CLI, and CodeBuddy CLI.
Open a real agent run, inspect every request, and compare how context changes between turns.
|
|
Phistory archives versioned system prompt snapshots from agent CLIs such as Claude Code, Codex, Kimi, opencode, and Pi. It uses claude-tap's capture-only prompt export to preserve raw HTTP trace evidence and generate comparison-friendly prompt snapshots.
Open the prompt diff viewer · View repository |
|
| Client | Typical use |
|---|---|
| Claude Code | Anthropic API, AWS Bedrock, Claude-compatible gateways such as DeepSeek / GLM, or local proxy upstreams such as CC Switch |
| Codex CLI | OpenAI API key mode or ChatGPT subscription OAuth |
| Codex App | Desktop app launched through forward proxy mode so backend HTTP/WebSocket request bodies are captured |
| Gemini CLI | Google OAuth / Code Assist traffic |
| Grok Build CLI | Grok subscription OAuth sessions through the official CLI chat proxy |
| DeepSeek Harness | dsh headless tasks and custom profiles using DeepSeek or compatible gateways |
| Kimi CLI | Legacy kimi-cli and the newer Kimi Code CLI |
| MiMo Code | MiMo Code sessions (OpenCode fork with multi-provider support) |
| OpenCode | Multi-provider OpenCode sessions |
| OpenClaw | Multi-provider OpenClaw sessions |
| Pi | Pi sessions, including OpenAI Codex OAuth providers |
| Hermes Agent | Multi-provider Hermes TUI or gateway sessions |
| Cursor CLI / IDE Agent | Launch cursor-agent + live transcript watch (claude-tap --tap-client cursor) |
| Qoder CLI | Qoder Agent sessions through forward proxy mode |
| Antigravity CLI | Antigravity Agent sessions through forward proxy mode |
| CodeBuddy CLI | Tencent CodeBuddy SaaS or internal Copilot endpoint |
Requires Python 3.11+ and the client you want to trace.
# Recommended
uv tool install claude-tap
# Or with pip
pip install claude-tapUpgrade: claude-tap update, uv tool upgrade claude-tap, or pip install --upgrade claude-tap
Run the client you want to inspect through claude-tap. Flags after -- are passed to the selected client.
…# Pass 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
# Live viewer is on by default; pass Claude flags after --
claude-tap -- --dangerously-skip-permissions --model claude-sonnet-4-6claude-tap auto-detects custom Claude Code upstreams from ANTHROPIC_BASE_URL,
ANTHROPIC_BEDROCK_BASE_URL, or ANTHROPIC_VERTEX_BASE_URL in your environment
or Claude settings. Use --tap-target only when you want to override that
detected target.
Local proxy upstreams are supported too: if a tool such as CC Switch points Claude Code at a local ANTHROPIC_BASE_URL, claude-tap detects that value from Claude settings and records the traffic before forwarding it upstream. Use claude-tap in place of claude, such as claude-tap -- <claude-args>; no separate --tap-client value is needed.
For the Claude Code VS Code extension, set Claude Code: Claude Process Wrapper to claude-tap; on Windows, use the full claude-tap.exe path if VS Code cannot find it.
Full English guide: Claude Code with DeepSeek API. Simplified Chinese version: Claude Code 搭配 DeepSeek API.
export ANTHROPIC_AUTH_TOKEN="<your DeepSeek API key>"
unset ANTHROPIC_API_KEY
export ANTHROPIC_MODEL="deepseek-v4-pro[1m]"
export ANTHROPIC_DEFAULT_OPUS_MODEL="deepseek-v4-pro[1m]"
export ANTHROPIC_DEFAULT_SONNET_MODEL="deepseek-v4-pro[1m]"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="deepseek-v4-flash"
export CLAUDE_CODE_SUBAGENT_MODEL="deepseek-v4-flash"
export CLAUDE_CODE_EFFORT_LEVEL=max
export ANTHROPIC_BASE_URL=https://api.deepseek.com/anthropicclaude-tap -- --permission-mode bypassPermissionsclaude-tap reads the DeepSeek upstream from ANTHROPIC_BASE_URL, then launches Claude Code against the local proxy. Use --tap-target https://api.deepseek.com/anthropic only as a manual override.
claude-tap supports three Bedrock scenarios and auto-detects which applies:
Anthropic-compatible Bedrock gateway (New API or similar, no SigV4 in Claude Code)
export ANTHROPIC_AUTH_TOKEN="<your gateway token>"
unset ANTHROPIC_API_KEY
export ANTHROPIC_BASE_URL="https://new-api.example.com"
export ANTHROPIC_MODEL="bedrock/claude-opus-4-6"
export ANTHROPIC_DEFAULT_OPUS_MODEL="bedrock/claude-opus-4-6"
export ANTHROPIC_DEFAULT_SONNET_MODEL="bedrock/claude-opus-4-6"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="bedrock/claude-opus-4-6"
claude-tap -- --model bedrock/claude-opus-4-6claude-tap records the normal Claude Code /v1/messages HTTP/SSE traffic, then
forwards it to the gateway. For model names prefixed with bedrock/, it removes
Claude Code beta-only request options that AWS Bedrock rejects while preserving
the captured trace.
Custom Bedrock gateway (company proxy, no SigV4)
export CLAUDE_CODE_USE_BEDROCK=1
export ANTHROPIC_BEDROCK_BASE_URL="https://your-gateway.company.com/bedrock"
claude-tapclaude-tap detects the non-AWS host, redirects both ANTHROPIC_BASE_URL and ANTHROPIC_BEDROCK_BASE_URL to the local proxy, and decodes the AWS EventStream binary response format to extract token usage and model info.
AWS native Bedrock (SigV4-signed requests)
export CLAUDE_CODE_USE_BEDROCK=1
export ANTHROPIC_BEDROCK_BASE_URL="https://bedrock-runtime.us-east-1.amazonaws.com"
export AWS_REGION="us-east-1"
claude-tap --tap-proxy-mode forwardWhen the endpoint is a real AWS domain (*.amazonaws.com), claude-tap does not rewrite ANTHROPIC_BEDROCK_BASE_URL to localhost — doing so would break AWS SigV4 signature validation. Use forward proxy mode (--tap-proxy-mode forward) to capture this traffic without modifying the signed request.
Use --tap-target only as a manual override when auto-detection does not apply.
claude-tap supports Claude Code Vertex pass-through gateways that expose the
Vertex rawPredict, streamRawPredict, and count-tokens:rawPredict paths.
export CLAUDE_CODE_USE_VERTEX=1
export CLOUD_ML_REGION="us-east5"
export ANTHROPIC_VERTEX_PROJECT_ID="your-project-id"
export ANTHROPIC_VERTEX_BASE_URL="https://your-gateway.company.com/vertex"
export CLAUDE_CODE_SKIP_VERTEX_AUTH=1 # when your gateway handles auth
claude-tapWhen CLAUDE_CODE_USE_VERTEX=1 and ANTHROPIC_VERTEX_BASE_URL is set,
claude-tap detects that upstream, redirects both ANTHROPIC_BASE_URL and
ANTHROPIC_VERTEX_BASE_URL to the local proxy, and records Vertex rawPredict
HTTP/SSE traffic. If Claude Code uses native Google Vertex without
ANTHROPIC_VERTEX_BASE_URL, use forward proxy mode or set the base URL
explicitly so reverse mode has a single target to forward to.
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 |
claude-tap auto-detects the Codex target from your auth state when possible.
In the default reverse-proxy mode, it launches Codex with a temporary sibling
provider whose supports_websockets setting is disabled. This produces one
HTTP/SSE trace record per request with the complete request context and does
not modify ~/.codex/config.toml.
…Codex App is launched through claude-tap's forward proxy so the final /backend-api/codex/responses HTTP and WebSocket request bodies can be captured in the same trace viewer as other clients. Current macOS installs ship as ChatGPT.app (bun
No open issues yet, or sync has not completed.