Skip to content

Model Provider

Payment wires: every paid endpoint accepts x402 and MPP (Machine Payments Protocol) on the same 402 - see Paying with x402 and Paying with MPP. Agent402 is the applied layer of Agentic Finance: agents that pay and get paid on their own.

agent402-model-provider makes Agent402 a model provider for use with OpenClaw. Agent402 is not affiliated with or endorsed by the OpenClaw project. The plugin starts a proxy on loopback (127.0.0.1:8412) that pays Agent402 for each call and forwards it, so the host only ever sees a local OpenAI-compatible address. The gateway behind it is model-backed.

Source and full reference: openclaw/README.md. Site guide: agent402.tools/guides/openclaw-model-provider.

Install

openclaw plugins install agent402-model-provider
npm i @x402/fetch @x402/evm viem                 # wallet payment (optional peers; skip with a credits key)
npx agent402-model-provider setup --write
openclaw gateway restart

The wallet packages are optional peers, so nothing installs them for you. With them present, and no credits key and no AGENT402_WALLET_KEY, setup generates a wallet key into ~/.openclaw/agent402/wallet.key (mode 0600, never printed) and prints the address to fund with USDC on Base. Without them it generates nothing and prints what to install. --no-wallet skips the generation.

How a call is paid

  • From a wallet: the proxy signs one x402 payment per call. The key stays on the machine. A per-call ceiling is on by default and is checked on the payment that is signed; AGENT402_MAX_PER_CALL_USD changes it (0 or off turns it off).
  • From a credits key: a key you already hold pays Agent402's own services. agent402.tools/credits says whether new keys are on sale. See Credits keys.

An explicit model rides the metered route by default: each request is quoted from its body before it is paid. --flat (or AGENT402_PRICING=flat) keeps every model on its flat per-call tier. Current prices are on agent402.tools/pricing and in every 402. See LLM Gateway (OpenAI /v1).

Commands

  • agent402-model-provider setup: store a credits key or generate a wallet, and print (or with --write, merge) the provider block.
  • agent402-model-provider proxy: run the proxy alone; point any OpenAI client at http://127.0.0.1:8412/v1.
  • agent402-model-provider doctor: report the configuration; a key is reported as present or none, never printed.
  • agent402-model-provider wallet: the paying wallet's address and USDC balance.
  • agent402-model-provider permit2-approve: a one-time USDC approval so the wallet pays actual usage plus the per-request fixed part the quote carries on metered calls.

The proxy answers native clients on loopback only: a request carrying a browser Origin header or a host that is not loopback is refused.