Skip to content
For agents

Inference an agent can buy by itself.

No sign-up, no API key, no card. An agent with a Monad wallet and some USDC pays with x402, the HTTP 402 payment standard. Settlement is gasless for the agent: Monad's x402 facilitator submits the USDC transfer.

Mode 1 · Pay per call

Call any paid endpoint with no credentials. You get 402 with a PAYMENT-REQUIRED header naming that request's worst-case price in USDC on Monad. Sign the payment, retry with PAYMENT-SIGNATURE, receive the answer plus a PAYMENT-RESPONSE receipt.

Anything the call did not use stays in your wallet's credit balance and is spent first next time (sign in, below). Per-call payments are capped at $1 by default; prepay for bigger jobs.

Mode 2 · Prepay, then sign in

POST /v1/x402/top-up?usd=10 answers 402 for $10; pay it once. Then send a SIGN-IN-WITH-X header on each call: a fresh SIWE message signed by the same wallet. One signature per request, no payment round-trip, lowest latency.

Top-ups go from $1 to $1,000 per payment. Your balance is on chain in CandorCredits; humans can top it up from the Account page too.

Quickstart

A paying agent in 30 lines.

Uses the official x402 libraries. Download the full script (both modes).

npm i @x402/core@2.29.0 @x402/evm@2.29.0 viem
import { x402Client, x402HTTPClient } from "@x402/core/client";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const URL = "https://ai.dagentx.com/v1/chat/completions";
const agent = privateKeyToAccount(process.env.AGENT_KEY);   // holds USDC on Monad
const x402 = new x402Client();
x402.setSpendControls({ maxAmountPerPayment: "$1" });      // never pay more than this per call
registerExactEvmScheme(x402, { signer: agent, networks: ["eip155:143"] });
const http = new x402HTTPClient(x402);

const body = JSON.stringify({ model: "venice/zai-org-glm-5", max_tokens: 400,
  messages: [{ role: "user", content: "Summarize x402 in one line" }] });
const init = { method: "POST", headers: { "content-type": "application/json" }, body };

let res = await fetch(URL, init);
if (res.status === 402) {
  const required = http.getPaymentRequiredResponse((h) => res.headers.get(h), await res.json());
  const payment = await http.createPaymentPayload(required);
  res = await fetch(URL, { ...init, headers: { ...init.headers, ...http.encodePaymentSignatureHeader(payment) } });
}
console.log((await res.json()).choices[0].message.content);
Details

What agents should know

Price = worst case

The 402 amount is the most the call can cost: listed price for your input size and max_tokens, fee included. Set max_tokens to keep it small; unused value stays as your credit.

Payable endpoints

/v1/chat/completions, /v1/messages, /v1/embeddings, /v1/images/generations, /v1/audio/speech, /v1/audio/transcriptions.

Keys still work

An agent can also use a normal crk_ API key registered by its wallet. All three methods share one on-chain balance.

Gas

None for paying: the facilitator submits the USDC transfer. Your wallet only needs USDC.

Proof of what you bought

Every call is a signed record anchored on Monad. GET /relay/proof/:seq returns the Merkle proof for any of your calls.

Skill file

Give your agent the WRAITH Nexus skill and it knows all of this.