@anyway-sh/cli on npm
View package on npm
Installation
Quick Start
Authentication
The CLI uses three auth modes, depending on the command:- Merchant auth (
anyway login) — JWT-based; required by most commands (products, orders, wallets, dashboard, developer, traces, and the merchant-side agent-wallet operations likecreate/list/reset). - Agent key (
ANYWAY_AGENT_WALLET_KEYenv var or a local record fromwallets agents import) — P-256 keypair-based; used by the agent-runtime commands underwallets agents(whoami/history/policies/pay/sign), bysuperapi call, and byimportitself. These do NOT needanyway login. - Local — file-only operations on
~/.anyway/agents/*, used bydefaultandforget.
Merchant login
~/.anyway/credentials.json and auto-refreshed.
For headless environments (SSH / CI / agents), anyway login --non-interactive runs a non-blocking device flow instead of opening a browser:
--continue / --restart imply --non-interactive, and a non-TTY stdin (piped / CI / agent) selects it automatically — so the flag is optional in those environments. Output follows --format as with any command: add --format json for a single JSON line (the default is a readable summary). An anyway login --token <b64> paste path remains as a fallback.
Agent runtime auth (for AI agents)
If you’re running the CLI as an AI agent that already owns an Agent Wallet, set the key bundle from the dashboard’s reveal dialog as an env var — noanyway login needed:
/v1/agent-wallet/*):
--format json for machine-parseable output. See wallets agents below for the full surface (including merchant-only operations like create).
Commands
products
orders
wallets
wallets agents
Manage Agent Wallets and operate as an agent runtime. Eleven subcommands across three independent auth paths — pick the column that matches what you have.
| Command | Description | Auth |
|---|---|---|
create [--name <n>] [--non-interactive] [--continue] [--restart] | Create a new agent wallet. Interactive opens the dashboard for Privy signing and saves the verified key locally. --non-interactive runs the same non-blocking begin / continue / restart device flow as login (see Merchant login) — the session and its ephemeral decryption key persist under ~/.anyway/device/ so --continue can run in a fresh process. A non-TTY stdin selects the non-interactive flow automatically. | merchant |
list [--local] [--offline] [--format=table|json] | Without --local: org-wide merchant view of every agent wallet. With --local: only the agent records you’ve imported locally; each row is refreshed by hitting the agent-runtime endpoint with that agent’s key. Add --offline to skip the network and show file state only. | merchant (default) / agent key (--local) / local (--local --offline) |
reset <agentId> [--non-interactive] [--continue] [--restart] | Rotate this agent’s signing key in place (same agentId, refreshed key). --non-interactive (also implied by a non-TTY stdin) runs the same non-blocking begin / continue / restart device flow as create; on approval it verifies and replaces the local key for that agent id. | merchant |
import --token <bundle> (alias: adopt) | Verify an Agent Wallet Key bundle and save/replace the local record in ~/.anyway/agents/ | agent key |
whoami [<agentId>] | Server’s view of this agent (id, name, wallet id, wallet address, public key) | agent key |
history [<agentId>] [--limit N] | Activity log for the agent (default 50, max 200) | agent key |
policies [<agentId>] | Spending policies attached to the agent’s wallet | agent key |
pay --to <0x> --amount <usdc> | Sign a USDC payment authorization for x402 PAYMENT-SIGNATURE | agent key |
sign --typed-data-file <path> | Sign arbitrary EIP-712 typed data | agent key |
default <agentId> (alias: use) | Set the default local agent record | local |
forget <agentId> [--yes] | Delete the local agent record | local |
- merchant — needs
anyway login. These commands manage the wallet itself (create/list(default) /reset) and require browser interaction forcreate/reset(they cannot be completed by an AI agent alone — share the printed URL with the wallet owner).list --localdoes not need merchant auth — see below. - agent key — needs
ANYWAY_AGENT_WALLET_KEYenv var or a record imported viaimport.importverifies the bundle throughGET /v1/agent-wallet, saves it locally, and replaces a stale local key after dashboard reset. Use this in agent runtimes (Claude / Codex / CI). Does NOT needanyway login. - local — touches only
~/.anyway/agents/*. No network, no auth.
superapi
superapi call is the wrapped x402 purchase path for agent runtimes. It sends the initial request, decodes the PAYMENT-REQUIRED challenge, shows the quote, signs with the selected Agent Wallet after confirmation, retries with PAYMENT-SIGNATURE, and prints the API result. Use --yes or -y to skip the prompt in CI/agent runtimes. It uses agent-key auth and does not need anyway login. Agent Wallet is the default payment source; --pay-with agent-wallet is accepted for compatibility but is not required.
Each command’s --help prints its full flag list, examples, and auth requirement — e.g. anyway wallets agents pay --help shows the lower-level --format json output used as inputs when manually assembling an x402 PAYMENT-SIGNATURE envelope. For the end-to-end CLI purchase path, see SuperAPI → By Anyway CLI.
dashboard
traces
developer
chat
Global Options
| Option | Values | Default | Description |
|---|---|---|---|
--format | table, json, csv | table | Output format |
Scripting & Automation
All commands support--format json for machine-readable output and return non-zero exit codes on failure. This applies to both merchant-mode and agent-mode commands.