Sign in to track earnings and manage your AI app
Zero dependencies, Apache-2.0, 8.5 KB gzipped.
npm install @boostbossai/lumi-sdk
Never commit your key to git. Use your platform's env var system (Vercel Settings → Environment Variables, Netlify, Render, etc.).
BB_API_KEY=bb_dev_sk_loading
Pick the tab for your stack. The snippet runs your AI call and ad fetch in parallel — zero latency impact on the chat response.
// app/api/chat/route.ts (Next.js App Router)
import Anthropic from '@anthropic-ai/sdk'
import bb from '@boostbossai/lumi-sdk'
const anthropic = new Anthropic({ apiKey: process.env.ANTHROPIC_API_KEY })
bb.configure({ apiKey: process.env.BB_API_KEY })
export async function POST(req: Request) {
const { prompt } = await req.json()
const host = (req.headers.get('host') || '').split(':')[0]
// Fire Claude + ad in parallel — no latency added
const [claude, ad] = await Promise.all([
anthropic.messages.create({
model: 'claude-sonnet-4-6',
max_tokens: 1024,
messages: [{ role: 'user', content: prompt }],
}),
bb.getSponsoredContent({ context: prompt.slice(0, 300), host, format: 'native' })
.catch(() => ({ sponsored: null })),
])
return Response.json({
answer: claude.content[0].text,
sponsored: ad.sponsored, // render this in your chat UI
})
}
response.sponsored — we provide a React component SponsoredCard that auto-styles based on ad.type. Request it and we'll send you the component file.
| Date | Impressions | Your Earnings | Clicks | RPM | Status |
|---|
const bb = require("@boostbossai/lumi-sdk"); // 1. Authenticate so impressions are attributed to your account. bb.configure({ apiKey: process.env.BB_API_KEY }); // 2. Request a Benna-ranked ad for the current user context. const ad = await bb.getSponsoredContent({ context: "user is debugging a python traceback", host: "your-app.com", format: "native" // "image" | "video" | "native" }); // 3. Render and track. SDK fires the impression beacon for you. if (ad.sponsored) { showAd(ad.sponsored); bb.trackEvent("impression", ad.sponsored.id); }