A MITM proxy tool to intercept, analyze and log AI coding assistant communications with LLM APIs
Project description
Claude-Code-Inspector (CCI)
๐ MITM Proxy for LLM API Traffic Analysis
A cross-platform command-line tool that intercepts, analyzes, and logs communications between AI coding assistants (Claude Code, Cursor, Codex, Gemini-CLI, etc.) and their backend LLM APIs.
โจ Features
- Watch Mode - Interactive continuous capture with session management
- Transparent Inspection - See exactly what prompts are sent and what responses are received
- Streaming Support - Captures both streaming (SSE) and non-streaming API responses
- Multi-Provider - Works with Anthropic, OpenAI, Google, Groq, Together, Mistral, and more
- Automatic Masking - Protects API keys and sensitive data in logs
- Auto Processing - Automatically merges and splits session data
- Cross-Platform - Works on Windows, macOS, and Linux
๐ฆ Installation
Using pip
pip install claude-code-inspector
Using uv (recommended)
uv add claude-code-inspector
From source
git clone https://github.com/chouzz/claude-code-inspector.git
cd claude-code-inspector
uv sync
๐ Quick Start
1. Install Certificate (First Time Only)
# Generate certificate
cci watch &
sleep 2
kill %1
Then install the certificate:
macOS:
open ~/.mitmproxy/mitmproxy-ca-cert.pem
# Double-click to add to Keychain
# In Keychain Access, find "mitmproxy" โ Double-click โ Trust โ "Always Trust"
Linux (Ubuntu/Debian):
sudo cp ~/.mitmproxy/mitmproxy-ca-cert.pem /usr/local/share/ca-certificates/mitmproxy.crt
sudo update-ca-certificates
Windows:
Navigate to %USERPROFILE%\.mitmproxy\, double-click mitmproxy-ca-cert.pem โ Install Certificate โ Local Machine โ Trusted Root Certification Authorities
2. Start Watch Mode
cci watch
3. Configure Your Application (New Terminal)
export HTTP_PROXY=http://127.0.0.1:9090
export HTTPS_PROXY=http://127.0.0.1:9090
export NODE_EXTRA_CA_CERTS=~/.mitmproxy/mitmproxy-ca-cert.pem
# Run your AI tool
claude -p "hello"
4. Record Sessions
- Press Enter in watch mode to start recording
- Press Enter again to stop and process the session
- Ctrl+C to exit watch mode
๐ฌ How Watch Mode Works
Watch mode uses a state machine with three states:
| State | Description |
|---|---|
| IDLE | Monitoring traffic, waiting for you to start a session |
| RECORDING | Capturing traffic with session ID injection |
| PROCESSING | Auto-extracting, merging, and splitting session data |
Example Session
$ cci watch
โญโโโโโโโโโโโโโโโโโโโโโโโโโโฎ
โ CCI Watch Mode โ
โ Continuous Capture โ
โฐโโโโโโโโโโโโโโโโโโโโโโโโโโฏ
Proxy Port: 9090
Output Dir: ./traces
Global Log: traces/all_captured_20251203_220000.jsonl
Configure your application:
export HTTP_PROXY=http://127.0.0.1:9090
export HTTPS_PROXY=http://127.0.0.1:9090
export NODE_EXTRA_CA_CERTS=~/.mitmproxy/mitmproxy-ca-cert.pem
โ [IDLE] Monitoring on :9090... Logging to all_captured_20251203_220000.jsonl
Press [Enter] to START Session 1
<Enter>
โ [REC] Session 01_session_20251203_223010 is recording...
Press [Enter] to STOP & PROCESS
<Enter>
โณ [BUSY] Processing Session 01_session_20251203_223010...
โ Saved to traces/01_session_20251203_223010/
โ [IDLE] Monitoring on :9090... Logging to all_captured_20251203_220000.jsonl
Press [Enter] to START Session 2
Output Structure
./traces/ # Root output directory
โโโ all_captured_20251203_220000.jsonl # Global log (all traffic)
โ
โโโ 01_session_20251203_223010/ # Session 01 folder
โ โโโ raw.jsonl # Clean session data
โ โโโ merged.jsonl # Merged conversations
โ โโโ split_output/ # Individual files
โ โโโ 001_request_2025-12-03_22-30-10.json
โ โโโ 001_response_2025-12-03_22-30-10.json
โ
โโโ 02_session_20251203_224500/ # Session 02 folder
โโโ ...
๐ CLI Reference
cci watch
Start watch mode for continuous session capture (recommended).
cci watch [OPTIONS]
Options:
-p, --port INTEGER Proxy server port (default: 9090)
-o, --output-dir PATH Root output directory (default: ./traces)
-i, --include TEXT Additional URL patterns to include (glob pattern)
--debug Enable debug mode with verbose logging
Examples:
# Basic watch mode
cci watch
# Custom port and output directory
cci watch --port 8888 --output-dir ./my_traces
# Include custom API endpoint (glob pattern)
cci watch --include "*my-custom-api.com*"
# Match all subdomains of a domain
cci watch --include "*api.example.com*"
Glob Pattern Syntax:
| Pattern | Description |
|---|---|
* |
Matches any characters |
? |
Matches a single character |
[seq] |
Matches any character in seq |
[!seq] |
Matches any character not in seq |
cci config
Display configuration and setup help.
cci config --cert-help # Certificate installation instructions
cci config --proxy-help # Proxy configuration instructions
cci config --show # Show current configuration
cci stats
Display statistics for a captured trace file.
cci stats traces/01_session_xxx/raw.jsonl
๐ง Supported LLM Providers
CCI is pre-configured to capture traffic from:
| Provider | API Domain |
|---|---|
| Anthropic | api.anthropic.com |
| OpenAI | api.openai.com |
generativelanguage.googleapis.com |
|
| Together | api.together.xyz |
| Groq | api.groq.com |
| Mistral | api.mistral.ai |
| Cohere | api.cohere.ai |
| DeepSeek | api.deepseek.com |
Add custom providers with --include (using glob patterns):
cci watch --include "*my-custom-api.com*"
๐ Troubleshooting
SSL Certificate Error
Problem: SSL: CERTIFICATE_VERIFY_FAILED
Solution: Install the mitmproxy CA certificate. Run cci config --cert-help for instructions.
Node.js Apps Not Working
Problem: Requests hang or timeout when using Claude Code, Cursor, etc.
Solution: Set the NODE_EXTRA_CA_CERTS environment variable:
export NODE_EXTRA_CA_CERTS=~/.mitmproxy/mitmproxy-ca-cert.pem
No Traffic Captured
Problem: Watch mode is running but no requests are logged
Solution:
- Verify proxy environment variables are set correctly
- Make sure the URL matches the default patterns (or add
--include) - Check
cci config --showto see current filter patterns
๐ License
MIT License
๐ค Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
๐ Support
- GitHub Issues: Report a bug
- Documentation: Read the docs
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_code_inspector-1.2.0.tar.gz.
File metadata
- Download URL: claude_code_inspector-1.2.0.tar.gz
- Upload date:
- Size: 39.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e604ad390ca348474261219290d0b1ef6a7134f3d084f146bd6d686a457e1f81
|
|
| MD5 |
18086bbee0f197cfe25633b21d08d9e7
|
|
| BLAKE2b-256 |
34c5f728770e62aa53c729cf876ec0290898f0b1f5ff22e628ef6dbbd14474e7
|
Provenance
The following attestation bundles were made for claude_code_inspector-1.2.0.tar.gz:
Publisher:
publish.yml on chouzz/claude-code-inspector
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
claude_code_inspector-1.2.0.tar.gz -
Subject digest:
e604ad390ca348474261219290d0b1ef6a7134f3d084f146bd6d686a457e1f81 - Sigstore transparency entry: 752481412
- Sigstore integration time:
-
Permalink:
chouzz/claude-code-inspector@e630faddeec4d20bb3837e0c6fa037456354b397 -
Branch / Tag:
refs/tags/v1.2.0 - Owner: https://github.com/chouzz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e630faddeec4d20bb3837e0c6fa037456354b397 -
Trigger Event:
release
-
Statement type:
File details
Details for the file claude_code_inspector-1.2.0-py3-none-any.whl.
File metadata
- Download URL: claude_code_inspector-1.2.0-py3-none-any.whl
- Upload date:
- Size: 36.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ec24b6e729623bd7da50b373f1eaa8b5aabace8af940eacc32aea771e503c19d
|
|
| MD5 |
f861fc588821b4d0f7e6687dfdfda455
|
|
| BLAKE2b-256 |
d5e00776ccdd9389ebcae919ec136613df00ec4fd4821286d20f38c9e4fc7ec9
|
Provenance
The following attestation bundles were made for claude_code_inspector-1.2.0-py3-none-any.whl:
Publisher:
publish.yml on chouzz/claude-code-inspector
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
claude_code_inspector-1.2.0-py3-none-any.whl -
Subject digest:
ec24b6e729623bd7da50b373f1eaa8b5aabace8af940eacc32aea771e503c19d - Sigstore transparency entry: 752481414
- Sigstore integration time:
-
Permalink:
chouzz/claude-code-inspector@e630faddeec4d20bb3837e0c6fa037456354b397 -
Branch / Tag:
refs/tags/v1.2.0 - Owner: https://github.com/chouzz
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@e630faddeec4d20bb3837e0c6fa037456354b397 -
Trigger Event:
release
-
Statement type: