Guide 02 · ~5 minutes

Your first paid signal call.

x402 lets a program pay for a single HTTP request with stablecoin, no account or API key. This guide explains the protocol in plain terms, then gets you a live APEX signal back in Python or JavaScript.

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.

01
Request
GET the signal URL.
02
402 Challenge
Price, token, network, address.
03
Sign & Pay
Client signs a USDC authorization.
04
200 + Signal
Retry with proof; data returns.

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

Wallet hygiene Never hard-code a private key in source you commit. Load it from an environment variable or a secrets manager, and keep only spending money in the burner. APEX never sees or holds your key — the client signs locally and sends only the authorization.

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
Version check Import paths in the x402 SDKs still move between releases. If 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:

TierPrior callsDiscount
Early Adopter0–930% off (through 2026-09-21)
Engaged10–4915% off
Loyal50–19915% permanent
VIP200+20% permanent
Volume bonus100+ / dayextra 5%

Check what any wallet will pay before spending: GET https://apexrunner.ai/signals/my-pricing.