This project provides an HTTPS interception proxy for debugging what your AI agent sends to LLM providers.
By default, it captures all traffic passing through the proxy. You can optionally restrict recording to specific domains via the CAPTURE_DOMAINS configuration.
- Capture request data: method, URL, headers, body
- Capture response data (optional): status, headers, body
- Domain allowlist filtering (
CAPTURE_DOMAINS, set to*for all traffic) - OpenAI/OpenAI-compatible metadata extraction
provider(e.g.openai,openai_compatible)session_idheuristics (labels, metadata, or fingerprinting)- Automated session fingerprinting based on initial message content (prevents grouping everything under
none). modelandinput_chars_estimate
- Provider/session extraction for:
openai/openai_compatibleazure_openaianthropicgemini
- Local Web UI (no auth) for:
- browsing flows
- grouping by timeline bucket and session
- collapsible timeline -> session -> flow correlation
- viewing parsed request/response JSON side-by-side
- exporting selected session/time window to JSON or CSV
llm_capture_addon.py: mitmproxy addon (capture + metadata)run_proxy.sh: starts proxy at127.0.0.1:8080(foreground)webui.py: local API + UI serverrun_webui.sh: starts web UI server (foreground)webui/static/index.html: frontendinspect_logs.py: CLI analyzer for largest requests.env.example: runtime config
- Install dependencies:
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt- Configure:
cp .env.example .env- Start proxy:
./run_proxy.sh- Start web UI:
./run_webui.sh-
Ensure you have configured the background service scripts in the
scripts/directory (see macOS Configuration below). -
Install and start services:
./scripts/install-services.sh- Check status:
http://127.0.0.1:8765
- Point your agent/process to the proxy:
export HTTP_PROXY=http://127.0.0.1:8080
export HTTPS_PROXY=http://127.0.0.1:8080To inspect HTTPS bodies, your client must trust mitmproxy's local CA cert.
After first proxy run, cert files are created under ~/.mitmproxy/.
- macOS: import
~/.mitmproxy/mitmproxy-ca-cert.peminto System keychain and set to Always Trust. - Python requests/curl: optionally set
SSL_CERT_FILEorREQUESTS_CA_BUNDLEto this cert.
Without trust setup, HTTPS clients may fail TLS verification.
CAPTURE_DOMAINS: comma-separated allowlist, supports exact and subdomains. Set to*(default) to capture everything.LOG_DIR: output root (defaultlogs)SAVE_RESPONSES:trueorfalseREDACT_AUTH: redactAuthorizationheader (truerecommended)MAX_BODY_BYTES: body byte cap persisted per recordWEBUI_HOST: web UI host (default127.0.0.1)WEBUI_PORT: web UI port (default8765)
logs/requests/<flow_id>.jsonlogs/responses/<flow_id>.jsonlogs/events.ndjson
./inspect_logs.py --log-dir logs --top 20- UI has no password by design and is for local-only usage.
- Session grouping is heuristic for OpenAI-compatible payloads; if no session id exists, entries appear under
none. - Captured logs may include sensitive data; protect local files accordingly.
GET /api/flows?provider=...&session_id=...&from=...&to=...&limit=...GET /api/flows/<flow_id>GET /api/sessions?provider=...&from=...&to=...GET /api/timeline_sessions?provider=...&session_id=...&from=...&to=...GET /api/export?format=json|csv&provider=...&session_id=...&from=...&to=...
The macOS background service scripts are located in the scripts/ directory. Since they contain absolute paths specific to your user profile, they are ignored by Git.
To configure them for your system:
- Create the directory:
mkdir -p scripts - Copy the following templates into the
scripts/directory, replacing/path/to/ai-proxywith your actual project root path.
#!/usr/bin/env bash
set -euo pipefail
# Replace with your project path
source /PATH/TO/PROJECT/.venv/bin/activate
exec /PATH/TO/PROJECT/run_proxy.sh#!/usr/bin/env bash
set -euo pipefail
# Replace with your project path
source /PATH/TO/PROJECT/.venv/bin/activate
exec /PATH/TO/PROJECT/run_webui.shDownload/create this plist and replace all absolute paths.
Download/create this plist and replace all absolute paths.
This script copies the .plist files to ~/Library/LaunchAgents/ and loads them via launchctl.
Note: After creating these files, remember to make the
.shfiles executable:chmod +x scripts/*.sh.