Put vet402 between AI agents. Both sides trade safely.
vet402 pays x402 sellers itself and keeps a public record of what came back. Pick your side and start in three steps.
Your agent pays x402 sellers. Read what vet402 saw when it paid the same URL before your agent signs.
- 1. A free API key. Reads of a decision also work without one at 10 requests a minute. Get a key
- 2. Pick your stack below.
- 3. Copy the snippet into your agent.
curl
Look up the URL, then read the decision for its resource_id. Needs jq. Works without a key at 10 requests a minute. When RESOURCE_ID is null, vet402 has no record of the URL.
RESOURCE_ID=$(curl -s --get --data-urlencode "q=https://api.example.com/v1/quote" https://vet402.com/api/v1/resolve | jq -r .resource.resource_id)
curl -s "https://vet402.com/api/v1/resources/$RESOURCE_ID/decision?role=payer"TypeScript
npm install vet402 (and viem for an EVM signer). check reads what vet402 saw when it paid the URL. payOrRefuse pays after the checks pass.
import { check } from "vet402";
import { payOrRefuse } from "vet402/buyer";
const payee = "0x..."; // the payTo in the seller's 402
const account = yourSigner; // a signer, see the payOrRefuse section of the @vet402/sdk README
const r = await check("https://api.example.com/v1/quote");
if (r.recommendation === "ALLOW") {
const paid = await payOrRefuse({ payee, resource: "https://api.example.com/v1/quote", amountUsd: 0.01, fetch, account, network: "base-sepolia" });
}Python
pip install httpx. No key needed at 10 requests a minute.
import httpx
url = "https://api.example.com/v1/quote"
found = httpx.get("https://vet402.com/api/v1/resolve", params={"q": url}).json()
resource = found.get("resource") or {}
resource_id = resource.get("resource_id")
if resource_id:
d = httpx.get(f"https://vet402.com/api/v1/resources/{resource_id}/decision", params={"role": "payer"}).json()
print(d["recommendation"], d["reason_codes"])MCP
Cursor: put this line in .cursor/mcp.json. Claude Code: claude mcp add --transport http vet402 https://vet402.com/mcp. Claude Desktop and Claude.ai add a custom connector in Settings, Connectors with the URL https://vet402.com/mcp. No key.
{"mcpServers":{"vet402":{"type":"http","url":"https://vet402.com/mcp"}}}No-code
n8n: two HTTP Request nodes with method GET. The second takes resource.resource_id from the first. Stop when resource is missing.
GET https://vet402.com/api/v1/resolve?q={{encodeURIComponent($json.url)}}
GET https://vet402.com/api/v1/resources/{{$json.resource.resource_id}}/decision?role=payerYour API takes x402 payments. Check the paying wallet before the payment settles.
- 1. A free API key. The seller gate needs one. Get a key
- 2. Pick your stack below.
- 3. Copy the snippet into your server.
Express
npm install @vet402/middleware. Mount it after x402 verification so req.payer is set.
import { createExpressGate } from "@vet402/middleware/express";
app.use("/api/paid", createExpressGate({
apiUrl: process.env.VOUCH_API_URL!, // https://vet402.com/api/v1
apiKey: process.env.VOUCH_API_KEY!,
getAddress: (req) => req.payer,
}));Hono
npm install @vet402/middleware
import { createHonoGate } from "@vet402/middleware/hono";
app.use("/api/paid/*", createHonoGate({
apiUrl: process.env.VOUCH_API_URL!,
apiKey: process.env.VOUCH_API_KEY!,
getAddress: (c) => c.get("payer"),
}));Next.js
npm install @vet402/middleware. App Router route handler.
import { withVouchGate } from "@vet402/middleware/next";
export const POST = withVouchGate(
{
apiUrl: process.env.VOUCH_API_URL!,
apiKey: process.env.VOUCH_API_KEY!,
getAddress: (req) => new URL(req.url).searchParams.get("payer") ?? undefined,
},
async (req, trust) => Response.json({ ok: true, trust }),
);Use the I buy snippet on the way out and the I sell snippet on the way in.
- 1. A free API key. One key works for both sides. Get a key
- 2. Pick a stack under I buy and under I sell.
- 3. Copy the snippet into each side.
What each side reads
The two sides read different things today. The buyer lines read vet402's record for the seller's URL, built from probes and from purchases vet402 made. The seller gate reads a score for the paying wallet. The record page for the URL lists the transaction hash of each settled purchase, and /api/v1/resolve?q=<tx hash> finds a recent settlement and the URL it paid for.
Full reference: API and hosted MCP.