The price is in the response
Ask for a quote with no account and the endpoint answers 402 Payment Required, then names its price, its asset and where to send it. Pay, retry, get the route. Nothing was signed up for.
Why 402 is the right shape
HTTP has had a status code for this since 1997. Nobody used it because nobody had a way to pay a machine.
Every other metering model assumes an account. A key issued in advance, usage piled against it, an invoice reconciled later. That works for a company. It does not work for a process that started ten seconds ago and will not exist tomorrow.
A 402 turns it around. The request carries no identity, the response carries the price, and payment settles per call. Nothing to provision, share or revoke, and no attribution problem afterwards. The payment is the accounting.
The exchange
Ask, get a price, pay it, get the route. Four messages, no signup in between.
# 1. ask, with no account and no key
curl -i -X POST https://app.ravn.exchange/api/v1/x402/quote \
-H 'content-type: application/json' \
-d '{"inputChainId":1,"outputChainId":-1, ... }'
HTTP/2 402
payment-required: eyJ4NDAyVmVyc2lvbiI6MiwicmVzb3VyY2UiOnsi...
# 2. decode it. the price, asset and payee are all in there
{
"x402Version": 2,
"accepts": [
{ "scheme": "exact", "network": "eip155:8453",
"amount": "1000", "asset": "0x8335…2913",
"payTo": "0x12d2…6933", "maxTimeoutSeconds": 300 }
]
}
# 3. pay, retry with the receipt, get the routeWhat it costs
| Endpoint | Price | What you get |
|---|---|---|
POST /api/v1/x402/quote | 0.001 USDC | A full parallel race across every eligible venue, returning a quoteToken. |
POST /api/v1/x402/execute | 0.01 USDC | Turns that quoteToken into a signable or broadcastable execution payload. |
Where it settles
Two networks, USDC on both. The agent pays from whichever it already holds.
| Network | x402 identifier | Asset |
|---|---|---|
| Base | eip155:8453 | USDC · 0x8335…2913 |
| Solana | solana:5eykt4Us…KvdP | USDC · EPjFWdd5…TDt1v |
It explains itself
The 402 also carries a bazaar extension: a full JSON Schema for the request body and an example response. An agent that has never seen this API can read the 402, learn the shape of a valid call and make one, with no human reading docs first.
That is what makes this more than a payment wrapper. The endpoint describes its own price and its own interface, in the same response.
Or do not pay at all
The ordinary /api/v1/quote is free and anonymous at 30 requests a minute per IP, and the MCP server is free outright. x402 is here for agents that want their own metered access instead of a shared credential and a shared rate limit. It is not a toll on the rest.