api-anything README

The project's README from github.com/goodnight000/api-anything. As one markdown file: README.md.

API Anything

CI

Teach your agent a website once. After that, it calls the site like an API instead of driving a browser.

API Anything watches a site's own page make a request and learns which parts of it are your inputs. It saves the result as an operation. Your agent calls that operation with new inputs over MCP, the CLI or TypeScript, and gets JSON back over plain HTTP.

Two agents race on the same Google Flights task: one drives Chrome, one calls API Anything

Same agent (Claude Opus 5.5), same prompt, started together. Left: it drives headless Chrome through Playwright MCP. Right: it calls API Anything's Google Flights operation. Shown at 3× speed with no cuts; the timers show real elapsed time. Recorded 2026-09-28. MP4 · how it was recorded

Median time and cost per task. 1 date: browser 12.9 s and $0.166, API Anything 8.4 s and $0.074. 5 dates: browser 41.6 s and $0.154, API Anything 21.1 s and $0.152.

Across 5 runs of each task, the agent using API Anything answered 1.5 to 2× sooner, read about half as many tokens, and cost the same or less. All 20 answers were correct. Method, raw numbers and limits.

Install

Paste this into Claude Code, Codex or another coding agent:

Set up API Anything for me: https://github.com/goodnight000/api-anything/blob/main/INSTALL.md

The agent checks Node 22.13+, builds and installs the api-anything command, confirms that a call works, then connects the MCP server and the skill to itself. Restart the agent, then ask it something like "What does Goodreads rate Piranesi?"

Install by hand

The package isn't on npm yet. Don't use npm install -g github:..., because it fails under npm 11.

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
{"ok":true,"class":"ok","tier":1,"data":[{"title":"Hosting SQLite databases on GitHub Pages or any static file hoster","url":"https://phiresky.github.io/blog/2021/hosting-sqlite-databases-on-github-pages/", ...}, ...],"ms":111}

tier: 1 means plain HTTP with no browser. A failure returns ok: false with a class, a reason and a next step. Connect an agent with codex mcp add api-anything -- api-anything mcp, claude mcp add --scope user api-anything -- api-anything mcp, or this MCP entry:

{ "mcpServers": { "api-anything": { "command": "api-anything", "args": ["mcp"] } } }

Over MCP an agent calls operations, using four tools: list_sites, list_operations, call_operation and login. To create operations, an agent needs a shell and the skill. Google Chrome is needed only for creating operations and for browser fallback. Setup details.

Teach it a new site

Give it the page URL with a placeholder, and two example 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      # 30 arxiv.org stories, tier 1

Headless Chrome loads the page once for each example. The part of the request that changed with the input becomes a parameter, and the rest is stored as a template. The agent (or you) picks the request and the fields. API Anything builds the template without an LLM. Recorded demos.

Map a site from an intent

Tell an agent what you need from a site. The skill makes it do this, in order:

  1. Ask about whatever the request leaves unclear.
  2. Propose operations and wait for your approval.
  3. Scout each page with capture --outline. This is a summary of what each request returns, so the agent doesn't have to read full responses.
  4. Build each operation and check it with an input that wasn't an example.

Goodreads has had no public API since 2020. One run took 6.3 minutes and $1.19. It produced search, book details, an author's books and reviews:

api-anything call goodreads searchBooks q=piranesi
api-anything call goodreads getBook bookId=50202953
Goodreads, median of 5 runs. 1 book: browser agent 16.8 s and $0.156, API Anything 14.4 s and $0.048. 5 books: browser 182.5 s and $0.122, API Anything 30.5 s and $0.107.

How it was explored, tested and compared.

What's included

22 read operations across 9 sites:

They cover selected features, not whole sites. api-anything ops <site> lists parameters and caveats.

How it works

Details · design

Sessions and logins

For a site that needs an account, api-anything login <site> first tries to import that site's cookies from a browser profile you are already signed in to, so there is usually no password to type. If several profiles are signed in it asks which one, and if none can be imported it opens a Chrome window to sign in by hand. A saved operation holds references to cookies and tokens, never their values, so a refreshed session works without re-learning anything.

