Home

Welcome to Developer Docs

Welcome to earnlayer Developer Docs. We have 2 ways to integrate earnlayer: via API and via SDK.
These docs contain information on the SDK integration. We also have a separate API integration if you prefer that.

API Integration

Use the REST API for custom integrations (non-React/Next.js)

Prefer direct API control? Use our REST API to integrate earnlayer into any application stack.
Open API Explorer

What is earnlayer?

A monetization platform that adds context-aware advertisements to your AI chat applications.

Instead of charging users directly, you can earn revenue from relevant, non-intrusive ads that match your conversation topics.
Works with ANY LLM - OpenAI, Google Gemini, Claude, or custom models

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.

User: "What are the best project management tools?"
AI: "Based on your needs, I recommend [Asana](sponsored-link), [Monday.com](sponsored-link), or [ClickUp](sponsored-link)..."

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

Already have a working chat app? Perfect! Add earnlayer in ~20 minutes with our phased approach.

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

Start with Phase 1A

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

Hyperlink Ads
Sponsored links in AI responses via MCP
Display Ads
Visual banner, popup, and video ads
Thinking Ads
Monetize loading states
Conversation Tracking
Contextual ad targeting
Demo Mode
Test with sample ads before setting up partnerships
Click Tracking
Automatic tracking via backend redirects
Analytics Dashboard
Monitor performance and earnings

Architecture Overview

User Question
Your Chat Route → MCP Server (gets hyperlink ads)
↓ ↓
LLM Response ← ← ← ← ← ← ← ← ← Ads
Browser (displays response with hyperlink ads)
earnlayer SDK → Your Proxy → earnlayer API (tracks clicks, gets display ads)
Two Components:
  1. MCP Server - Hosted by earnlayer, provides hyperlink ads to your LLM
  2. earnlayer SDK - Installed in your app, handles display ads and tracking
Both work together seamlessly to provide a complete monetization solution.

License

Proprietary - All Rights Reserved
Copyright © 2025 earnlayer, Inc.