Chat SDK
Chat SDK Getting Started
Install and use @idlen/chat-sdk to serve contextual ads in chat and non-chat surfaces
Chat SDK Getting Started
The Idlen Chat SDK helps publishers monetize AI products with contextual native ads.
Install
npm install @idlen/chat-sdk
Server usage (recommended)
import { IdlenChatAds } from '@idlen/chat-sdk/server';
const ads = new IdlenChatAds({ apiKey: 'idl_pk_...' });
const ad = await ads.getAd({
sessionId: 'session-123',
rawText: 'How do I deploy Nuxt on Vercel?',
});
Non-chat usage
If your product is mostly non-chat (docs pages, feeds, sidebars, assistants), use the dedicated method:
const ad = await ads.getAdForContent({
sessionId: 'page-42',
contentText: 'Nuxt deployment guide with CI and observability best practices',
});
Vue composable
Use useIdlenAd() from the Vue entrypoint:
import { useIdlenAd } from '@idlen/chat-sdk/vue';
Then either:
fetchAd()for chat message flowsfetchAdForContent()for non-chat flows