x402 VPN: an AI agent buys a VPN over HTTP 402

Black Cat VPN implements x402 v2. An agent asks for a subscription, gets 402 Payment Required with machine-readable terms, signs a USDC transfer on Solana, and sends the same request again. The VPN subscription comes back in that response. No account, no API key, no polling.

$3/month, 5 devices, all three protocols, all locations, unlimited traffic.

OpenAPI spec → Developer guide →

Two HTTP calls

One to get the terms, one to pay. The second answer carries the subscription URL.

No SOL needed

The server is the fee payer. It co-signs and pays the network fee, so the wallet needs only USDC.

No account, no API key

No signup step to automate around. The subscription URL is the access.

Real VPN, not a proxy

A per-user tunnel with VLESS-Reality, Hysteria2 and AmneziaWG. Run a standard client on the config.

The protocol

Version 2, exact scheme, network solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp, asset USDC. Plans are standard-1m, standard-3m, standard-6m and standard-12m.

  1. Ask. POST /api/x402/subscribe with a planId and no payment header.
  2. Read the 402. accepts[0] gives the amount, recipient, fee payer and memo.
  3. Sign. Build the USDC transfer with the memo, sign it as the payer, and leave the fee payer's signature empty.
  4. Retry. Send the request again with the signed payload in a PAYMENT-SIGNATURE header.
  5. Connect. Use subscriptionUrl from the answer. The PAYMENT-RECEIPT header holds the settled transaction.
# 1) ask: the answer is 402 with the payment terms
curl -s -X POST https://blackcat.is/api/x402/subscribe \
  -H 'content-type: application/json' \
  -d '{"planId":"standard-1m"}'
# { "x402Version":2, "accepts":[{ "scheme":"exact", "amount":"3000000", "asset":"EPjF…", "payTo":"…",
#    "maxTimeoutSeconds":120, "extra":{ "feePayer":"…", "memo":"<invoice id>" } }] }
// 2) build and sign, in this instruction order (TypeScript, @solana/web3.js + @solana/spl-token)
const req = required.accepts[0], mint = new PublicKey(req.asset);
const message = new TransactionMessage({
  payerKey: new PublicKey(req.extra.feePayer),   // the server pays the network fee
  recentBlockhash: blockhash,
  instructions: [
    ComputeBudgetProgram.setComputeUnitLimit({ units: 200_000 }),
    ComputeBudgetProgram.setComputeUnitPrice({ microLamports: 1000 }),
    createTransferCheckedInstruction(
      getAssociatedTokenAddressSync(mint, payer.publicKey, true), mint,
      getAssociatedTokenAddressSync(mint, new PublicKey(req.payTo), true),
      payer.publicKey, BigInt(req.amount), 6),
    new TransactionInstruction({ keys: [], programId: MEMO_PROGRAM, data: Buffer.from(req.extra.memo) }),
  ],
}).compileToV0Message();
const tx = new VersionedTransaction(message);
tx.sign([payer]);                                // the fee payer's slot stays empty

// 3) retry the same request with the payment
const paid = { x402Version: 2, resource: required.resource, accepted: req,
  payload: { transaction: Buffer.from(tx.serialize()).toString("base64") }, extensions: {} };
const res = await fetch(url, { method: "POST",
  headers: { "content-type": "application/json",
    "PAYMENT-SIGNATURE": Buffer.from(JSON.stringify(paid)).toString("base64") },
  body: JSON.stringify({ planId: "standard-1m" }) });
// 200 → { status, transaction, username, subscriptionUrl }
What the server accepts. The transaction must hold exactly these instructions and one memo, for the exact amount, from a USDC token account that already exists. A 202 means the payment settled and the subscription is still being issued: poll GET /api/invoices/{invoiceId}. A 409 means the invoice was already used or has expired, so ask for a new one.

FAQ

Is there a VPN that supports x402?
Yes. Black Cat VPN implements x402 v2 with the exact scheme on Solana, paid in USDC, at POST https://blackcat.is/api/x402/subscribe.
Does the agent need SOL for network fees?
No. The server is the fee payer: it co-signs the transaction and pays the Solana network fee. The paying wallet needs only USDC in its token account.
Does the agent need an account or an API key?
No. There is no signup, email or API key. The answer to the paid request carries the subscription URL, and that URL is the access.
What does the agent get back?
A subscription URL for a real per-user VPN tunnel, with VLESS-Reality, Hysteria2 and AmneziaWG. It is not a hosted proxy, so the agent runs a standard client on the config.