Build an AI Agent That Buys Solana KOL Signals in 20 Lines of Python (x402)
A walk-through of wiring an autonomous AI agent to MadeOnSol's x402 endpoints. The agent pays $0.005 USDC per KOL trade lookup from its own Solana wallet — no API key, no signup, no monthly subscription. Production-ready in under 20 lines.

Disclosure: This article contains affiliate links. If you sign up through them, MadeOnSol may earn a commission at no extra cost to you. This never affects our rankings, ratings, or reviews.
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.jsonif 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-SIGNATUREheader, 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-RESPONSEheader 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.
Building a product on Solana or Robinhood Chain data?
Skip the Geyser pipeline — embed KOL flow, deployer reputation, and the all-DEX firehose over REST, WebSocket, or webhooks. The Business tier (€400/mo) is the self-serve embed license at 500k calls/day — Enterprise adds white-label & redistribution.
Beyond the basics
The same SDK exposes every x402 endpoint with the same auto-pay flow:
# Tighter alpha: tokens with multiple KOLs piling in within a 15-min window
clusters = agent.kol_coordination(period="1h", min_kols=4)
# Cost: $0.02
# Real-time alerts from every tracked (tier-graded) Pump.fun deployer's launches
alerts = agent.deployer_hunter_alerts(limit=50)
# Cost: $0.01
# Tokens with the most KOL buy volume right now
trending = agent.kol_tokens_trending(period="15m", min_kols=3)
# Cost: $0.01
Stack these in a LangChain Tool and you have an agent that can autonomously discover, evaluate, and act on Solana memecoin signals without ever asking a human for an API key.
from langchain.agents import Tool
def get_fresh_kol_clusters(_):
return agent.kol_coordination(period="1h", min_kols=3)
cluster_tool = Tool(
name="solana_kol_clusters",
description="Fetch KOL coordination clusters on Solana memecoins from the last hour. "
"Returns tokens being co-bought by multiple KOLs. "
"Each call costs the agent $0.02 USDC from its own wallet.",
func=get_fresh_kol_clusters,
)
Drop that tool into a ReAct agent or a CrewAI crew and let the LLM decide when to call it — the cost is bounded to the per-call price, and the agent's wallet shows exactly what was spent.
ElizaOS variant
If you're building on ElizaOS, the same x402 flow is exposed as a plugin:
{
"plugins": ["@madeonsol/plugin-madeonsol"],
"settings": {
"SVM_PRIVATE_KEY": "<agent base58 secret>"
}
}
The plugin auto-routes data calls through x402 when no MadeOnSol API key is configured. The agent character can describe its capabilities ("I can fetch fresh KOL trades for $0.005") and the LLM will use the tool when relevant.
Why this beats traditional auth for agents
Three reasons specific to autonomous AI:
- No key rotation. An agent's Solana wallet is its identity. Lose access? Generate a new wallet and fund it. There's no "support ticket to reset the API key" friction.
- No spending surprise. The wallet balance is the spending cap. Agent can't exceed what it holds. No surprise overage bills.
- Auditable on-chain. Every paid call has a Solana transaction signature returned in the
PAYMENT-RESPONSEheader. Your audit trail lives on a public chain, not in a SaaS dashboard.
For human-operated apps, a traditional API key + monthly subscription is still the better fit (see our /pricing page for that). For autonomous agents, x402 is just a better-shaped tool. If you're weighing x402 against a subscription-based integration, our comparison of MCP, agent-kit, and x402 for wiring Solana data into an agent breaks down when each path makes sense.
Endpoints available right now
Exactly 25 Solana endpoints are currently priced on x402, plus 10 Robinhood Chain endpoints under /api/x402/rhc/*. The original KOL and deployer set that this tutorial exercises:
| Endpoint | Price | What it returns |
|---|---|---|
/api/x402/kol/feed | $0.005 | Real-time KOL trade feed |
/api/x402/kol/leaderboard | $0.005 | KOL rankings by PnL / winrate / profit factor |
/api/x402/kol/tokens/hot | $0.01 | Tokens with accelerating KOL interest |
/api/x402/kol/tokens/trending | $0.01 | Tokens by raw KOL buy volume |
/api/x402/deployer-hunter/alerts | $0.01 | Real-time Pump.fun deployer launches |
/api/x402/kol/coordination | $0.02 | Multi-KOL clusters on the same token |
/api/x402/kol/pairs | $0.02 | KOL co-trading affinity matrix |
Since then the keyless rail has grown to cover token risk scores, buyer quality, holder census, candles, trade flow, top traders, cap tables, wallet PnL, sniper deploys, almost-bonded tokens and more — the full, always-current list with prices lives at madeonsol.com/api/x402.
Catalog as JSON: /api/x402.
Resources
- /x402 landing page — full catalog with copy-paste snippets
- TypeScript SDK
- Python SDK
- Solana AI Agents & x402 guide — broader explainer if you want the protocol-level details
- Sub-second webhook architecture — for when you outgrow polling
If you build something interesting on top of this, share it — we read every mention on X. The agent economy is wide open and Solana is where the rails actually work.
September 2026 refresh
The tutorial now follows x402 V2 terminology and the live MadeOnSol catalog. Two important corrections: the Solana rail is 25 endpoints, not the original seven-tool surface, and the old two-minute polling cost was wrong — continuous two-minute polling of a $0.005 route is about $108/month, not $28. The old hard-coded recipient was also removed because MadeOnSol rotated its receiving wallet in August; a client must trust the current signed/challenged payment requirements, not a value copied from prose.
Sources: MadeOnSol x402 catalog, x402 product page, and Solana's x402 V2 guide.
When paying per call stops being the best fit
An occasional wallet-funded lookup is different from an agent querying several data sources every few seconds. Before adding another automated payment loop, compare recurring subscriptions, x402 price-per-call economics, tier restrictions and commercial data-display rights in MCP vs x402 vs API Subscriptions for AI Agents.
The Agent Intelligence Gateway groups six research actions, but new composite actions are not automatically included in this tutorial's existing x402 catalog. Check the actual offered 402 payment challenge, supported network/asset, spent budget and paid-result recovery before enabling autonomous payments.
Tools mentioned
Compare features and read reviews.
Live health scores, average ratings, and direct links on MadeOnSol.

SolanaFloor
Real-time Solana NFT floor prices, analytics, and market data

Solana Geek
Solana ecosystem resource hub with tool reviews and trading guides

MadeOnSol MCP Server
MCP server for Solana KOL intelligence and deployer analytics

Solana Actions
Create shareable blockchain actions and blinks for any Solana transaction

Solana Agent Kit MCP
MCP server powered by Solana Agent Kit for on-chain actions
Get this data via API
Stream real-time KOL trades, PnL rankings, and coordination signals programmatically.
import { MadeOnSol } from "madeonsol";
const client = new MadeOnSol({ apiKey: "msk_your_key" });
// Real-time KOL trades
const { trades } = await client.kol.feed({ limit: 10, action: "buy" });
// KOL convergence signals
const { tokens } = await client.kol.coordination({ min_kols: 3 });Building a product on Solana or Robinhood Chain data?
MadeOnSol isn't an RPC or another generic token API — it's Solana & Robinhood Chain memecoin intelligence that's painful to build in-house, pulled from dual-region gRPC shred streams and our own Robinhood Chain node, pushed to your app as events land.
Signals you'd otherwise build
KOL & smart-money flow from 2,000+ labeled wallets, deployer reputation, coordination clusters, linked-wallet entity resolution, and an all-DEX firehose.
Embed it in your product
The Business tier (€400/mo, self-serve) licenses you to display MadeOnSol data inside your own product — 500k calls/day, 15 WS + 6 firehose connections. Enterprise above adds white-label & redistribution rights and custom endpoints.
Evaluate first, commit later
Test everything on a free ULTRA key — no commitment. If it fits, we scope volume or white-label pricing.
Keep reading
More from the blog.

API Guides
Build a Solana & Robinhood Chain Memecoin Research Agent: Six Intelligence Checks
Design an evidence-backed memecoin research agent with six MadeOnSol intelligence actions: KOL discovery, token risk, deployer history, wallet analysis, signal reliability and cursor-based changes.

API Guides
MCP vs x402 vs API Subscriptions for AI Agents: Architecture, Costs and Limits
MCP connects your agent to tools; x402 pays for eligible API calls; subscriptions authorize sustained data access. Compare the real trade-offs, payment rails, costs, tier limits and failure modes for Solana and Robinhood Chain agents.

Education
Agentic Trading in 2026: What Actually Changed
How a trading research agent uses MCP and x402 to check token risk, holders and wallet activity on Solana and Robinhood Chain.

Developer Tools
Is Your API Agent-Ready? A Checklist (2026)
The most common reason AI agents fail against an API isn't missing data — it's undocumented rate limits and no machine-readable discovery. A concrete, dated checklist for what agent-ready actually means in 2026, using MadeOnSol's own build as the worked example.

Guides
Does x402 Only Work with USDC? USDG, EIP-3009 and Robinhood Chain Explained
A common myth says x402 payments only work with USDC. They don't. USDG (Global Dollar) implements EIP-3009, so it works with x402 today — and it settles natively on Robinhood Chain. Here's why, with the on-chain details.

Guides
How AI Agents Pay for Robinhood Chain Data in USDG (x402, No API Key)
AI agents can now buy Robinhood Chain KOL and deployer intelligence per call — no signup, no API key, the wallet is the key. Here's how the x402 payment flow works, and why you can pay in USDG on Robinhood Chain or USDC on Solana.
Enjoyed this article?
Explore the live data.
Real-time KOL trades, Pump.fun deployer intel, and 1,200+ ranked Solana & Robinhood Chain tools — free to explore.
Open the KOL Tracker