How NotPixel created a contextual ads layer for LLM-based products
Read the NotPixel case: a contextual ads SDK for LLMs with semantic matching, privacy, streaming, tracking and multi-provider support.
NotPixel was born from a clear thesis: if search, content and discovery flows are moving into conversational interfaces, advertising needs to change too. Instead of relying on cookies, generic banners or visual interruptions, the challenge was to create a native monetization layer for LLM responses, capable of inserting relevant offers without breaking the user experience.
The solution was structured as a provider-agnostic SDK for AI platforms, chatbots, copilots and assistants. The product lets a publisher send conversation context, receive an ad aligned with that intent and compose the final response with clear sponsored-content disclosure. The goal was not to build another traditional ad server, but a monetization mechanism designed for environments where the prompt, response and user intent are the main inventory.
Ads SDK for LLMs
At the core of the project, I developed the notpixel SDK, with a simple API to fetch ads, generate responses with sponsored offers, work in batches, prefetch, cache results and run in mock mode during development. The integration was designed to feel natural for technical teams: the developer provides publisherId, model, input and privacy options, and the SDK handles selection, composition and tracking.
The product was also built to avoid locking customers into a single AI provider. I created adapters for OpenAI, Anthropic, Google Gemini, xAI, OpenRouter and Chat Completions-compatible APIs. This allows the same monetization mechanism to work across different LLM stacks, including streaming experiences.
Contextual relevance and privacy
The matching layer considers conversation text, context metadata and a minimum relevance score before showing an offer. The SDK filters low-fit ads to avoid forced placements and preserve the usefulness of the answer. This is essential in LLM products: an irrelevant ad does not only hurt performance, it breaks trust.
I also implemented a privacy-first approach. By default, the SDK can generate embeddings locally and send only the vector to the API, reducing exposure of the original conversation text. When needed, it can fall back to sanitized and truncated text. This architecture balances monetization, performance and data protection in a scenario where prompts may include sensitive information.
Response composition and streaming
NotPixel does not blindly inject an ad block. It builds instructions for the LLM to incorporate the sponsored offer at the end of the response with a neutral tone, explicit disclosure and preserved CTA. The logic works in Portuguese and English and prevents the model from inventing benefits that are not present in the ad.
I also structured streaming support, with adapters capable of consuming SSE from different providers and delivering streamed output. This makes it possible to monetize modern chat experiences without sacrificing perceived latency or forcing the product to wait for the full answer before rendering content.
Tracking, analytics and publisher operations
Beyond ad selection, I created a browser tracking library for impressions, clicks and conversions. It uses sendBeacon when possible, falls back to fetch, supports viewport-based tracking with IntersectionObserver and sends conversion events with metadata. The SDK also exposes analytics hooks to measure fetched ads, errors, empty results, latency and cache behavior.
The result was ads infrastructure designed specifically for LLMs: contextual selection, privacy through local embeddings, multi-provider support, streaming, React components, event tracking and development mode. NotPixel turns assistant responses into measurable commercial inventory without reducing the experience to banners or formats inherited from the traditional web.
Continue Reading
How to integrate AI implementation in business into real operations
Discover how AI implementation in business can automate processes, connect data, and reduce costs. Learn how to apply AI in real operations.
Structuring revenue models for high scale digital products
Learn how I design revenue models for digital products. See real examples of SaaS, AdTech, and how to optimize billing to grow.
Why system integration via API means the end of manual tasks
System integration via API eliminates rework and connects ERP, CRM, and E-commerce. See how to automate your commercial operation and scale fast.