X-RAY Documentation

Pay per call (x402)

Agents without an X-RAY account can pay for single calls in USDC, on Base or Solana, through the x402 protocol. No sign-up, no API key: the agent asks for a tool, gets a 402 Payment Required with the price, signs a USDC transfer authorization for exactly that amount and retries. The same read tools as the MCP server, the same JSON responses.

Lane: https://mcp.x-ray.me/x402/{tool}?{args} (GET; the query parameters are the tool's arguments). Subscribers keep using MCP at https://mcp.x-ray.me.

How a paid call works

  1. GET /x402/get_actor?slug=jupiter without payment answers 402. The PAYMENT-REQUIRED header is base64 JSON (x402 version 2) with the resource, the two accepted payment options and the discovery extension; the body repeats the price and these links in plain JSON.
  2. The client picks a network, signs the payment (on Base an EIP-3009 transferWithAuthorization of USDC; on Solana a USDC transfer with the facilitator as fee payer, so the agent needs no SOL) and repeats the request with the PAYMENT-SIGNATURE header.
  3. The lane verifies the signature with the facilitator, serves the response, settles the transfer on-chain and returns it with a PAYMENT-RESPONSE header (base64 JSON: success, transaction, network, payer).

The agent pays the price and nothing else: the facilitator pays the gas on both networks. Each signature is accepted once (24-hour replay window), 300 requests per minute per payer, 60 unpaid requests per minute per IP.

The 402 response


curl -i "https://mcp.x-ray.me/x402/get_actor?slug=jupiter"

HTTP/2 402
payment-required: eyJ4NDAyVmVyc2lvbiI6MiwiZXJyb3IiOiJQYXltZW50IHJlcXVpcmVkIiwicmVzb3VyY2UiOnsi…
content-type: application/json

{"error":"payment required","tool":"get_actor","price_usd":"$0.005",
 "networks":["eip155:8453","solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp"],
 "how":"Retry with an x402 payment (PAYMENT-SIGNATURE header); @x402/fetch does it automatically.",
 "docs":"https://x-ray.me/docs/pay-per-call",
 "client":"https://github.com/xrayme1337/x-ray-agent-kit/tree/main/examples/x402-client",
 "subscribers":"https://mcp.x-ray.me (MCP, OAuth, free 25-call trial)"}

The header decodes to (addresses shortened):


{
  "x402Version": 2,
  "resource": { "url": "…/x402/get_actor?slug=jupiter", "description": "X-RAY get_actor: one actor's full card (header, cards, latest moves) or one tab",
                "mimeType": "application/json", "serviceName": "X-RAY", "tags": ["web3", "crypto", "defi", "intelligence", "mcp"] },
  "accepts": [
    { "scheme": "exact", "network": "eip155:8453", "amount": "5000", "asset": "0x8335…2913", "payTo": "0x…", "maxTimeoutSeconds": 60, "extra": { "name": "USD Coin", "version": "2" } },
    { "scheme": "exact", "network": "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp", "amount": "5000", "asset": "EPjF…Dt1v", "payTo": "…", "maxTimeoutSeconds": 60, "extra": { "feePayer": "…" } }
  ],
  "extensions": { "bazaar": { "info": { "input": { "type": "http", "method": "GET", "queryParams": { "slug": "jupiter" } }, "output": { "type": "json", "example": { "actor": { "name": "Jupiter", "slug": "jupiter", "kind": "protocol" } } } } } }
}

amount is in USDC base units (6 decimals): 5000 = $0.005. The bazaar extension carries the input schema and an output example of every tool, so x402 discovery catalogs (the Bazaar) can list X-RAY without any manual registration.

A paid call

Any x402 v2 client works. With @x402/fetch the 402 handling, signing and retry are automatic:


