Home / Guides / Use Agent402 as your OpenClaw model provider - pay by card, no wallet

Use Agent402 as your OpenClaw model provider - pay by card, no wallet

OpenClaw talks to any OpenAI-compatible provider through one block in openclaw.json. Agent402's LLM gateway is one of those, with a twist: it can be paid by card, through a prepaid credits key, so an agent runs without a crypto wallet. USDC over x402 works too, if you'd rather.

1. Get a credits key (card, two minutes)

Buy a pack at agent402.tools/credits by card. The key (a402_…) is shown once on the thanks page and emailed. It spends on any paid route, including every gateway tier below, and GET /api/credits/balance (Bearer) reports what is left.

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",
        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 (exact-BPE input plus max_tokens at the model's list price, times 1.15, 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 the wrong tier is answered with a 400 that names its home tier; nothing is charged.

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+ deterministic tools (search, extract, render, PDF, EDGAR, openFDA, on-chain data), the smart order router that pays other x402 sellers on your agent's behalf, 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:

  • Three wires on every tier: OpenAI chat, OpenAI Responses and Anthropic Messages, 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 buys on your behalf: POST /api/route/execute pays the best proven external seller for a task and relays the result.

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.

Back to guides