Use Agent402 as your OpenClaw model provider - pay per call
OpenClaw talks to any OpenAI-compatible provider through
one block in openclaw.json. Agent402's LLM gateway is one of those. New credits keys are not on sale, so the
plugin path in Pay from a wallet below is the way
in: it mints a wallet you fund with USDC on Base. The plain config block in
this section is for a credits key (a402_…) bought earlier, which keeps
working; GET /api/credits/balance (Bearer) reports what is left.
1. Use a credits key you already hold
Put it in the environment OpenClaw runs in:
export AGENT402_CREDITS_KEY=a402_…
2. Add the provider
OpenClaw sends roughly 70k characters of system prompt and tool schemas before
your first word, so the model it talks to must accept that much input. The
routed auto tier caps input at 16,000 characters and OpenClaw refuses it
as a context overflow before any call is made; the metered route
(/v1/metered, up to 200,000 characters, each request quoted from its
body from $0.001) is the one to point OpenClaw at:
// ~/.openclaw/openclaw.json
{
agents: {
defaults: {
model: { primary: "agent402/anthropic/claude-haiku-4.5" },
},
},
models: {
providers: {
agent402: {
baseUrl: "https://agent402.tools/v1/metered",
// OpenClaw resolves ${VAR} from the environment at runtime, so the key
// never sits in this file.
apiKey: "${AGENT402_CREDITS_KEY}",
api: "openai-completions",
timeoutSeconds: 120,
models: [
{
id: "anthropic/claude-haiku-4.5",
name: "Claude Haiku 4.5 via Agent402 (metered, from $0.001/call)",
reasoning: false,
input: ["text"],
// Agent402 bills per call (the 402 quotes each request), not per token,
// so OpenClaw's per-token cost display does not apply and stays at zero.
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
contextWindow: 50000,
maxTokens: 8192,
},
],
},
},
},
}
Restart the gateway (openclaw gateway restart). Every model call now goes to
POST /v1/metered/chat/completions with your credits key, paying what
that call costs (quoted from input plus max_tokens, capped at
$2 per call). Any id from
/v1/models can take Haiku's place.
Explicit models and the other tiers
The gateway has 6 flat chat tiers, each a fixed price per call, plus a metered route, /v1/metered, that quotes each request from its body (from $0.001 per call):
| tier | baseUrl path | per call | max output tokens |
|---|---|---|---|
| nano | /v1/nano |
$0.003 | 768 |
| base | /v1 |
$0.02 | 2048 |
| pro | /v1/pro |
$0.10 | 4096 |
| premium | /v1/premium |
$0.50 | 8192 |
| auto (routed) | /v1/auto |
$0.01 | 1024 |
| grounded (web search on every call) | /v1/grounded |
$0.03 | 1024 |
To pin a model, add a second provider whose baseUrl is that tier's path and
whose models[] list ids from /v1/models,
for example baseUrl: "https://agent402.tools/v1/premium" with
{ id: "openai/gpt-5" } and { id: "anthropic/claude-opus-5" }. A model sent
to another flat tier's route is priced at its home tier: the 402 quotes that
tier's price, and the paid call is served under that tier's caps.
Pay from a wallet instead
Every tier answers an x402 402 (USDC on Base, Solana, Polygon, Arbitrum, Monad, Celo, Avalanche, Sei, Optimism, Stellar, or Algorand - or USDG on Robinhood Chain) and an MPP challenge, so any
x402-capable client can pay per call with no key at all. For OpenClaw the
agent402-openclaw plugin
runs a loopback proxy that pays and forwards, with a credits key or an x402
wallet, and writes the provider block for you. Explicit models go to the metered
route by default (each request quoted from its body, from
$0.001); --flat keeps the flat tiers:
openclaw plugins install agent402-openclaw
npx agent402-openclaw setup --write # no key? it mints a wallet and prints the address to fund
openclaw gateway restart
With no credits key and no AGENT402_WALLET_KEY, setup generates a wallet
into ~/.openclaw/agent402/wallet.key (0600, never printed) and tells you the
address: send it USDC on Base and every call is paid from it over x402, from
$0.001 a call. agent402-openclaw wallet shows the
balance; --credits-key a402_... is the card path instead. Every forwarded
call carries an Idempotency-Key, so a retry replays the paid answer instead
of paying twice. The plain config block above needs no plugin and
stays the simplest path for a credits key.
What you get that a plain router does not
The same key and the same base URL reach the rest of the catalog: 500+ tools (search, extract, render, PDF, EDGAR, openFDA, on-chain data), the smart order router that buys from other x402 sellers and resells the result, and receipts for every call. Every price on this page is rendered from the live gateway configuration.
What else the same key buys
The credits key (or the wallet) that pays for chat is the same one that pays for everything else on the gateway and the catalog, with one 402 shape and one receipt shape:
- Four wires on every tier: OpenAI chat, OpenAI Responses, Anthropic Messages and Gemini generateContent, plus streaming, embeddings, rerank, images, video, speech and transcription, and a grounded tier that cites the web on every answer.
- 500+ tools over MCP or HTTP: web search, news, cited answers, browser render, market quotes, SEC filings, crypto and DeFi data, PDFs, OCR, DNS and TLS checks, a code sandbox, wallet-keyed memory.
- Finished reports and monitors: dossiers, insider flow, 13F holdings, domain audits, token risk, deep research, market briefs, a LinkedIn article package; monitors that re-run a report only when the facts change.
- Routing that sources from other sellers:
POST /api/route/executebuys the result from the best-matching external seller for a task, proven sellers first, and sells it to you.
Why pay here, in one page with the proof links: agent402.tools/why. The short version: usage is priced under a ceiling you see before you pay, a failed call is not charged and the receipt proves it, a keyed retry never pays twice, and uptime and transactions are published from outside production.
Packages for this guide
- OpenClaw model provider (
agent402-openclaw)