A model API on the OpenAI-compatible wire format, paid per call in USDC
The Agent402 model gateway speaks the OpenAI-compatible wire format and takes payment per call: an agent pays in USDC from its own wallet over x402 or MPP, with no account and no API key. It is model-backed: third-party models write the answers.
The gateway is an Agent402 service: it prices each call before it runs (a flat tier price, or a quote from the request on the metered routes), routes auto chat calls to a model chosen for the task, falls back to the next model on a chat tier when one fails, and signs a receipt for each settled paid answer.
The metered routes
POST /v1/metered/chat/completions, POST /v1/metered/messages, POST /v1/metered/responses, from $0.001 a call. The 402 quotes this exact request from its own body (the input estimated from its tokens with headroom, plus your max_tokens, at the model's list price plus a fee). On x402, Tempo and credits, settlement never exceeds that quote: an exact payer pays the quote, an upto payer (where the 402 offers it) pays what the answer used plus the quote's fixed part, a credits key what it used; a card payment adds the processor fee. Set a client timeout of at least 120 s: the answer is generated and the payment settled before the response is sent, which takes a few seconds on most calls and longer for long answers, and a client that disconnects after the payment settles is charged without the answer (the charge is recorded as owed and reviewed for a refund).
curl -i -X POST https://agent402.tools/v1/metered/chat/completions -H 'content-type: application/json' \
-d '{"model":"anthropic/claude-haiku-5.5","messages":[{"role":"user","content":"Summarize x402 in one line"}],"max_tokens":200}'
# unpaid: HTTP 402 quoting this body; an x402 or MPP client pays the quote and resends
Pay it from code
import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";
const client = new x402Client();
client.setSpendControls?.(false); // keep your own ceiling in code instead
registerExactEvmScheme(client, { signer: privateKeyToAccount(process.env.AGENT_KEY) });
const payFetch = wrapFetchWithPayment(fetch, client);
const r = await payFetch("https://agent402.tools/v1/metered/chat/completions", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ model: "anthropic/claude-haiku-5.5", max_tokens: 200,
messages: [{ role: "user", content: "One sentence on paying per call." }] }),
});
console.log((await r.json()).choices[0].message.content);
Any client that takes a custom fetch can be handed payFetch the same
way, so code written against the wire format keeps its shape.
Flat prices instead
Flat tiers stay as the predictable-price option: one price per call whatever the length, $0.003 to $0.50 (/v1/nano, /v1, /v1/pro, /v1/premium; GET /v1/models lists every model with its tier).