Check a token before your trading bot buys it (1.5 cents, no API key)
Trading bots on Base buy fast. Most rugs are visible on-chain before the buy: an owner who can still mint, pause or blacklist, an upgradeable proxy, one wallet holding most of the supply, almost no DEX liquidity. This po
Trading bots on Base buy fast. Most rugs are visible on-chain before the buy: an owner who can still mint, pause or blacklist, an upgradeable proxy, one wallet holding most of the supply, almost no DEX liquidity. This post shows how to put a token check in front of your bot's buy step in about ten lines of Python.
The check is a pay-per-call API. Your bot pays $0.015 per verdict in USDC on Base with x402, straight from its own wallet. There's no API key, no account and no subscription.
Install
pip install rooms-x402-tools
You need a Base wallet private key with a little USDC in it. A dollar covers about 66 verdicts. The key is used to sign the payment locally (EIP-3009) and never leaves your process.
One check
import os
from rooms_x402_tools import RoomsX402Sync, format_verdict
rooms = RoomsX402Sync(private_key=os.environ["WALLET_PRIVATE_KEY"])
v = rooms.token_verdict("0x4ed4E862860beD51a9570b96d89aF5E1B0Efefed") # a token on Base
print(v["grade"], v["score"]) # BASED / MID / COOKED / RADIOACTIVE, 0-100
print(v["metrics"]["liquidity_usd_est"])
print(format_verdict(v))
print(v["_meta"]["payment"]) # the settled USDC payment on Base
Pass chain="ethereum" for mainnet tokens.
In the bot loop
Bots retry. A retried request should not cost twice, so every call takes a request_key. The same key with the same input returns the first answer and is never charged again. A per-call spend cap refuses any payment request above it before anything is signed, and failed calls aren't charged.
import datetime
from rooms_x402_tools import RoomsX402
today = datetime.date.today().isoformat()
async def filter_buys(new_tokens, key):
keep = []
async with RoomsX402(private_key=key, max_payment_usd=0.02) as rooms:
for token in new_tokens:
v = await rooms.token_verdict(token, request_key=f"scan-{token}-{today}")
if v["grade"] in ("COOKED", "RADIOACTIVE"):
continue
keep.append(token)
return keep
As LangChain / LangGraph tools
pip install "rooms-x402-tools[langchain]"
import os
from rooms_x402_tools.langchain import create_rooms_tools
tools = create_rooms_tools(private_key=os.environ["WALLET_PRIVATE_KEY"])
# token_verdict, crypto_fear_greed, prompt_injection_check, read_urls
Hand tools to your agent and it can check a token, read the Fear & Greed index ($0.001), screen untrusted text for prompt injection ($0.004) or read up to 10 pages as markdown ($0.0015 per URL), paying per call.
TypeScript, AgentKit and ElizaOS
The same tools ship on npm with a Coinbase AgentKit action provider, an ElizaOS plugin and LangChain.js tools:
npm i rooms-x402-tools
import { roomsX402ActionProvider } from "rooms-x402-tools/agentkit";
const agentkit = await AgentKit.from({ walletProvider, actionProviders: [roomsX402ActionProvider()] });
Want to see the price first?
Call it without paying and you get the x402 payment terms back (HTTP 402):
curl -i -X POST https://rooms.aurmada.com/x402/v1/token/verdict \
-H 'content-type: application/json' \
-d '{"tokenAddress":"0x4ed4E862860beD51a9570b96d89aF5E1B0Efefed"}'
Limits, honestly
Verdicts are built from on-chain facts only. They're information, not financial advice and not an audit. A clean grade doesn't mean a token is safe; it means the usual red flags weren't found.
Full routes and schemas: https://rooms.aurmada.com/paid ยท PyPI: https://pypi.org/project/rooms-x402-tools/ ยท npm: https://www.npmjs.com/package/rooms-x402-tools
Written by the Rooms by Aurmada team. Questions: [email protected]
Originally published by Dev.to AI. Aggregated on AIWithGhost for educational purposes โ full credit and traffic to the original publisher.