Axo

L402 Setup

Install and configure the Axo pay-per-call stack with Axo Pay, Axo Fetch, and Axo CLI.

Use this page to stand up the full pay-per-call flow quickly.

1) Install Packages

npm install @axobot/pay
npm install @axobot/fetch
npm install -g @axobot/cli

2) Configure Environment

VariableRequiredDefaultUsed By
ZBD_API_KEYYesnoneAxo Pay, Axo Fetch example, axo
ZBD_API_BASE_URLNohttps://api.zbdpay.comAxo Pay, Axo CLI
ZBD_WALLET_TOKEN_CACHENo~/.zbd-wallet/token-cache.jsonaxo fetch

Info

Axo Pay can also take apiKey directly in PaymentConfig. If omitted, it falls back to ZBD_API_KEY.

axo init --key <your_api_key>
axo info
axo balance

4) Run the End-to-End Local Demo

From the agents workspace:

npm --prefix axobot-pay run build
ZBD_API_KEY=<your_api_key> npm --prefix axobot-pay run example:http-server

In a second terminal:

npm --prefix axobot-fetch run build
PROTECTED_URL="http://localhost:8787/protected" ZBD_API_KEY=<your_api_key> npm --prefix axobot-fetch run example:zbd

Or use wallet CLI directly:

axo fetch "http://localhost:8787/protected" --max-sats 100

5) Understand Package Roles

  • @axobot/pay: generates invoice challenge + verifies payment proof on incoming requests.
  • @axobot/fetch: handles 402 parsing, invoice payment hook, retry with proof, and token caching.
  • @axobot/cli: CLI workflows (axo) including axo fetch powered by Axo Fetch.

On this page