manual 模式需另装可选依赖并执行 playwright install chromium;chrome-mcp 有头运行需在 chrome://inspect/#remote-debugging 开启自动连接并有人确认弹窗,且不保存 HAR 无法用 engineer 重跑;agent-browser 首次需执行 agent-browser install 拉取 Chromium,C 输出需 POSIX 工具链、PowerShell 输出需 pwsh 7+。
reverse-api-engineer
kalil0321MIT活跃维护把任意网站逆向成带类型定义的 API 客户端,配合 Claude Code、Cursor 等编码助手直接生成可调用的接口代码。
Reverse engineer any website into a typed API client. Works with Claude Code, Codex, Cursor and OpenCode.
uv tool install reverse-api-engineer
reverse-api-engineerREADME 未说明显存或 GPU 要求;安装依赖 cryptography,不再支持 Intel macOS 与 32 位 Windows,需 Linux、Apple Silicon macOS 或 64 位 Windows。agent 模式需 Node.js 20.19+,chrome-mcp 有头运行还需 Chrome 146+。
把网站逆向成带类型的 API 客户端,省去手动翻 DevTools 抄 cURL 的功夫
把任意网站逆向成带类型定义的 API 客户端,配合 Claude Code、Cursor 等编码助手直接生成可调用的接口代码。
核心能力
- 浏览器抓包生成 HAR,再由模型据此写出可运行客户端
- 支持 Python、TypeScript、Go、Java、C#、PHP、Ruby 等十余种输出语言
- manual 模式自己操作浏览器,agent 模式由 AI 自主抓取
- engineer 模式可对已有抓包重跑生成,collector 模式采集结构化数据
- 提供 agent/list/show/run 等子命令,--json 便于脚本化集成
容易踩的坑
- v0.15.0v0.15.0 - Full-screen session, /resume and Claude 5.5 models最新正式版2026-11-09 · 2026-11-09 18:46 UTC
A full-screen interactive session for every mode and SDK (agent, engineer, manual capture, collector; Claude, OpenCode, Copilot, Cursor) with
/resumeand/settingsinside it, Claude 5.5 models with configurable effort, Claude sessions isolated from your Claude Code setup, OpenCode cost and subagent fixes, and security updates (Playwright 1.64.1 with Chromium 156, a pinned Playwright MCP).Published on PyPI. The attached wheel and source distribution are byte-for-byte identical to the PyPI files; SHA-256 checksums are attached.
pip install --upgrade reverse-api-engineer==0.15.0Manual capture users: after upgrading, run
playwright install chromium.Changed
- Claude sessions are isolated from your Claude Code setup (#141): they no longer load your settings files,
CLAUDE.md, hooks, plugins, permission rules or MCP servers, which could derail a run while it still reportedstatus: ok. Setclaude_setting_sources(for example["user"]) to load chosen layers again, such as when~/.claude/settings.jsonprovides your authentication.claude-agent-sdknow needs 0.2.174 or later. - The Copilot SDK is now 1.0.
- chrome-mcp is the default agent provider for new configurations. Existing
~/.reverse-api/config.jsonfiles keep the provider they already store; switch with/settingsor"agent_provider": "auto"for Playwright MCP with HAR recording. - Headed chrome-mcp runs check Chrome auto-connect (
DevToolsActivePortplus an open port) before launching and fail with setup steps anderror_kind: config_invalidinstead of starting the agent.agent --dry-runreports the same check as an error. engineer <run_id>on a run without a HAR stops before starting a model session: chrome-mcp runs get an explanation anderror_kind: misusewith exit code 2, other runs name the missing HAR path.- Pin
chrome-devtools-mcpto the 1.12 line and update the chrome-mcp prompt for itspageIdtool arguments; the agent now opens its own tab. /resumereplays the run's conversation the way it looked live (prompts, steps, the agent's messages, the client card) before it waits for the follow-up, and switches from a conversation that only waits for one instead of asking for/newfirst./settingsopens inside the session: one list with the settings rae offers there (SDK, agent provider, models, output and sync) and their values, enter flips a toggle or opens its choices, long lists filter as you type, and each change shows as◇ setting old → new. OpenCode's providers and models load behind a list that keeps keystrokes from starting a run. The classic settings screen is gone./helpsays what rae does and lists the modes (the current one marked), every command and every key.- Lists and the command menu go around: down on the last item moves to the first, up on the first to the last.
- A blank line parts the conversation from the input bar.
--json-streamtool_startevents of Claude runs carry the tool call'scall_id, as Cursor runs' already did.- Manual capture, the collector and OpenCode runs stay in the full-screen session instead of switching to the plain terminal. During a manual capture, closing the browser starts the engineering and
escstops while keeping the capture. Stopping an OpenCode run aborts its OpenCode session and its subagents, which kept working before.
Removed
/messages:/resumeshows a past run's whole conversation, also for a run that saved no session and so cannot continue, and/historyits details.
Fixed
- An OpenCode server started by rae stops with rae even when rae is killed or its terminal is closed, and its whole process tree stops, not only the
npxlauncher, which could leaveopencode servelistening. - In tool output, a line of binary data (such as a compressed response body) shows as "(binary data)", and a long line in a diff is cut instead of wrapping to the left edge.
- The
- Claude sessions are isolated from your Claude Code setup (#141): they no longer load your settings files,
- v0.14.0v0.14.0 - PowerShell support and Windows compatibility2026-09-23 · 2026-09-23 21:15 UTC
查看更新说明
PowerShell 7+ client generation, Windows encoding and launcher fixes, and dependency security updates.
Published on PyPI. The attached wheel and source distribution are byte-for-byte identical to the PyPI files; SHA-256 checksums are attached.
pip install --upgrade reverse-api-engineer==0.14.0Security
- Refresh vulnerable website transitive dependencies, including js-yaml, nanoid, undici, brace-expansion and Miniflare's Sharp dependency, with patched lockfile versions and overrides.
- Upgrade the website to Next.js 16.3.3 and its Sharp image-processing dependency to 0.35.4 to address known vulnerabilities.
Added
- PowerShell 7+ output: generate an
api_client.psm1module andExample.ps1, with CLI execution throughpwshon Windows, macOS, and Linux. - Live client validation: an opt-in local test captures a fixture API, generates a Python or PowerShell client with a verified free OpenCode model, and checks fresh API data on replay. The manual
live_windowsCI option validates both languages using preinstalled Chrome and cached Python/npm dependencies, without downloading Chromium. Regular CI requires real PowerShell execution and CLI startup checks across all three operating systems.
Fixed
- Windows encoding and launch compatibility (#134): read prompts and persisted text as UTF-8; accept optional UTF-8 BOMs in configuration, history and HAR files; retain readable message records around corrupt lines and replace session history atomically to preserve the previous file if saving is interrupted. Preserve Unicode client output, including Python dependency-install retries, and report unsupported batch launch configurations accurately in JSON output.
- Resolve Chrome profiles for Windows and Linux, pass npm/npx arguments through native Node entrypoints, and use the Maven project working directory to avoid passing special directory characters through batch arguments. Unsafe nonstandard batch launchers fail explicitly.
- Stop the managed OpenCode process tree on Windows so shutdown releases its listening port. Add native Windows regression coverage and dedicated Chrome capture/shutdown plus Python/PowerShell generation and fresh-response replay checks.
- Expose unexpected agent capture tracebacks through
RAE_DEBUG=1on stderr, without adding diagnostics to JSON/NDJSON stdout. - Keep the website header pinned to the viewport during rapid scrolling on the homepage and documentation pages, while preserving the content offset. Add browser regression coverage to the website deployment workflow.
- PowerShell execution validation: reject unsupported module names, missing
Example.ps1, and script arguments that the example cannot forward, rather than silently running a different command. Generation instructions require portable module imports and terminating errors so failed API calls produce a nonzero exit status. - Refresh the locked Claude Agent SDK and MCP dependencies so the development environment also uses MCP 2.x and
httpx2, without the legacyhttpx,httpx-sse, andhttpcorepackages. Add subprocess smoke tests for CLI startup with legacy HTTP client imports blocked. - Restore the strict typing fixes from #125 and make the
mypyCI job blocking. The original PR landed on an intermediate branch after its promotion PR had already merged, so the changes had not reached main. - Raise security minimums to Click >=8.3.3, aiohttp >=3.14.3, cryptography >=50.0.0, AnyIO >=4.14.2, PyJWT >=2.13.0, python-multipart >=0.0.31, Starlette >=1.3.1, HTTPX2 >=2.12.0 (which requires the patched HTTPCore2), and Markdownify >=0.14.1 / SoupSieve >=2.9.0 (collector extra). Export these floors in package metadata so upgrades cannot retain vulnerable versions that only the repository lockfile excluded.
- Report agent provider runs that produce no result as failures: JSON/NDJSON emits an error result, and plain output prints the error to stderr
- v0.13.1v0.13.1 - Fix missing httpx dependency on fresh installs2026-08-30 · 2026-08-30 14:32 UTC
查看更新说明
Fixed
-
ModuleNotFoundError: No module named 'httpx'on a fresh install (#122):httpxwas imported at module top level in five modules but never declared as a dependency. It had always arrived transitively throughmcp, which requiredhttpxup to 1.x.mcp2.0 switched tohttpx2andclaude-agent-sdkrelaxed its pin tomcp<3, so new installs stopped resolvinghttpxentirely and every CLI invocation died at import time,--versionincluded.Environments created before
mcp2.0 kept working, which is why the break only appeared for new users. The package now useshttpx2(imported ashttpx) and declareshttpx2>=2.5.0explicitly, matching whatmcp2.x already pulls in rather than installing a second HTTP client alongside it.
Upgrade:
uv tool upgrade reverse-api-engineer # or: pip install -U reverse-api-engineer -
- v0.13.0v0.13.0 - client_executed json-stream event2026-07-27 · 2026-07-27 15:26 UTC
查看更新说明
Added
-
client_executedjson-stream event (#114): a non-interactive--json/--json-streamrun is a single SDK turn end-to-end, soresultonly fires once the whole turn is over — a caller watching the stream had no earlier way to know a working, live-verified client already existed, even when the agent spent a long tail of that turn on unrelated busywork.--json-streamnow emits{"event": "client_executed", "script_path": "..."}as soon as the agent successfully runs the generated client with its own language-specific run command, giving wrapper scripts a signal they can bound cost and time against.Emitted for both
engineerandagent; Claude SDK only (OpenCode/Copilot/Cursor have separate streaming handlers). See the scripted usage docs.
Changed
- Slimmer source distribution: the sdist no longer ships the repo's binary banner/demo assets, the
examples/anddesign/trees, oruv.lock— none are needed to build, install, or test the package (README images are served from GitHub, not the tarball). The published.tar.gzdrops from ~1.0 MB to ~229 KB. The wheel is unchanged.
pip install --upgrade reverse-api-engineerFull Changelog: https://github.com/kalil0321/reverse-api-engineer/compare/v0.12.0...v0.13.0
-
- v0.12.0v0.12.0 - Lightweight base install (Playwright now optional)2026-07-22 · 2026-07-22 21:53 UTC
查看更新说明
Changed
-
Playwright is now an optional
[manual]extra. Agent mode (the default) captures throughnpx-launched browser tooling — browser MCP servers (Playwright or Chrome DevTools) or the Vercelagent-browserCLI — and never imports the Python Playwright package.playwrightandplaywright-stealthmoved out of the base dependencies into a[manual]optional-dependency group, so the base install (and any runtime that bundles the package) stays lightweight.Manual capture users: install with
pip install "reverse-api-engineer[manual]"(oruv tool install "reverse-api-engineer[manual]") followed byplaywright install chromium. Agent mode needs neither. Entering manual mode without the extra fails fast with an actionable hint and records no run.
Fixed
- Manual capture no longer wedges the REPL after a failed start: a mistyped or scheme-less URL previously left Playwright's event loop running, so every later prompt spun on
asyncio.run() cannot be called from a running event loop. The browser is now torn down on a failed start. - Scheme-less capture URLs are accepted — a bare host like
jobs.example.com/xis treated ashttps://jobs.example.com/x. - CLI error text with brackets renders in full (e.g.
reverse-api-engineer[manual]is no longer swallowed as Rich markup).
Full changelog: https://github.com/kalil0321/reverse-api-engineer/blob/main/CHANGELOG.md
-
用户点评
登录用户的真实使用记录,可按版本和硬件筛选还没有人点评。第一个说出真实体验的人最有价值。
Reverse API Engineer
Turn websites into APIs. Browse (or let an agent browse), and get a clean, typed client for the endpoints the site actually uses.
How it works
- You give it a website and a goal ("fetch all Apple jobs").
- A browser visits the site, either driven by you or by an AI agent.
- Network traffic is captured to a HAR file.
- Your configured model reads the traffic and writes a working API client in Python, JavaScript, TypeScript, Go, Java, C#, PHP, Ruby, C, or PowerShell.
No more manually opening DevTools, copying cURL commands, and gluing together a client.
Install
uv tool install reverse-api-engineer # or: pip install reverse-api-engineer
The secured cryptography dependency no longer supports Intel macOS or 32-bit Windows. Use Linux (including on Intel hardware), Apple Silicon macOS, or 64-bit Windows. Installing on the retired platforms may attempt an unsupported source build requiring Rust and OpenSSL development tools; this is not a supported installation path. Do not downgrade cryptography to restore old wheels. See the upstream platform changes.
Agent mode (the default) captures through npx-launched browser tooling —
browser MCP servers (Playwright or Chrome DevTools) or the Vercel agent-browser
CLI — and needs no extra Python packages. Manual mode drives a local
Playwright browser, which ships in the optional [manual] extra:
uv tool install "reverse-api-engineer[manual]" # or: pip install "reverse-api-engineer[manual]"
playwright install chromium
Use it from your coding agent
Install the skill so Claude Code, Codex, Cursor, OpenCode and other agents know how to drive the CLI:
npx skills add kalil0321/reverse-api-engineer
Then ask your agent for what you need, for example "get me a typed client for the job search on this careers page". The skill lives in skills/reverse-api-engineer.
Quick start
reverse-api-engineer
> fetch all apple jobs from their careers page
# Browser opens. Navigate, interact, close when done.
# → ./scripts/apple_jobs_api/ (api_client.py, README.md, example_usage.py)
Cycle modes with Shift+Tab:
| Mode | What it does |
|---|---|
manual | You drive the browser; AI generates the client from captured traffic. |
agent | An AI agent drives capture autonomously (Playwright or Chrome MCP, or Vercel agent-browser CLI). |
engineer | Re-run generation on a previous capture (engineer <run_id>). Needs a HAR, so it works on auto, agent-browser and manual runs, not chrome-mcp runs. |
collector | Agent collects structured data (JSON/CSV) using web search + fetch. |
Agent mode providers:
- chrome-mcp (default for new configs; an existing
config.jsonkeeps its provider): drives your real Chrome so you keep existing sessions/cookies. Needs Node.js 20.19+; headed runs also need Chrome 146+ open with auto-connect enabled atchrome://inspect/#remote-debugging, and someone at the machine to accept Chrome's connection prompt when the run starts. For headed runs, rae checks before launching that Chrome's remote debugging port is reachable (not the Chrome or Node version) and stops with setup steps if it isn't;agent --dry-runshows the same check. Headless runs skip it.--headlessstarts a separate headless Chrome without your sessions. No HAR file is saved, soengineer <run_id>cannot regenerate these runs; runagentagain instead. - auto: Playwright MCP, records a HAR and needs no Chrome setup.
- agent-browser: Vercel agent-browser CLI (not a Reverse API Engineer browser MCP server). At session start RAE uses whatever
agent-browseris already onPATH, otherwise runsnpm install -g <pin>(same pin as config /RAE_AGENT_BROWSER_PACKAGE), prints a yellow notice, validates with--help, and only then falls back tonpx -y <pin>if npm cannot install. Prompts embed the resolved shell prefix alongsideskills get core --full,skills list, HAR phases, cloud notes fromagent_browser_notes. Tune withagent_browser_npx_package(optional), envRAE_AGENT_BROWSER_*. First Chromium fetch:agent-browser install(add--with-depson trimmed Linux).
Optional sanity checks:
agent-browser doctor --offline --quick || true
agent-browser skills list >/dev/null
Configuration
Settings live in ~/.reverse-api/config.json and can be edited via /settings in the CLI:
{
"agent_provider": "chrome-mcp",
"agent_browser_npx_package": "agent-browser@0",
"agent_browser_notes": "",
"claude_code_model": "claude-sonnet-4-6",
"claude_setting_sources": [],
"collector_model": "claude-sonnet-4-6",
"ollama_auto_start": true,
"ollama_base_url": "http://127.0.0.1:11434",
"opencode_auto_start": true,
"opencode_base_url": "http://127.0.0.1:4096",
"opencode_model": "big-pickle",
"opencode_npx_package": "opencode-ai@latest",
"opencode_provider": "opencode",
"copilot_model": "gpt-5",
"cursor_model": "composer-2.5",
"output_dir": null,
"output_language": "python",
"real_time_sync": true,
"sdk": "claude"
}
- Models: Sonnet 5.5, Opus 5.5 (most capable), Opus 4.6 and Haiku 5.5 (fastest). Sonnet 4.6 stays the default until you choose another; it and Haiku 4.5 are still accepted in config and by
--model. For OpenCode see models.dev. - SDK:
claude(default),opencode,cursor, orcopilot(GitHub Copilot). - Claude settings isolation: Claude sessions don't load your Claude Code settings files,
CLAUDE.md, hooks, plugins, permission rules or MCP servers, so your personal setup doesn't steer the agent. Organization-managed policy still applies, and Claude Code still reads its own state such as~/.claude.jsonand auto memory. If~/.claude/settings.jsonprovides your authentication (apiKeyHelper, or Bedrock, Vertex or proxy variables underenv), setclaude_setting_sourcesto the layers to load, e.g.["user"]or["user", "project", "local"]. Each layer you list is loaded in full, including its hooks, plugins, permission rules and MCP servers. - OpenCode setup: with
sdk: "opencode", RAE reuses an existing server or downloads/startsopencode-ai@latestthroughnpx; a global OpenCode installation is not required. Fresh configurations default to the freeopencode/big-picklemodel./settingsshows a loading list, then offers a searchable opencode provider / model list populated from the server's connected, tool-capable catalog and marks free OpenCode options. Before creating a session, RAE validates the saved pair again and suggests currently available free models when configuration is invalid. Compatible older servers are reused with a version warning. Node.js 20+ is required for automatic startup. Password-protected servers useOPENCODE_SERVER_PASSWORDand optionalOPENCODE_SERVER_USERNAME. Override startup withOPENCODE_BASE_URL,RAE_OPENCODE_PACKAGE, orRAE_OPENCODE_AUTO_START=0. - Ollama through OpenCode: choose provider
ollamain/settings; RAE starts an installed Ollama daemon if needed, lists only installed models with tool calling and 64k+ context, and supplies OpenCode's provider config inline. Models are never downloaded silently. Override withRAE_OLLAMA_BASE_URLorRAE_OLLAMA_AUTO_START=0. - Output language:
python,javascript,typescript,go,java,csharp,php,ruby,c, orpowershell. C needs a POSIX toolchain (cc, libcurl headers) — macOS/Linux, or WSL/MSYS2 on Windows. PowerShell needspwsh7+ (PowerShell Core, not Windows PowerShell 5.1). Its runner executes the generatedExample.ps1besideapi_client.psm1; argument overrides are not supported. Edit the example or import the module to call its exported functions with your own arguments.
CLI
reverse-api-engineer opens a full-screen session; agent, engineer and collector open it too when run in a terminal (agent and engineer stay plain with --json or --no-interactive). Type / for the commands:
/model,/effort,/mode: switch the model, how hard it thinks, and the mode (also Shift+Tab, ctrl+e)./settings: SDK, agent provider, models, output and sync, changed in place in the session./history: past runs with their details, to resume or re-engineer./resume [run_id]: show a past run's conversation as it was and continue it where it stopped, on any SDK. Works for agent and engineer runs from this version on, which save their SDK session. Collector runs cannot be resumed./output(ctrl+o): everything from the session, unfolded./open: the latest client./help(or/commands): what rae does, its modes, commands and keys./new,/clear,/exit(or/quit).
Scriptable subcommands (pipe to jq):
reverse-api-engineer agent --prompt "capture the public jobs api" \
--url https://example.com/jobs --json | jq
reverse-api-engineer list --json
reverse-api-engineer show <run_id> --json
reverse-api-engineer run <run_id> --file api_client.py \
--no-interactive --auto-install -- --org acme
Pass --no-interactive (and/or --json) to skip prompts. With --json, stdout is one JSON document and logs go to stderr.
agent --json schema
| Field | Type | Notes |
|---|---|---|
schema_version | int | Currently 1. |
status | "ok" | "error" | Top-level result. |
run_id | string | null | Use with show / engineer / run. |
prompt | string | |
url | string | null | |
mode | string | null | "auto", "chrome-mcp", or "agent-browser". |
har_path | string | null | Captured HAR. |
script_path | string | null | Generated client; exists whenever status is "ok". |
usage | object | {input_tokens, output_tokens, cache_read_tokens, cache_write_tokens, total_cost_usd}, each present only when the SDK reports it, plus the SDK's own usage under raw. |
error | string | null | When status == "error". |
Exit codes
| Code | Meaning |
|---|---|
0 | Success. |
1 | Runtime error. |
2 | Missing required arg under --no-interactive / --json. |
For run, the exit code is the underlying script's return code on success, 1 if no script was found, or non-zero if --no-interactive would have had to prompt.
Debugging agent failures
Set the RAE_DEBUG environment variable to 1 to print the Python traceback
for unexpected agent capture failures to stderr. Normal error messages remain
concise by default, and --json / --json-stream stdout remains machine-readable.
Output locations
~/.reverse-api/runs/scripts/{run_id}/: permanent storage./scripts/{descriptive_name}/: local copy with a readable name- Collector:
./collected/{folder_name}/(items.json,items.csv,README.md)
Caveats
- Generated code runs locally via Claude Code, so review before executing.
- Sites with aggressive bot detection may block capture or require manual interaction.
Development
git clone https://github.com/kalil0321/reverse-api-engineer.git
cd reverse-api-engineer
uv sync
uv run reverse-api-engineer
Build: ./scripts/clean_build.sh. Requires Python 3.11+ and an API key for agent mode. Manual mode additionally needs the [manual] extra plus playwright install chromium.
License
MIT. See LICENSE.