This project provides two tools (You can use both of them):
- mitmproxy addon scripts, which can be added when executing mitmproxy/mitmweb
- (mitmweb only) Tampermonkey script
git clone https://github.com/sky-bro/mitmproxy-llm-better-view.gitAdd persistent configuration in ~/.mitmproxy/config.yaml:
# ... your other configs
scripts:
- <dir path>\addon\openai_req.py
- <dir path>\addon\openai_res.py
- <dir path>\addon\openai_res_sse.pyYou can also specify the scripts at launch using the
-sparameter:mitmweb -s .\openai_req.py -s .\openai_res.py -s .\openai_res_sse.py
- make sure you have tampermonkey extension installed in your browser
- install the tampermonkey script by opening mitmweb-llm-better-view.user.js
- Node.js (v18+)
- npm
git clone https://github.com/sky-bro/mitmproxy-llm-better-view.git
cd mitmproxy-llm-better-view/tampermonkey-script
npm installStart the dev server (uses vite-plugin-monkey):
npm run devThis launches a local dev server. Visit the printed URL in your browser — Tampermonkey will prompt you to install a development version of the script that auto-reloads on code changes.
The script targets http://localhost:8081/* (default mitmweb port). Make sure mitmweb is running before testing.
npm run buildThe compiled userscript is output to dist/mitmweb-llm-better-view.user.js.
tampermonkey-script/
├── src/
│ ├── main.tsx # entry point
│ └── components/
│ ├── openai/ # OpenAI API visualizers
│ └── anthropic/ # Anthropic API visualizers
├── dist/
│ └── mitmweb-llm-better-view.user.js # built userscript
└── vite.config.ts # build config (vite-plugin-monkey)
This uses mitmproxy's contentviews to convert the request body and response content of OpenAI API into Markdown format for better viewing.
Uses JS to fetch data on the page and directly render it within the mitmweb interface for better viewing of LLM API requests and responses.

