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.

v0.15.0发布于 2026-11-09 18:46 UTC3,172star +388 / 7 天311fork同步于 2026-11-10 11:42 UTC

怎么上手

由 README 提炼,执行前请确认
uv tool install reverse-api-engineer
reverse-api-engineer
硬件要求按 README 说明

README 未说明显存或 GPU 要求;安装依赖 cryptography,不再支持 Intel macOS 与 32 位 Windows,需 Linux、Apple Silicon macOS 或 64 位 Windows。agent 模式需 Node.js 20.19+,chrome-mcp 有头运行还需 Chrome 146+。

支持 Apple Silicon
下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

把网站逆向成带类型的 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 便于脚本化集成

容易踩的坑

manual 模式需另装可选依赖并执行 playwright install chromium;chrome-mcp 有头运行需在 chrome://inspect/#remote-debugging 开启自动连接并有人确认弹窗,且不保存 HAR 无法用 engineer 重跑;agent-browser 首次需执行 agent-browser install 拉取 Chromium,C 输出需 POSIX 工具链、PowerShell 输出需 pwsh 7+。

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

5 个版本v0.15.0
  1. 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 /resume and /settings inside 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.0
    

    Manual 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 reported status: ok. Set claude_setting_sources (for example ["user"]) to load chosen layers again, such as when ~/.claude/settings.json provides your authentication. claude-agent-sdk now 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.json files keep the provider they already store; switch with /settings or "agent_provider": "auto" for Playwright MCP with HAR recording.
    • Headed chrome-mcp runs check Chrome auto-connect (DevToolsActivePort plus an open port) before launching and fail with setup steps and error_kind: config_invalid instead of starting the agent. agent --dry-run reports 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 and error_kind: misuse with exit code 2, other runs name the missing HAR path.
    • Pin chrome-devtools-mcp to the 1.12 line and update the chrome-mcp prompt for its pageId tool arguments; the agent now opens its own tab.
    • /resume replays 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 /new first.
    • /settings opens 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.
    • /help says 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-stream tool_start events of Claude runs carry the tool call's call_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 esc stops while keeping the capture. Stopping an OpenCode run aborts its OpenCode session and its subagents, which kept working before.

    Removed

    • /messages: /resume shows a past run's whole conversation, also for a run that saved no session and so cannot continue, and /history its 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 npx launcher, which could leave opencode serve listening.
    • 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
  2. 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.0
    

    Security

    • 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.psm1 module and Example.ps1, with CLI execution through pwsh on 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_windows CI 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=1 on 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 legacy httpx, httpx-sse, and httpcore packages. Add subprocess smoke tests for CLI startup with legacy HTTP client imports blocked.
    • Restore the strict typing fixes from #125 and make the mypy CI 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
  3. 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): httpx was imported at module top level in five modules but never declared as a dependency. It had always arrived transitively through mcp, which required httpx up to 1.x. mcp 2.0 switched to httpx2 and claude-agent-sdk relaxed its pin to mcp<3, so new installs stopped resolving httpx entirely and every CLI invocation died at import time, --version included.

      Environments created before mcp 2.0 kept working, which is why the break only appeared for new users. The package now uses httpx2 (imported as httpx) and declares httpx2>=2.5.0 explicitly, matching what mcp 2.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
    
  4. v0.13.0v0.13.0 - client_executed json-stream event2026-07-27 · 2026-07-27 15:26 UTC
    查看更新说明

    Added

    • client_executed json-stream event (#114): a non-interactive --json/--json-stream run is a single SDK turn end-to-end, so result only 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-stream now 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 engineer and agent; 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/ and design/ trees, or uv.lock — none are needed to build, install, or test the package (README images are served from GitHub, not the tarball). The published .tar.gz drops from ~1.0 MB to ~229 KB. The wheel is unchanged.

    pip install --upgrade reverse-api-engineer
    

    Full Changelog: https://github.com/kalil0321/reverse-api-engineer/compare/v0.12.0...v0.13.0

  5. 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 through npx-launched browser tooling — browser MCP servers (Playwright or Chrome DevTools) or the Vercel agent-browser CLI — and never imports the Python Playwright package. playwright and playwright-stealth moved 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]" (or uv tool install "reverse-api-engineer[manual]") followed by playwright 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/x is treated as https://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

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    Greptile: The War on Bugs

    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

    1. You give it a website and a goal ("fetch all Apple jobs").
    2. A browser visits the site, either driven by you or by an AI agent.
    3. Network traffic is captured to a HAR file.
    4. 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:

    ModeWhat it does
    manualYou drive the browser; AI generates the client from captured traffic.
    agentAn AI agent drives capture autonomously (Playwright or Chrome MCP, or Vercel agent-browser CLI).
    engineerRe-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.
    collectorAgent collects structured data (JSON/CSV) using web search + fetch.

    Agent mode providers:

    • chrome-mcp (default for new configs; an existing config.json keeps 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 at chrome://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-run shows the same check. Headless runs skip it. --headless starts a separate headless Chrome without your sessions. No HAR file is saved, so engineer <run_id> cannot regenerate these runs; run agent again 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-browser is already on PATH, otherwise runs npm install -g <pin> (same pin as config / RAE_AGENT_BROWSER_PACKAGE), prints a yellow notice, validates with --help, and only then falls back to npx -y <pin> if npm cannot install. Prompts embed the resolved shell prefix alongside skills get core --full, skills list, HAR phases, cloud notes from agent_browser_notes. Tune with agent_browser_npx_package (optional), env RAE_AGENT_BROWSER_*. First Chromium fetch: agent-browser install (add --with-deps on 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, or copilot (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.json and auto memory. If ~/.claude/settings.json provides your authentication (apiKeyHelper, or Bedrock, Vertex or proxy variables under env), set claude_setting_sources to 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/starts opencode-ai@latest through npx; a global OpenCode installation is not required. Fresh configurations default to the free opencode/big-pickle model. /settings shows 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 use OPENCODE_SERVER_PASSWORD and optional OPENCODE_SERVER_USERNAME. Override startup with OPENCODE_BASE_URL, RAE_OPENCODE_PACKAGE, or RAE_OPENCODE_AUTO_START=0.
    • Ollama through OpenCode: choose provider ollama in /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 with RAE_OLLAMA_BASE_URL or RAE_OLLAMA_AUTO_START=0.
    • Output language: python, javascript, typescript, go, java, csharp, php, ruby, c, or powershell. C needs a POSIX toolchain (cc, libcurl headers) — macOS/Linux, or WSL/MSYS2 on Windows. PowerShell needs pwsh 7+ (PowerShell Core, not Windows PowerShell 5.1). Its runner executes the generated Example.ps1 beside api_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

    FieldTypeNotes
    schema_versionintCurrently 1.
    status"ok" | "error"Top-level result.
    run_idstring | nullUse with show / engineer / run.
    promptstring
    urlstring | null
    modestring | null"auto", "chrome-mcp", or "agent-browser".
    har_pathstring | nullCaptured HAR.
    script_pathstring | nullGenerated client; exists whenever status is "ok".
    usageobject{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.
    errorstring | nullWhen status == "error".

    Exit codes

    CodeMeaning
    0Success.
    1Runtime error.
    2Missing 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.