kalil0321/reverse-api-engineer
The agent that turns websites into APIs!
Reverse API Engineer – Turn a website into a ready‑to‑use API client
What it does
- You point the tool at a web page and tell it what you want (e.g. fetch all Apple jobs).
- It opens a browser, either you control it manually or an AI‑driven “agent” does the navigation.
- While the page loads it records all network requests into a HAR (HTTP Archive) file.
- A language model (Claude, OpenCode, Ollama, Copilot, etc.) reads that traffic and writes a typed client library in the language you choose (Python, JavaScript/TypeScript, Go, Java, C#, PHP, Ruby, or even C).
- The generated client is saved in a folder with a small README and an example script, ready to be imported into your own code.
Why it matters
- Avoid the tedious “open DevTools → copy cURL → hand‑craft request” loop.
- Works for sites that expose undocumented JSON endpoints, letting you treat them like a proper API.
- Supports both interactive capture (you click around) and fully automated capture via an AI agent that can log in, click, scroll, etc.
Installation
# Using uv (recommended) or pip
uv tool install reverse-api-engineer # or pip install reverse-api-engineer
- Agent mode (default) needs only the core package.
- Manual mode requires the optional
[manual]extra and a Playwright Chromium install:
uv tool install "reverse-api-engineer[manual]"
playwright install chromium
Quick start
reverse-api-engineer
> fetch all apple jobs from their careers page
# a browser window opens – navigate, interact, then close
# generated code appears in ./scripts/apple_jobs_api/
You can switch modes on‑the‑fly with Shift+Tab.
Modes
| Mode | How it works |
|---|---|
manual |
You drive the browser; the AI only generates the client after capture. |
agent |
An AI agent drives the browser automatically (Playwright MCP, Chrome‑MCP, or Vercel’s agent-browser). |
engineer |
Re‑run generation on a previously saved HAR capture. |
collector |
The agent also extracts structured data (JSON/CSV) using web search + fetch. |
Configuration
- Settings live in
~/.reverse-api/config.jsonand are editable via the/settingscommand inside the CLI. - You can pick the LLM provider (
claude,opencode,cursor,copilot) and model (e.g.claude‑sonnet‑4‑6). - Output language is selectable (
python,javascript,typescript,go,java,csharp,php,ruby,c). - The tool can start local Ollama or OpenCode servers automatically, or connect to existing ones.
CLI basics
/settings– edit model, SDK, agent provider, output language, etc./history– list past runs with timestamps, token usage, and cost./messages <run_id>– view the full conversation with the model for a run./help– show all commands.- Non‑interactive / scriptable usage via
--jsonand--no-interactiveflags, with JSON output schemas for easy piping tojq.
Output
- Permanent run data:
~/.reverse-api/runs/scripts/<run_id>/ - Friendly copy in your project:
./scripts/<descriptive_name>/ - Collector results:
./collected/<folder>/containingitems.json,items.csv, and a README.
Caveats
- The generated code is produced by a language model; always review it before execution.
- Sites that aggressively block bots may require manual interaction or additional workarounds.
Development
git clone https://github.com/kalil0321/reverse-api-engineer.git
cd reverse-api-engineer
uv sync
uv run reverse-api-engineer
- Build script:
./scripts/clean_build.sh. - Requires Python 3.11+, an API key for the chosen LLM, and (for manual mode) Playwright Chromium.
License – MIT.
Bottom line: Reverse API Engineer is a Python‑based CLI that captures a website’s network traffic, feeds it to a large language model, and spits out a ready‑to‑use typed API client in many popular programming languages. It bridges the gap between web scraping and proper API consumption, leveraging modern LLMs to automate the reverse‑engineering step.
Related
- Project
- Project
- Project
- Project