
Company News
Free Business Plan Upgrades for Open Source Maintainers
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.
drainbrain-sdk
Advanced tools
Official TypeScript SDK for the DrainBrain API - AI-powered Solana token rug pull detection
Official TypeScript SDK for the DrainBrain API - AI-powered Solana token rug pull detection.
DrainBrain uses a 4-model ML ensemble (heuristic scoring + XGBoost v1 + XGBoost v2 + GRU temporal model) trained on 175K+ labeled tokens to predict rug pulls before they happen.
npm install drainbrain-sdk
import { DrainBrainClient } from "drainbrain-sdk";
const client = new DrainBrainClient("db_live_your_api_key_here");
const result = await client.scan("TokenMintAddress...");
console.log(result.score); // 0-100 risk score
console.log(result.riskLevel); // "LOW" | "MEDIUM" | "HIGH" | "CRITICAL"
console.log(result.isRug); // true if score >= 70
scan(mint, options?)Scan a single Solana token for rug pull risk.
const result = await client.scan("EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v");
// Free tier response
console.log(result.mint); // Token mint address
console.log(result.score); // 0-100 risk score
console.log(result.riskLevel); // "LOW" | "MEDIUM" | "HIGH" | "CRITICAL"
console.log(result.isRug); // true if score >= 70
console.log(result.cached); // true if served from 5-min cache
console.log(result.timestamp); // ISO 8601
// Pro/PAYG tier - additional fields
console.log(result.rugStage); // 0-5 rug stage
console.log(result.rugStageName); // e.g. "Accumulation"
console.log(result.honeypot); // { isHoneypot, reason }
console.log(result.confidence); // 0-1 scoring confidence
console.log(result.breakdown); // { authority, liquidity, holders, behavior, wallet }
console.log(result.riskFlags); // ["mint_authority_enabled", ...]
console.log(result.temporalScore); // GRU temporal risk score
console.log(result.temporalStage); // GRU predicted rug stage
console.log(result.estimatedPullHours); // Estimated hours until rug
console.log(result.responseTimeMs); // API response time
// Get a Jupiter swap quote if the token is risky
const result = await client.scan("TokenMint...", {
action: "quote_if_risky",
riskThreshold: 70, // default
});
if (result.action?.triggered) {
console.log(result.action.swapQuote); // Jupiter swap quote details
}
batchScan(mints)Scan up to 10 tokens in parallel. Requires Pro or PAYG tier.
const batch = await client.batchScan([
"TokenMint1...",
"TokenMint2...",
"TokenMint3...",
]);
console.log(`Scanned ${batch.count} tokens in ${batch.totalMs}ms`);
console.log(`${batch.errors.length} failures`);
for (const result of batch.results) {
console.log(`${result.mint}: ${result.score} (${result.riskLevel})`);
}
for (const err of batch.errors) {
console.error(`${err.mint}: ${err.error}`);
}
health()Check API status and model availability.
const health = await client.health();
console.log(health.status); // "ok"
console.log(health.version); // "1.0.0"
console.log(health.ensemble); // "heuristic 30% + XGBoost 30% + GRU 40%"
// Model availability
console.log(health.models.xgboost.available); // true/false
console.log(health.models.gru.available); // true/false
console.log(health.models.heuristic.available); // always true
const client = new DrainBrainClient("db_live_...", {
baseUrl: "https://rugslayer.com", // default
timeout: 30000, // 30s default (ms)
});
All API errors throw a DrainBrainError with the HTTP status code and error message.
import { DrainBrainClient, DrainBrainError } from "drainbrain-sdk";
const client = new DrainBrainClient("db_live_...");
try {
const result = await client.scan("TokenMint...");
} catch (error) {
if (error instanceof DrainBrainError) {
console.error(`API error ${error.status}: ${error.message}`);
switch (error.status) {
case 401:
console.error("Invalid API key");
break;
case 403:
console.error("Feature requires Pro/PAYG tier");
break;
case 429:
console.error(`Rate limited. Retry after ${error.retryAfter}s`);
break;
case 504:
console.error("Scan timed out - token may be illiquid");
break;
}
}
}
| Tier | Rate Limit | Price |
|---|---|---|
| Free | 100/day | $0 |
| Pro | 10,000/min | $199/mo |
| PAYG | 1,000/min | $0.005/scan |
fetch)MIT
FAQs
Official TypeScript SDK for the DrainBrain API - AI-powered Solana token rug pull detection
We found that drainbrain-sdk demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Company News
Open source maintainers are under more pressure than ever. We're raising our open source program from the Team plan to the Business plan, free.

Security News
The supply chain control that delays freshly published gems now covers lockfile generation and gem vendoring in Ruby projects.

Security News
During a UK cyber test, a Mythos 5 agent used sockpuppets, social engineering, and prompt injection to try to get a maintainer to merge malware.