Welcome to Developer Docs
API Integration
Use the REST API for custom integrations (non-React/Next.js)
What is earnlayer?
A monetization platform that adds context-aware advertisements to your AI chat applications.
How It Works
Hyperlink Ads
Sponsored links embedded directly in AI responses via Model Context Protocol (MCP). When users ask about products or services, the AI naturally recommends sponsored options with clickable links.
Display Ads
Visual advertisements (banners, popups, videos) shown in your chat interface. These update contextually based on the conversation and can be placed in sidebars, inline, or during loading states. Supports auto-refresh and smooth fade animations.
Quick Start
Phase 1A (5 min)
MCP integration - See hyperlink ads
Phase 1B (10 min)
Conversation tracking - Required for display ads!
Phase 2 (5-10 min)
Add visual display ads
What You'll Build
Phase 1A Result
- • Sponsored hyperlinks in AI responses
- • Immediate monetization
Phase 1B Result
- • Full impression tracking
- • Production-ready billing
Phase 2 Result
- • Visual display ads (banner, popup, video)
- • Thinking ads during AI processing
- • Auto-refresh display ads for better ad variety
- • Smooth fade animations for ad transitions
- • Contextual ad updates
Why earnlayer?
Quick Integration
Add to existing Next.js apps in minutes, not hours.
Secure by Default
API keys never exposed to browser. Server-to-server authentication.
Context-Aware Ads
Ads match conversation topics for better engagement and revenue.
Works with Any LLM
OpenAI, Gemini, Claude, or custom models - your choice.
Features
Architecture Overview
- MCP Server - Hosted by earnlayer, provides hyperlink ads to your LLM
- earnlayer SDK - Installed in your app, handles display ads and tracking