What x402 actually is
HTTP has always had a status code reserved for this: 402 Payment Required. It sat unused for decades. x402 finally gives it a job. When your client requests a paid endpoint, the server answers 402 with a small JSON body describing how much, in what token, and to which address. Your client signs a stablecoin authorization, retries the request with that proof attached, and the server returns the data.
For APEX, payment settles in USDC on Base (chain id eip155:8453). The amounts are tiny — from $0.01 per call — which is the whole point: an agent can poll cheap data primitives hundreds of times a day, or pay a few dollars for a strategic signal, without a contract, invoice, or subscription. The client library does the signing; you mostly just make the request.
What you need
- A wallet private key your program controls. Use a dedicated burner wallet, not your main one.
- A small amount of USDC on Base in that wallet (a few dollars goes a long way at these prices).
- A little ETH on Base for gas, depending on the settlement scheme your facilitator uses.
Step 1 — Look before you pay
Two endpoints are free, so you can wire up plumbing before spending anything. apex-trial returns a real sample signal, and my-pricing tells you exactly what a given wallet will be charged once discounts are applied.
# Free — no payment, no wallet needed
curl https://apexrunner.ai/signals/apex-trial
Step 2 — Install a client
# Python
pip install x402 eth-account requests
# JavaScript / TypeScript
npm install @x402/fetch @x402/core @x402/evm viem
Step 3 — Make the paid call (Python)
The x402 client wraps your HTTP session. When a 402 comes back it signs the authorization and retries automatically — your code reads as if the endpoint were free.
# pip install x402 eth-account requests
import os
from x402.clients.requests import x402_requests
from eth_account import Account
# Load the burner key from the environment — never commit it.
account = Account.from_key(os.environ["EVM_PRIVATE_KEY"])
# A requests.Session that transparently pays 402 challenges.
session = x402_requests(account)
resp = session.get("https://apexrunner.ai/signals/regime-confluence")
print(resp.status_code) # 200 after payment
print(resp.json()) # the signal payload
x402.clients.requests isn't present in your installed version, check the package's README or docs.x402.org — there are equivalent httpx and raw-fetch wrappers, and the concept is identical.
Step 4 — Make the paid call (JavaScript)
// npm install @x402/fetch @x402/core @x402/evm viem
import { wrapFetchWithPayment } from "@x402/fetch";
import { x402Client } from "@x402/core/client";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";
const account = privateKeyToAccount(process.env.AGENT_PRIVATE_KEY);
const client = new x402Client();
registerExactEvmScheme(client, { signer: account });
// fetch, but it pays 402s for you
const paidFetch = wrapFetchWithPayment(fetch, client);
const res = await paidFetch("https://apexrunner.ai/signals/regime-confluence");
console.log(await res.json());
What you get back
A signal response is plain JSON. Alongside the signal fields, APEX includes an _apex_pricing block showing what you were charged and your current discount tier, so an agent can track its own spend and tier progress without a separate call.
Pricing and discounts
Prices range from $0.01 to $50 per call. Discounts apply automatically per wallet — no codes — and are surfaced in the 402 challenge before you commit to paying:
| Tier | Prior calls | Discount |
|---|---|---|
| Early Adopter | 0–9 | 30% off (through 2026-09-21) |
| Engaged | 10–49 | 15% off |
| Loyal | 50–199 | 15% permanent |
| VIP | 200+ | 20% permanent |
| Volume bonus | 100+ / day | extra 5% |
Check what any wallet will pay before spending: GET https://apexrunner.ai/signals/my-pricing.