If you've shipped an AI trading agent before, you've hit this wall: every data provider wants a monthly subscription, an OAuth flow, or a key your agent has to embed. None of that fits how an autonomous agent actually wants to operate — it wants to call an API, pay for what it uses, and move on. No accounts to manage. No keys to rotate. No "free tier or $99/month" cliff.
That's exactly what x402 is for. And it's exactly how MadeOnSol's 7 KOL/deployer endpoints work today. This post is the shortest path to a working agent: a Python script that pays its own way to a stream of fresh Solana KOL signals, in 20 lines.
What x402 does in one paragraph
x402 is a reactivation of the long-dormant HTTP 402 "Payment Required" status code into a real payment protocol. An agent calls an API. The server returns 402 with a PAYMENT-REQUIRED header describing the price (USDC), the recipient (a Solana wallet), and the network (Solana mainnet). The agent signs a USDC transfer from its own Solana wallet, base64-encodes the payload as a PAYMENT-SIGNATURE header, retries the request. The server verifies + settles on-chain (about 1 second), returns the data. One round trip; no signup ever happens.
If you want the longer version, read our Solana AI Agents & x402 guide. For this post, that one paragraph is enough.
What you're going to build
A Python script that:
- Watches MadeOnSol's KOL trade feed every 30 seconds
- Filters for trades by high-winrate KOLs (≥65% over the last 7 days)
- Logs each match (and pays $0.005 USDC for the call from the agent's own Solana wallet)
That's it — the simplest useful agent. From here you can plug it into LangChain, ElizaOS, a copy-trade bot, or a Telegram alerter.
Prerequisites
- Python 3.10+ with
pip
- A Solana wallet the agent owns. Generate one with
solana-keygen new --outfile agent.json if you don't have one, or use any existing keypair.
- About $5 of USDC in that wallet (covers ~1,000 calls of the cheapest endpoint, or 250 of the priciest). Bridge to Solana mainnet via Phantom, Jupiter, or your bridge of choice.
- Optional: a small SOL balance is NOT needed — MadeOnSol's facilitator (PayAI) sponsors transaction fees.
Install
One package:
pip install madeonsol-x402
This SDK ships with x402-solana (Anthropic + PayAI's reference x402 client for Solana) bundled. No additional install needed.
The agent — full source
import os, time
from madeonsol_x402 import MadeOnSolClient
agent = MadeOnSolClient(private_key=os.environ["AGENT_SOLANA_KEY"])
seen = set()
while True:
feed = agent.kol_feed(limit=20, min_kol_winrate=65, action="buy")
for trade in feed["trades"]:
sig = trade["tx_signature"]
if sig in seen:
continue
seen.add(sig)
print(
f"[{trade['traded_at']}] {trade['kol_name']} bought "
f"{trade['token_symbol']} for {trade['sol_amount']} SOL "
f"@ ${trade['market_cap_usd_at_trade']:,} MC "
f"(winrate {trade['kol_winrate_7d']:.0f}%)"
)
time.sleep(30)
That's the whole thing. 20 lines including imports and whitespace. Run it:
export AGENT_SOLANA_KEY="<your base58 private key>"
python agent.py
The first time the SDK hits kol_feed(), it will:
- Send a GET to
https://madeonsol.com/api/x402/kol/feed?limit=20&min_kol_winrate=65&action=buy.
- Receive HTTP 402 with a payment challenge ($0.005 USDC, payTo
88xSdW…cycVU, Solana mainnet, USDC mint).
- Build a USDC transfer transaction, sign it with the keypair from
AGENT_SOLANA_KEY.
- Base64-encode the signed payload as a
PAYMENT-SIGNATURE header, retry the request.
- MadeOnSol calls the PayAI facilitator (
facilitator.payai.network) to verify + settle the payment on-chain.
- On success, returns the KOL trade data plus a
PAYMENT-RESPONSE header containing the settlement transaction signature (your audit trail).
Total time end-to-end: about 1.0–1.5 seconds for the first call. Every 30 seconds after that, another call, another $0.005, another batch of trades.
What you'll see
[2026-05-14T16:42:11Z] @cented7 bought PEPECAT for 5.27 SOL @ $287,000 MC (winrate 71%)
[2026-05-14T16:42:23Z] @somealpha bought MOONDOG for 2.4 SOL @ $94,200 MC (winrate 68%)
[2026-05-14T16:42:54Z] @profittaker bought CATGPT for 8.1 SOL @ $412,800 MC (winrate 65%)
Each line cost the agent half a cent. The agent's Solana wallet shows the on-chain USDC outflows in real time — clean accounting, no invoices to reconcile.
Cost math
The KOL feed is the cheapest endpoint at $0.005/call. At 30-second polling that's:
- 120 calls/hour = $0.60/hour
- 2,880 calls/day = $14.40/day
- ~$432/month at continuous polling
That looks high until you realize: this is the unfiltered behavior. In practice the agent doesn't need to poll every 30s — it can use the response's next_before cursor for pagination, watch the WebSocket stream for fresh events, or poll once per minute and still catch every meaningful trade. Drop polling to once per 2 minutes and you're at $28/month for a fully live agent. That's still less than the Pro API tier's monthly fee, and you only pay it when the agent is running.
Want to scale up? Bump limit to 100 (each call returns 100 trades instead of 20 — same price). Or use /api/x402/kol/coordination ($0.02/call) for tighter alpha signals at 5-minute polling instead.