LIVE: ON-CHAIN TRANSFER MODE
4 FREE CALLS / ENDPOINT GROUP

Payment Guide for AI Agents

AgentGate sells deterministic API calls by verified USDC transfer. An agent gets four automatic free calls first. From the fifth call, it receives HTTP 402, transfers the exact USDC amount on Base or Solana, then retries the exact request with the transaction proof.

One important implementation fact: the live gateway verifies an on-chain USDC transfer transaction hash. Send a transfer first, wait for chain confirmation, then use X-PAYMENT: {"txHash":"…","network":"…"}. Do not send a raw private key, seed phrase, or an unsigned x402 authorization to AgentGate.

1. Fast path

1. Call normallyFirst four calls return HTTP 200.
2. Receive HTTP 402Read Base64 Payment-Required.
3. Transfer USDCChoose Base or Solana terms.
4. Retry oncePass confirmed tx hash in X-PAYMENT.
  1. Do not prepay. Make the intended API request first. The 402 response gives the exact amount, recipient, asset and network for that endpoint.
  2. Choose one accept block. Base L2 is EVM-compatible; Solana has the lower per-call price.
  3. Transfer exact atomic units of canonical USDC. USDC has six decimals: 5000 = $0.005.
  4. Retry the original method, URL and body once with its confirmed transaction hash. One hash redeems one call only.
# Probe normally — first 4 qualifying calls are free
curl -i -X POST https://x402.agentsea.vn/v1/scrape/clean-markdown \
  -H 'Content-Type: application/json' \
  -d '{"url":"https://example.com"}'

# After trial: HTTP/1.1 402 Payment Required
# Decode the payment terms; choose ONE accepts[] entry.
python3 -c 'import base64,json,sys; print(json.dumps(json.loads(base64.b64decode(sys.stdin.read().strip())),indent=2))' \
  <<< "$PAYMENT_REQUIRED_BASE64"

2. Live recipient terms

Base L2 / EVM
Network: eip155:8453
Canonical USDC: 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
Recipient: 0x2965570f64c9c2FB5b9c09bf36529A6438696969
Solana Mainnet
Network: solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp
Canonical USDC mint: EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v
Recipient: TediZmm6dE7Q1pU6FjwCs9uRT4UVx8uPWk8SDCSHkaF
Always trust the current accepts[] data in the 402 response over a cached guide. It is the per-request source of truth.
EndpointBase USDCSolana USDC
/v1/scrape/clean-markdown$0.005$0.001
/v1/guard/prompt-injection-check$0.002$0.001
/v1/intel/enrich-domain$0.010$0.003
/v1/solana/token-security$0.010$0.002
/v1/signals/token$0.010$0.003
/v1/code/triage-issue$0.020$0.005
/v1/audit/aeo-ready$0.050$0.005

3. Base L2 payment — automated agent example

Use this when the agent owns an EVM wallet and can make an ERC-20 transfer. It is direct, independent of a payment intermediary, and matches the live verifier.

// Node 20+. npm i ethers
// export EVM_PRIVATE_KEY=0x...  # keep this only in your secret manager
import { ethers } from "ethers";

const endpoint = "https://x402.agentsea.vn/v1/scrape/clean-markdown";
const body = { url: "https://example.com" };
const rpc = new ethers.JsonRpcProvider("https://mainnet.base.org");
const signer = new ethers.Wallet(process.env.EVM_PRIVATE_KEY, rpc);
const usdc = new ethers.Contract(
  "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
  ["function transfer(address to,uint256 value) returns (bool)"], signer
);

// 1) Probe — 200 means free trial; 402 carries dynamic terms.
let res = await fetch(endpoint, {method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(body)});
if (res.status === 200) console.log(await res.json());
else if (res.status === 402) {
  const p = JSON.parse(Buffer.from(res.headers.get("payment-required"), "base64").toString("utf8"));
  const term = p.accepts.find(x => x.network === "eip155:8453");
  if (!term || term.asset.toLowerCase() !== "0x833589fcd6edb6e08f4c7c32d4f71b54bdA02913") throw Error("Unexpected payment terms");

  // 2) Send exact USDC and await confirmation.
  const tx = await usdc.transfer(term.payTo, BigInt(term.amount));
  await tx.wait(1);

  // 3) Resubmit the same resource exactly once with proof.
  res = await fetch(endpoint, {method:"POST",headers:{"Content-Type":"application/json","X-PAYMENT":JSON.stringify({txHash:tx.hash,network:term.network})},body:JSON.stringify(body)});
  console.log(res.status, await res.json());
} else throw Error(`Unexpected HTTP ${res.status}`);

4. Solana payment — agent contract

For a Solana-capable agent, select the accepts[] block whose network starts with solana:, transfer its exact amount of the stated USDC mint to payTo, wait for finalized confirmation, then resubmit this payload:

POST https://x402.agentsea.vn/v1/guard/prompt-injection-check
Content-Type: application/json
X-PAYMENT: {"txHash":"<finalized Solana signature>","network":"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"}

{"text":"content to inspect"}
Solana agent requirement: build a canonical SPL-token USDC transfer from the agent's wallet to payTo. Do not transfer SOL, bridged USDC, or a different mint. The verifier checks the exact USDC transfer transaction on mainnet.

5. HTTP contract an agent must follow

Challenge

HTTP/1.1 402 Payment Required
Payment-Required: <base64 JSON envelope>
X-PAYMENT-NETWORKS: eip155:8453,solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp
X-PAYMENT-AMOUNT: 5000
X-PAYMENT-BASE-RECIPIENT: 0x2965570f64c9c2FB5b9c09bf36529A6438696969
X-PAYMENT-SOLANA-RECIPIENT: TediZmm6dE7Q1pU6FjwCs9uRT4UVx8uPWk8SDCSHkaF

Payment proof accepted now

X-PAYMENT: {"txHash":"0x<Base transfer transaction hash>","network":"eip155:8453"}
# OR
X-PAYMENT: {"txHash":"<Solana transfer signature>","network":"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"}

Rules

6. MCP discovery

Agents can inspect tools and JSON schemas through Remote MCP before they pay:

# Discover all tools
curl -s -X POST https://x402.agentsea.vn/mcp \
  -H 'Content-Type: application/json' \
  -d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{}}'

# Machine-readable discovery documents
https://x402.agentsea.vn/.well-known/agent-card
https://x402.agentsea.vn/.well-known/x402
https://x402.agentsea.vn/openapi.json
https://x402.agentsea.vn/SKILL.md

7. Protocol status — do not assume unsupported paths

Available now
• Direct verified USDC transfer on Base L2, then X-PAYMENT transaction proof.
• Direct verified USDC transfer on Solana, then X-PAYMENT transaction proof.
• Base64 JSON Payment-Required challenge, 4 free calls, replay protection.
Not a live settlement path yet
• A bare CDP / x402 SDK signed authorization is not accepted as a transaction hash.
• MPP bearer credentials are not a funded balance at AgentGate.
Use the direct on-chain flow above until a compatible facilitator or MPP settlement provider is announced in the live 402 response.

8. Error handling

ResponseMeaning / action
200Free or paid resource delivered.
402 Payment RequiredTrial is exhausted or payment proof failed. Read response error; make one new exact USDC transfer if needed.
402 Payment proof already redeemedThe transaction hash was already used. Make a new transfer; never retry the same proof.
429Too many unpaid requests. Stop probing; pay a valid request or wait for Retry-After.
400Malformed proof. Send JSON, not a raw hash: {"txHash":"…","network":"…"}.