← Back to archive

Repo of the Day

goodnight000/api-anything: Turn any website into an API your agent can call. Learns from the site's own frontend, heals itself when the site changes.

Published: Oct 14, 2026

Open repository ↗

Turn any website into an API your agent can call. Learns from the site's own frontend, heals itself when the site changes. - goodnight000/api-anything

Summary

API Anything is a TypeScript tool that turns a website into a callable API for AI agents. It learns operations by recording a headless browser's network traffic across two example inputs, then lets agents invoke those operations via MCP, CLI, or TypeScript over plain HTTP. The repository ships 22 pre-built read operations across 9 sites and can re-learn an operation when it breaks.

What it is useful for

API Anything is useful when you want an LLM agent to retrieve structured data from a site without paying the time and token cost of driving a full browser on every request. The tool captures the underlying HTTP request once, then replays it as a fast JSON call.

Concrete scenarios documented in the README:

  • Replacing Playwright-style browsing for routine reads such as Hacker News link lists, YouTube search, Google Flights search, or Amazon/Airbnb search.
  • Reading Goodreads, which lost its public API in 2020. The README describes an "explorer" run that produced search, book details, author lists, and reviews, with all 146 follow-up calls going over plain HTTP.
  • Sites behind a login: api-anything login <site> imports cookies from a Chrome, Arc, Brave, Edge, Chromium, Vivaldi, or Firefox profile you are already signed into, so the agent reuses your session without typing a password. Saved operations hold references to cookies and tokens, not their values, so a refreshed session keeps working.

Documented limits to be aware of:

  • It only knows operations it was taught; it does not cover every feature of every site.
  • Repair can fail. There is no CAPTCHA solving, and if a site challenges Chrome you must clear it by hand.
  • Bundled ops are read-only. Writes are tested only against a local fixture and require --allow-writes; an HTTP 2xx does not prove a message was delivered.
  • It is a local tool running on your machine with your sessions; credentials live in ~/.api-anything. The README states you are responsible for how you use it under each site's terms.

How engineers can use it

The README documents two install paths.

Agent-driven install:

  1. Ask Claude Code or Codex: "Set up API Anything for me: https://github.com/goodnight000/api-anything/blob/main/INSTALL.md".
  2. The agent checks Node 22.13+, builds and installs the api-anything command, verifies a call works, then wires up the skill and MCP server.
  3. Restart the agent and ask a real question, e.g., "What does Goodreads rate Piranesi?".

Manual install (the package is not on npm yet, and the README warns against npm install -g github:...):

git clone https://github.com/goodnight000/api-anything.git && cd api-anything
npm ci && npm install -g "$(npm pack --silent)"
api-anything call hacker-news search query=sqlite

A working call returns {"ok":true,"class":"ok","tier":1,...}. tier: 1 means plain HTTP with no browser. A failure returns ok: false with a class, reason, and next step.

To expose operations to an agent, add the MCP server:

codex mcp add api-anything -- api-anything mcp
claude mcp add --scope user api-anything -- api-anything mcp

Over MCP the agent gets four tools: list_sites, list_operations, call_operation, and login.

To teach it a new site, define an operation with a placeholder URL and two inputs:

api-anything add hn-demo links \
  --trigger 'https://news.ycombinator.com/from?site={domain}' \
  --example domain=github.com --example2 domain=github.io --match path=/from \
  --html '{"items":"tr.athing","fields":{"title":".titleline > a","url":".titleline > a@href"}}'

api-anything call hn-demo links domain=arxiv.org

The browser loads the page once per example; the part of the request that changes with the input becomes a parameter, and the rest is stored as a template. If a call later fails (for example, a rotated id or moved field), API Anything re-learns it and only saves the new version after a replay succeeds, otherwise it returns an error rather than someone else's data.

api-anything ops <site> lists the parameters and caveats for each built-in site. Further reference material lives in docs/REFERENCE.md and the design notes in docs/DESIGN.md.