import { x402Client, wrapFetchWithPayment, decodePaymentResponseHeader } from "@x402/fetch";
import { ExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";

const client = new x402Client((_v, accepts) => accepts.find((a) => a.network === "eip155:8453")!);
client.register("eip155:8453", new ExactEvmScheme(privateKeyToAccount(process.env.WALLET_KEY as `0x${string}`)));
const paidFetch = wrapFetchWithPayment(fetch, client);

const res = await paidFetch("https://mcp.x-ray.me/x402/get_actor?slug=jupiter");
const data = await res.json();                                          // the same JSON the MCP tool returns
const receipt = decodePaymentResponseHeader(res.headers.get("PAYMENT-RESPONSE")!);
console.log(receipt.transaction, receipt.network, receipt.payer);       // settled on-chain

For Solana register ExactSvmScheme from @x402/svm/exact/client with a @solana/kit signer instead. A complete client for both networks, with the selector and the receipt decoding, is in the x402-client example of the agent kit; a paid call looks like this from the command line:


git clone https://github.com/xrayme1337/x-ray-agent-kit && cd x-ray-agent-kit/examples/x402-client && npm install
npm run probe                                   # no keys: the 402, the prices, the payTo addresses
TEST_WALLET_EVM_KEY=0x… npm start -- --network base --tool get_actor --args slug=jupiter
TEST_WALLET_SOLANA_KEY=… npm start -- --network solana --tool get_scope --args type=chain\&slug=solana

Tools and prices

Every one of the 30 MCP tools is available pay-per-call under the same name, with the MCP arguments as query parameters (?slug=uniswap-labs, ?scope=sector&slug=lending-borrowing, ?turn=1, ?type=chain&slug=solana&metrics=open_roles,tvl_usd&days=90, ?items=actor:jupiter,chain:solana&range=30):

What each tool answers is on What the assistant can do. The lane serves the MCP server's tools under the same names, with the same answers.

Prices are per call, in USD, paid in USDC: search_entities $0.001; get_turn, get_board, list_actors, list_narratives and compare $0.01; everything else $0.005. The live price table and the receiving addresses are below; GET /x402 and GET /x402/_prices return the same table as JSON.

Facilitator

Verification and settlement go through an x402 facilitator (currently PayAI; the lane can also run on the Coinbase CDP facilitator). The facilitator checks the signature against the USDC balance, submits the transfer and pays the gas; X-RAY never holds the agent's keys and the payment is final when the data is served.

The exchange in plain HTTP

  1. Request: GET https://mcp.x-ray.me/x402/get_actor?slug=aave, the tool's name in the path and its inputs as the query string (a list comma-joined). No account, no key.
  2. Answer without a payment: 402 Payment Required. The JSON body names the tool, price_usd and the networks; the header PAYMENT-REQUIRED carries the challenge as base64 JSON: x402Version 2, the resource (its URL and description) and accepts, one entry a network — scheme exact, network (Base, eip155:8453, or Solana mainnet), amount in USDC's smallest unit (6 decimals), asset (the USDC contract), payTo and maxTimeoutSeconds 60.
  3. Paid retry: the same GET with the header PAYMENT-SIGNATURE, the base64 payment payload the wallet signed for one entry of accepts. The answer is 200 with the tool's JSON and the header PAYMENT-RESPONSE, the settlement as base64 JSON.
  4. The prices of every tool: GET https://mcp.x-ray.me/x402/_prices, free. Unpaid requests are limited to 60 a minute per IP.
# the 402 and its challenge
curl -si "https://mcp.x-ray.me/x402/get_actor?slug=aave" | grep -i '^payment-required:' | cut -d' ' -f2 | tr -d '\r' | base64 -d

For agents

The facts on this page are also served to AI agents by X-RAY's MCP server: https://mcp.x-ray.me

A new account gets 25 free calls: https://x-ray.me/connect

Without an account, code pays per call in USDC over x402: https://x-ray.me/docs/pay-per-call

Steps for Claude, ChatGPT, Cursor and other clients: https://x-ray.me/docs/connect · Plans: https://x-ray.me/pricing

The setup as one Markdown file: https://x-ray.me/get-started.md