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. MadeOnSol's keyless rail has grown well beyond the original seven KOL/deployer calls: the current Solana catalog contains 25 priced endpoints. 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 buy-side trades only (
action=buy)
- 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 (the x402 Foundation's reference client, installed with its Solana/SVM extra) 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, 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"(tx {sig[:8]}...)"
)
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&action=buy.
- Receive HTTP 402 with a payment challenge ($0.005 USDC for this route, the current recipient, Solana mainnet, and the USDC mint). Do not hard-code the recipient from an old article — read the current challenge.
- 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).
The first call includes an on-chain payment settlement, so it takes longer than a plain API 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 (tx 3Kx9pQ2m...)
[2026-05-14T16:42:23Z] @somealpha bought MOONDOG for 2.4 SOL (tx 7Ht4wYn8...)
[2026-05-14T16:42:54Z] @profittaker bought CATGPT for 8.1 SOL (tx JmR2xVq5...)
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 — the seen set above already dedupes, so a slower poll with a larger limit per call still catches every meaningful trade. Drop polling to once per 2 minutes and the arithmetic is about $108/month if it runs continuously (30 calls/hour × 24 × 30 × $0.005). That is more than the current €43/month PRO subscription, so continuous workloads should compare pay-per-call against a keyed plan rather than assuming x402 is always cheaper. (Cursor pagination and the WebSocket streams are part of the API-key path, not the keyless x402 one.)
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.