Docs
Call any capability. Pay per call.
h402 exposes every capability behind provider-pinned task endpoints. Your agent reads the current default once, keeps that provider pinned until it chooses another, and pays per call in Base USDC over x402 — no per-provider API keys, plans, or subscriptions.
For AI agents
The fastest way to onboard: tell your agent to read the skill and run a task. It creates a wallet, funds it with Base USDC, and starts calling tools on its own.
Under the hood that's three steps — install, fund, call:
# 1. Install the CLI (bundles the OWS wallet binary) npm i -g @h402/cli # 2. Create a local wallet (passphrase-less by default), then fund it with a few $ of Base USDC h402 wallet create --name agent # -> {"wallet":{"name":"agent","address":"0x..."}} # send Base USDC to that address (or run: h402 wallet fund --name agent) h402 wallet balance --name agent # 3. Find a task and call it — pays per call automatically, returns JSON h402 search "web search" h402 call web/search --name agent --json '{"query":"agent payments"}'
Every command prints JSON to stdout and runs non-interactively out of the box — wallets are passphrase-less by default, so nothing prompts. Only if you opted a wallet into a passphrase at create time, set H402_WALLET_PASSPHRASE (the CLI says so when it hits such a wallet). Most capabilities cost $0.001–$0.05 per call, so a few dollars of USDC lasts a long time.
How paying works
Calls are paid per request in Base USDC over x402 — non-custodial, with keys staying on your machine. The CLI handles the whole exchange for you:
Call a task
Your agent POSTs to one provider-pinned route — no payment, no key yet.
402 → sign locally
The server replies with the exact price. You sign a Base USDC EIP-3009 authorization locally — the key never leaves your machine.
Settled + result
Retry with the signature → 200 and the provider-native JSON result. Charged exactly once, per call.
Reuse an idempotency-key on a retry — h402 dedupes by it, so a resent paid request never double-charges.
Discover capabilities
Capabilities are task-first: category/action. Browse the catalog, search it from the CLI, or query the API directly.
h402 search "token holders" # CLI — JSON matches curl https://h402-test.hunt.town/api/catalog # compact task index as JSON curl https://h402-test.hunt.town/api/catalog/routes/web/search # provider contracts for one task
Call & pay
When --provideris omitted, the CLI resolves the task's current default for that invocation and prints the provider-pinned command it used. It does not store that choice. Raw HTTP always uses /routes/{provider}/category/action; change that provider only when you choose to switch contracts.
# With the CLI (handles signing + retry for you) h402 call web/search --json '{"query":"agent payments"}'
# Raw HTTP — the first call returns 402, then retry with the signature curl -X POST https://h402-test.hunt.town/routes/tempo-firecrawl/web/search \ -H 'content-type: application/json' \ -H 'idempotency-key: <uuid>' \ -d '{"query":"agent payments"}' # -> 402 PAYMENT-REQUIRED; sign the challenge and retry with PAYMENT-SIGNATURE. # Reuse the same idempotency-key on the paid retry — h402 never double-charges.
A successful call returns { data, meta?, h402 }: data is the provider-native body, optional meta carries provider metadata, and h402 is the call receipt — the pinned provider, payment mode, provider-native async handle/status metadata, and a followUp block with the exact provider-pinned poll path. Errors return an { error } envelope (with the raw upstream body when a provider rejected the call) and a non-2xx status.
If you run h402 auth with your wallet, bonus credits draw down before USDC; pass --no-credit to force x402.
Use @h402/core
For a custom (non-CLI) integration, import @h402/core — the signer-agnostic protocol toolkit. It builds the x402 challenge and the EIP-3009 typed-data; you plug in your own signer (viem, ethers, or OWS). The @h402/cli is built on it.
npm i @h402/core
Building a capability instead?
List your API and earn from the volume you win — h402 handles the x402 wrapping.