A session is kept current where that is possible. Cookies a site sets on a plain-HTTP response, or while API Anything runs the site's page in Chrome, are saved. When a plain-HTTP call comes back unauthorized, API Anything makes one recovery attempt, the first of these that applies:

  1. re-import from the browser profile you chose at login;
  2. take the cookies from its own Chrome profile, if they differ from the saved ones;
  3. for a read that uses session tokens, reload the page so the site issues fresh ones.

If the call is still unauthorized, it returns class: "auth" with the login command to run.

Import reads Chrome, Arc, Brave, Edge, Chromium and Firefox profiles on macOS and Linux (on Linux, not cookies encrypted with the desktop keyring). On Windows, login opens the Chrome window. Details

Limits

All limits

Docs

Benchmark · Demos · Setup for agents · Reference · Design · Release checks · Contributing

MIT licensed.

api-anything (goodnight000/api-anything)

Searching Database…

Что это?API Anything следит, как фронтенд сайта выполняет запрос, определяет, какие части являются вашими входными данными, и сохраняет запрос как операцию. После этого ваш агент вызывает операцию через MCP, CLI или TypeScript и получает обычный JSON вместо управления headless-браузером.
Это размещённый API или что-то, что я запускаю сам?Это локальный инструмент: CLI плюс MCP-сервер, которые работают на вашей машине, используя вашу сеть и ваши браузерные сессии, а не размещённый сервис.
Как установить его и подключить к моему кодинг-агенту?Вставьте сниппет установки в Claude Code, Codex или другого кодинг-агента; он проверит наличие Node 22.13+, соберёт и установит команду api-anything, а затем сам подключит к себе MCP-сервер и skill. Можно также добавить вручную командами 'codex mcp add api-anything -- api-anything mcp' или 'claude mcp add --scope user api-anything -- api-anything mcp'.
Сначала нужно установить Chrome или Node?Да — для сборки и запуска нужен Node 22.13+, а Google Chrome требуется только для создания новых операций и как запасной вариант, когда обычный HTTP-запрос блокируется.
Что будет, если сайт изменится и сломает сохранённую операцию?Инструмент заново изучает запрос и сохраняет новую версию только после успешного повтора; если повтор всё равно не удаётся, вы получите ошибку вместо чужих данных. Решение CAPTCHA не предусмотрено, поэтому если сайт предъявляет проверку настоящему Chrome, придётся пройти её вручную.
Работает ли он на Windows так же, как на macOS и Linux?Импорт cookie работает на macOS и Linux для профилей Chrome, Arc, Brave, Edge, Chromium и Firefox (кроме cookie, зашифрованных в keyring, на Linux); на Windows вход просто открывает окно Chrome вместо импорта cookie.
Где хранятся мои сессии входа и учётные данные?Учётные данные хранятся в ~/.api-anything, а сохранённые операции содержат только ссылки на cookie и токены, но не сами значения, поэтому обновлённая сессия продолжает работать без повторного изучения.
Какие сайты и операции входят в комплект?В комплект входит 22 операции чтения для 9 сайтов, включая Google Flights, Hacker News, X, Instagram, YouTube, Airbnb, Amazon, LinkedIn и Goodreads.
Насколько это быстрее, чем агент, управляющий браузером?В бенчмарке Google Flights тот же агент отвечал в 1,5–2 раза быстрее, читал примерно вдвое меньше токенов и стоил столько же или меньше; на Goodreads он выдал ответ про 5 книг за 30,5 с против 182,5 с у агента, управляющего браузером.
Как он самостоятельно осваивает новый сайт?Вы даёте ему URL страницы с плейсхолдером и два примера входных данных; headless Chrome загружает страницу для каждого примера, изменившаяся часть становится параметром, а остальное — шаблоном, и всё это без использования LLM.
Может ли он выполнять записи на сайт, например отправлять сообщение в LinkedIn?Операции записи в комплект не входят. Для записи нужен флаг --allow-writes, и она проверялась только на локальном fixture, а не на реальных сайтах вроде LinkedIn.
Size
7 MB
Stars
1.2K
Updated
CommitOct 19
Age
23d
Commits · 90 Days