Let AI agents pay with OKXand sign up on their own
Pay with the OKX Wallet over x402 and get an API key and balance in a single request.
- USD₮0 on X Layer, settled through OKX
- No credit card, no sign-up form
- Regular users can top up with x402 too
curl -i -X POST https://bazaarlink.ai/api/v1/agents/register/x402 \
-H "Content-Type: application/json" \
-d '{"name":"my-agent","amountUsd":1.1}'HTTP/1.1 402 Payment Required
Content-Type: application/json
{
"x402Version": 2,
"resource": {
"url": "https://bazaarlink.ai/api/v1/agents/register/x402",
"description": "BazaarLink paid agent registration",
"mimeType": "application/json"
},
"accepts": [
{
"scheme": "exact",
"network": "eip155:196",
"payTo": "0xPAY_TO_ADDRESS",
"asset": "0xASSET_CONTRACT",
"amount": "1100000",
"maxTimeoutSeconds": 300,
"extra": { "name": "USD₮0", "version": "1" }
}
]
}What is x402
- POST
/api/v1/agents/register/x402 - ← 402
accepts[ network, asset, amount, payTo ] - sign
EIP-3009 - POST
X-PAYMENT: … - ← 201
api_key, credits, claim_token
Payments settle on-chain through OKX's x402 facilitator; the server checks each one before it acts.
HTTP 402 asks for payment
The server answers with status 402 and lists what it accepts: network, asset, amount and pay-to address. The client signs a payment authorization and sends the same request again. BazaarLink settles each payment through OKX's x402 facilitator on X Layer.
api_keysk-bl-…credits5claim_token…payment.txHash0x…No account needed first
An agent does not fill in a form or create an account beforehand. The request that carries the payment creates the account, issues the API key and adds the balance.
Four steps from request to API key
Send the request
POST to /api/v1/agents/register/x402 with a name and the amount you want to pay, in US dollars.
Receive a 402
The server replies 402 with the payment requirements. Nothing is created at this point.
Sign and resend
Sign the payment authorization with your own wallet, put it in the X-PAYMENT header and send the same request again.
Get your API key
After the payment is confirmed you receive a 201 with the API key, the balance and a claim link. The key appears only in this response, so store it right away.
Already have an account? Top up with x402 too
Agents use the API key they already have. Regular users sign in and top up from the credits page.
Agents and scripts
POST to /api/x402/topup with an Authorization header and amountUsd. The flow is the same as registration: quote, sign, resend.
Regular users
Sign in, open the credits page and choose x402. Your browser wallet signs the payment.
Supported network and asset
One combination is supported today.
- Network
- X Layer, settled through OKX's x402 facilitator
- Asset
- USD₮0
- Credit
- A platform top-up fee applies, so the credited balance is lower than the amount paid (see pricing)
- Amount per payment
- Has a minimum and maximum; the 402 response and GET /api/x402/topup show the current limits
On-chain payments cannot be reversed. Check the amount and network before you sign.
Not paid yet? Free models still work
An agent account that has not paid uses the existing free-model allowance and rate limits (auto:free). Once it has paid, the account follows the normal rules for paid accounts.
Frequently asked questions
What is x402?
x402 is a protocol that uses the HTTP 402 status code to ask for payment. The server states the amount, network and pay-to address; the client signs a payment authorization and sends the same request again.
What do I need to pay with x402?
The OKX Wallet, or any wallet key that can sign an EIP-3009 authorization, and some USD₮0 on X Layer. The integration docs include TypeScript code using the x402 client to do the signing.
Which network and asset are supported?
USD₮0 on X Layer, settled through OKX's x402 facilitator. A platform top-up fee applies, so the balance you receive is lower than the amount you pay; see pricing.
What happens if I pay or resend twice?
Each payment is credited once. Resending the same payment to top-up returns already_credited. For registration, the same result comes back for 15 minutes; after that you get already_registered and the API key is not shown again.
Can I get a refund?
On-chain payments cannot be reversed and the system does not refund automatically. Contact support if something went wrong.
Is there a limit on registrations?
Yes. Registrations from the same network source are limited over a short period. When you hit the limit you get a 429 with a Retry-After header; wait and try again.
Can a person take over an agent account?
Yes. The registration response includes a claim_token and an upgrade_url. A person signs in and claims the account, and the API key and balance move to their account. claim_expires gives the deadline.