@advia/sdk v1.0 · Official Docs
The Waiting-Time SDK
For Modern AI Apps.
Single-client integration that orchestrates waiting state monetization. Non-blocking, zero inference latency, and full programmatic control with Advia.start() and Advia.stop().
npm install @advia/sdkQuickstart Guide
Integrate in Under 5 Minutes
import { useEffect, useRef } from "react";
import { Advia } from "@advia/sdk";
// Initialize Advia client instance
const advia = new Advia({
apiKey: process.env.NEXT_PUBLIC_ADVIA_KEY,
environment: "production",
});
export function AIChatComponent() {
const sessionRef = useRef(null);
const handlePromptSubmit = async (userPrompt) => {
try {
// 1. Trigger Advia waiting experience on user prompt submit
sessionRef.current = await advia.start({
containerId: "advia-waiting-slot",
category: "coding_assistant",
theme: "dark",
});
// 2. Run LLM stream in parallel
const stream = await callLLMStream(userPrompt);
for await (const chunk of stream) {
renderChunk(chunk);
}
} finally {
// 3. Immediately dismiss waiting experience when token generation stops
if (sessionRef.current) {
advia.stop(sessionRef.current.id);
}
}
};
return (
<div>
<div id="advia-waiting-slot" className="transition-all duration-200" />
{/* Your Chat UI */}
</div>
);
}Architecture Guarantee
< 15 KB
Ultra-Lightweight
Zero heavy dependencies. Built to load and evaluate instantaneously in any web or desktop application.
Air-Gapped Privacy
User prompts and model answers never leave your application. Advertisers only receive anonymous event signals.
Graceful Fallback
If no approved campaign is available, the SDK unmounts silently without disrupting the host chat interface.
