Skip to main content
webrouter is every method as a shell command. It suits scripts, CI jobs and agents that run commands but do not speak MCP (Codex, OpenClaw, Pi, a plain shell loop). Each subcommand calls the public method a library caller would. It validates, routes and fails exactly as the library does.
To try it without installing anything, run it through uvx with the extras the command needs. With no key, search and extract work through the keyless backends:
A bare uvx webrouter installs the core package alone, which has no search or extract backend, so it exits 3 and names the extra to add. Keys come from the environment only, as everywhere else in the library, and the command never reads a .env by itself. Load one into the command’s environment:

Output

stdout is one JSON object: the call’s response, the same model the library returns, serialized. It goes on one line, so it pipes straight into jq. --pretty indents it. The backend’s untouched payload (raw) is left out because it is often the bulk of the response and rarely what a reader wants, on the response and on each item in it, such as every source live-data sources lists. --raw puts it back. A browse response never carries it, so --raw adds nothing there.

Errors and exit status

On failure stdout stays empty, and stderr holds one JSON object:
The exit status says what kind of failure it was, so a script or an agent can branch without reading the message: type is the library’s exception class name. UsageError marks a command line the parser refused.

Commands

Every command but providers takes -p/--provider; omit it and the router picks a backend. search, extract, answer, research and browse also take:
  • --timeout SECONDS: the most the call may wait. Left out, research waits up to 10 minutes and browse up to 15, the library’s defaults.
  • --max-cost USD: refuse a backend whose estimated cost would pass this, before it runs, as a Budget(max_cost_usd=...) does.
  • --option KEY=VALUE: a backend-specific option, repeatable. The value is read as JSON when it parses, so --option max_age=3600 sends a number.
live-data run takes --option too, but no timeout or cost cap, since the library’s live_data() takes neither. Its --input KEY=VALUE always sends text, so an id such as 12345 stays a string; give typed values with --inputs. webrouter COMMAND --help lists every flag, with the values each one accepts. A JSON argument (--schema, --records, live-data run --inputs) is given inline or read from a file with @path:

The command line or the MCP server?

Both expose the same methods. The MCP server suits a client that speaks MCP. It narrows each tool’s options to the backends configured on your machine, shortens results to fit a context window, and keeps browser sessions open between calls. The command line suits anything that runs a shell. Each call is self-contained, so there are no browser_* commands: a browser session outlives a single process. Drive one from the library or the MCP server.