AI代码拦截器 是 AI Skill Hub 本期精选AI工具之一。综合评分 7.5 分,整体质量较高。我们推荐使用将其纳入你的 AI 工具库,帮助提升工作效率。
AI代码拦截器 是一款基于 Python 开发的开源工具,专注于 AI、代码拦截、MITM代理 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。
AI代码拦截器 是一款基于 Python 开发的开源工具,专注于 AI、代码拦截、MITM代理 等核心功能。作为 GitHub 开源项目,它拥有活跃的社区支持和持续的版本迭代,代码完全透明可审计,支持本地部署以保护数据隐私。无论是个人使用还是集成到企业工作流,都能提供稳定可靠的解决方案。
# 方式一:pip 安装(推荐)
pip install llm-interceptor
# 方式二:虚拟环境安装(推荐生产环境)
python -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
pip install llm-interceptor
# 方式三:从源码安装(获取最新功能)
git clone https://github.com/chouzz/llm-interceptor
cd llm-interceptor
pip install -e .
# 验证安装
python -c "import llm_interceptor; print('安装成功')"
# 命令行使用
llm-interceptor --help
# 基本用法
llm-interceptor input_file -o output_file
# Python 代码中调用
import llm_interceptor
# 示例
result = llm_interceptor.process("input")
print(result)
# llm-interceptor 配置文件示例(config.yml) app: name: "llm-interceptor" debug: false log_level: "INFO" # 运行时指定配置文件 llm-interceptor --config config.yml # 或通过环境变量配置 export LLM_INTERCEPTOR_API_KEY="your-key" export LLM_INTERCEPTOR_OUTPUT_DIR="./output"
<p align="center"> <strong>🔍 Proxy-layer microscope for LLM traffic analysis</strong> </p>
<p align="center"> A cross-platform command-line tool that intercepts, analyzes, and logs communications between AI coding tools/agents (Claude Code, Cursor, Codex, OpenCode, etc.) and their backend LLM APIs. </p>
---

Git does not copy hooks from .git/hooks when you clone a repository, so each new clone must install the project's pre-commit hook once:
uv sync --dev
uv run lli-dev-setup
If you prefer pip:
pip install -e .[dev]
lli-dev-setup
If you're only capturing HTTP traffic, you can skip this step. Only install the certificate if you need to capture HTTPS requests.
```bash
$ lli watch
╭─────────────────────────╮
│ LLI Watch Mode │
│ Continuous Capture │
╰─────────────────────────╯
Proxy Port: 9090
Output Dir: ./traces (or OS-specific logs directory)
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, [Esc] to CANCEL
<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
```bash 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
If you capture traffic behind a corporate proxy or on a network where upstream servers use a company-signed certificate, you may see TLS errors because the proxy only trusts the system CAs, not your company’s CA. Configure the upstream trust CA so LLI (mitmproxy) can verify connections to the corporate proxy or target hosts:
~/.mitmproxy/mitmproxy-ca-cert.pem as in step 1).```bash
lli watch --upstream-ca-cert /path/to/corporate-ca.pem
```
Use lli config --show to confirm the upstream CA path. If the file does not exist at startup, LLI will exit with an error.
Display configuration and setup help.
lli config --cert-help # Certificate installation instructions
lli config --proxy-help # Proxy configuration instructions
lli config --show # Show current configuration
lli watch --include "my-custom-api.com"
LLM Interceptor (LLI) 是一个跨平台的命令行工具,用于拦截、分析和记录 AI 编码工具/代理 (Claude Code、Cursor、Codex 等) 与其后端 LLM API 之间的通信。
LLI 的功能包括:Watch Mode(交互式持续捕获)、Transparent Inspection(透明检查)、Streaming Support(流式支持)、Multi-Provider(多供应商支持)等。
安装 LLI 需要在开发环境中执行以下命令:uv sync --dev uv run lli-dev-setup 或 pip install -e .[dev] lli-dev-setup
使用 LLI 的步骤包括:设置代理、配置应用程序、启动对话、捕获和分析流量等。
配置 LLI 需要设置代理、环境变量和关键参数,包括 HTTP_PROXY、HTTPS_PROXY 和 NODE_EXTRA_CA_CERTS 等。
CLI Reference 中提供了 LLI 的 API 文档,包括自定义 API 端点的支持。
LLI 的常见问题包括代理设置、流量捕获、TLS 错误等。
功能强大,易于使用和扩展
该工具未明确声明开源协议,商业使用前请联系原作者确认授权范围,避免侵权风险。
AI Skill Hub 为第三方内容聚合平台,本页面信息基于公开数据整理,不对工具功能和质量作任何法律背书。
建议在沙箱或测试环境中充分验证后,再部署至生产环境,并做好必要的安全评估。
经综合评估,AI代码拦截器 在AI工具赛道中表现稳健,质量良好。如果你已有明确的使用需求,可以直接上手体验;如果还在评估阶段,建议对比同类工具后再做决策。
| 原始名称 | llm-interceptor |
| 原始描述 | 开源AI工具:A MITM proxy tool to intercept, analyze and log AI coding assistant (Claude Code。⭐41 · Python |
| Topics | AI代码拦截MITM代理 |
| GitHub | https://github.com/chouzz/llm-interceptor |
| 语言 | Python |
收录时间:2026-06-03 · 更新时间:2026-06-06 · License:未公布 · AI Skill Hub 不对第三方内容的准确性作法律背书。