anyapi-cli with the anyapi binary.
Use it to install agent skills, register MCP, mint or store a key, discover APIs, and
run SKUs from a terminal.
Install
Run the one-line setup:anyapi init installs the AnyAPI agent skills into detected agents, offers MCP
registration, and mints a free trial key if no key is available.
For a global binary:
Commands
anyapi search uses the dedicated ranked catalog search, which takes any
non-empty combination of a query, --category, and --platform: naming only a
scope is a complete search, and ranking falls back from semantic to keyword.
anyapi list only browses the catalog and accepts an optional category. Both commands display the
customer-safe USD offer returned by discovery; they never expose an internal
accounting unit or upstream provider.
Static discovery pricing is nested. pricing.from is either a flat offer
(model, unit: "request", maxUsd, maxPer1kUsd) or a linear offer (model,
unit, baseUsd, perUnitUsd, maxUsd, maxPer1kUsd). pricing.failoverMaxUsd
is the greatest fallback ceiling, published beside its per-1,000-request twin
pricing.failoverMaxPer1kUsd. The optional failover boolean reports whether AnyAPI
currently has an alternate route. Use the displayed unit when estimating a linear
call, or run anyapi describe <sku> to inspect the complete offer before execution.
Every maximum arrives in two denominations: maxUsd for one request and
maxPer1kUsd for 1,000 of them. Per 1,000 requests is the denomination AnyAPI
quotes customers in, because most of the catalog costs a fraction of a cent per call
and per-request figures cannot be compared by eye. Read the published per-1k field
instead of multiplying maxUsd, which drifts in floating point (0.0966 * 1000 is
96.60000000000001 in most languages). baseUsd and perUnitUsd have no per-1k
twin, because they are charged per billable item inside one call, and the costUsd of
a completed run and the balance from anyapi balance stay per request.
Gateway and CLI responsibilities
The gateway owns input validation, provider normalization, pricing, lane order, routing, failover, health semantics, and billing. The CLI is a thin transport and presentation adapter. It projects the discovery fields it displays, tolerates safe new fields, and preserves input and output schemas as opaque JSON. Treatpricing.from, pricing.failoverMaxUsd, failover, and lane order as
gateway-published facts. The CLI does not derive them from one another or repair
their relationships.
Authentication
The CLI resolves auth in this order:--api-keyflagANYAPI_API_KEYenvironment variable~/.anyapi/config.json- Interactive self-signup for commands that require auth
ANYAPI_API_KEY. Do not make production app code depend
on ~/.anyapi/config.json.
Sign in to an account
Runanyapi login to use account-backed OAuth immediately:
~/.anyapi/config.json after approval, then refreshes the account session
automatically before the access token expires.
This device flow does not bind a localhost callback. It is separate from
anyapi connect, which upgrades a saved free trial and preserves its trial receipt.
To use an existing dashboard key without OAuth, store it locally:
Self-signup
Useanyapi signup to call the same self-signup endpoint documented in
Let your agent onboard itself:
~/.anyapi/config.json, and prints trial
guidance. It does not print the secret key unless you pass --show-key. The trial key
carries a budget of about $0.05, creates no account, and self-expires in 7 days.
Run output
By default,anyapi run writes JSON to:
costUsd, and item count. Use --json to print the
response JSON to stdout instead, or -o path to choose the output file.
The gateway normalizes the successful response. The CLI preserves the output object
as customer data instead of recursively deleting or rewriting its keys.
For a long-running API, the CLI waits and polls the returned Request by default. Pass --no-wait
to return its Request ID immediately. If you press Ctrl-C after acceptance, the CLI prints the
anyapi requests wait <request-id> command you can use to resume. Automatic idempotency uses a
fresh random key for each logical CLI invocation.
Context-budget flags
Use these flags when a result would be too large for an agent context window:
These flags trim only what is returned to you. They do not change the amount charged.
costUsd reflects the full result the API produced.
402 and upgrading past the trial
A free trial key is capped at about $0.05 of requests. When the trial budget is spent, a run returns402 trial_cap_reached. To keep going, connect a wallet (anyapi-cli >= 0.3.0):
anyapi login --api-key aa_live_... instead.