PARANOID
Launch app

Agents and x402

An agent that holds USDC in a Solana wallet can buy questions on its own, with no site, no browser wallet and no account. It pays with x402, the open standard for paying inside an HTTP request, and then asks questions the same way the connector does: each request carries a fresh key that proves it was paid for without saying which membership paid.

The quickest way: the connector

The connector can buy for you. Point PARANOID_PAYER at a Solana keypair file (the JSON the Solana CLI writes) whose wallet holds the USDC.

curl -O https://paranoid.red/connect.mjs
PARANOID_PAYER=agent-wallet.json node connect.mjs buy 500

It makes a new secret on your computer, saves it in ~/.paranoid/connector.json (readable only by you), pays for 500 questions, and starts serving the OpenAI API on http://127.0.0.1:4141/v1. Later runs need only node connect.mjs. When the questions run out, run buy again; the old membership's file is kept next to the new one.

The wallet needs USDC only. The gateway pays the network fees.

Any x402 client

The endpoint is a plain x402 resource, so any client that pays with the exact scheme on Solana can use it, such as Coinbase's @x402/fetch with @x402/svm.

POST https://paranoid.red/api/x402/join?questions=<n>&commitment=<hex>
  1. Make a secret: a random number below the BN254 field size. Keep it. Whoever has it can spend the questions.
  2. The commitment is Poseidon(secret), written in hex. Only the commitment is sent.
  3. Call the endpoint. The first answer is 402 Payment Required with the price in the PAYMENT-REQUIRED header (x402 version 2) and in the body (version 1). Your client pays and sends the request again with PAYMENT-SIGNATURE (or X-PAYMENT).
  4. On success the answer is 200 with the membership's address and the payment and deposit transactions.

To ask questions from that membership with the connector, run node connect.mjs and paste <secret>.0 as the code.

The price

The price is the questions at the usual rate (0.002 USDC each, 250 at least) plus a setup fee of 0.30 USDC. The fee covers what the gateway pays to open the membership: the rent for its account on Solana and two network fees. The 402 answer always carries the exact amount.

What the chain shows

The payment shows that your wallet paid the gateway, with a memo that is a hash of the commitment and the number of questions. The membership is then bought by the gateway, so the gateway's wallet is its depositor, not yours. The questions themselves are proven in zero knowledge, so a question names no membership and no two questions can be tied together. If the wallet itself must stay unknown, pay from a wallet that has no history.

Errors

A payment that does not match the request is refused before the gateway signs anything, so it costs nothing. The reason is in the PAYMENT-RESPONSE header.

ReasonMeaning
invalid_amountThe transfer is less than the price.
invalid_recipientThe transfer goes somewhere other than the gateway's USDC account.
invalid_memoThe memo is missing or belongs to another commitment or another number of questions.
fee_payer_in_instructionThe transaction asks the gateway's fee payer to do more than pay the fee.
simulation_failedThe transaction would fail, usually for lack of USDC.

Sending the same paid request again returns the same answer and buys nothing more. A payment never buys for a commitment other than the one it was made for.