Docs › Vercel AI SDK
Rugsight tools for the Vercel AI SDK
rugsight-ai-sdk gives an AI SDK agent three tools for checking Solana tokens before it buys, swaps or recommends them. It works with AI SDK 5 and later (generateText, streamText and agents), and with zod 3.25+ or 4.
rugsightScore(free): a 0-100 score, an A-F grade (ICfor issuer-controlled assets such as USDC), a plain-English verdict and risk flag codes.rugsightReport(0.03 USDC per call via x402 on Solana): every flag explained, the top-20 holder breakdown, authority holders, liquidity, volume and pool age. Without a payment-aware fetch, the tool returns the price instead of the report, so the model can tell the user.rugsightNewTokens(free): recently launched Solana tokens that Rugsight checked automatically, each with a score and key flags.
No API key and no signup are needed.
Install
npm install rugsight-ai-sdk ai zod
Use it
import { generateText, isStepCount } from "ai";
import { rugsightTools } from "rugsight-ai-sdk";
const { text } = await generateText({
model: "openai/gpt-5-mini",
prompt: "Is DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263 safe to buy?",
tools: rugsightTools(),
stopWhen: isStepCount(3),
});
console.log(text);
You can also pick single tools: import { rugsightScore, rugsightNewTokens } from "rugsight-ai-sdk", then pass tools: { rugsightScore: rugsightScore() }.
Paid full reports with x402
Pass a payment-aware fetch. The wallet needs a little USDC on Solana; the PayAI facilitator pays the network fee.
npm install @x402/fetch @x402/svm @solana/kit
import { wrapFetchWithPayment, x402Client } from "@x402/fetch";
import { registerExactSvmScheme } from "@x402/svm/exact/client";
import { createKeyPairSignerFromBytes, getBase58Encoder } from "@solana/kit";
import { rugsightTools } from "rugsight-ai-sdk";
const signer = await createKeyPairSignerFromBytes(getBase58Encoder().encode(process.env.SOLANA_PRIVATE_KEY));
const client = new x402Client();
registerExactSvmScheme(client, { signer });
const tools = rugsightTools({ paidFetch: wrapFetchWithPayment(fetch, client) });
Options
Every factory accepts { baseUrl, fetch, paidFetch, timeoutMs }. They are passed to the rugsight client, which you can also use directly.
Source
github.com/rugsightapp/rugsight/packages/ai-sdk (MIT). The package's test calls each tool against the live API and runs a full generateText loop with a mock model.
Automated technical analysis of public on-chain data. A good score does not mean a token is safe. Not financial advice.