AI'Exchange
v0 SDK

Integrate AI’Exchange in minutes.

AI’Exchange adds LLM-native ad slots (Sponsored cards / inline snippets) to chat experiences. Your app calls the AI’Exchange endpoint to request an ad opportunity, then renders the returned native ad if present.

Publisher quickstart

Integrate in 5 minutes

Three simple steps to request and render a sponsored placement.

Step 1

Set the AI’Exchange endpoint

Step 2

Request an ad (query + slot + turn)

Step 3

Render the ad and label it Sponsored

Important:LLM endpointAI’Exchange endpoint
SDK

JavaScript

Minimal client interface (package coming soon).

import { createAIExchangeClient } from "@aiexchange/sdk" // <coming soon>

const exchange = createAIExchangeClient({
  baseUrl: process.env.NEXT_PUBLIC_AI_EXCHANGE_ENDPOINT!, // <coming soon>
})

const decision = await exchange.getAd({
  query,
  slotType: "INLINE_SNIPPET",
  conversationTurn,
  context: { denomination },
})

if (decision.ad) {
  // Render and label as Sponsored
  renderSponsored(decision.ad)
  exchange.trackImpression(decision)
}
SDK

Python

Minimal client interface (package coming soon).

pip install aiexchange <coming soon>
from aiexchange import AIExchangeClient  # <coming soon>

client = AIExchangeClient(base_url="<coming soon>")

decision = client.get_ad(
    query=query,
    slot_type="INLINE_SNIPPET",
    conversation_turn=conversation_turn,
    context={"denomination": denomination},
)

if decision.get("ad"):
    render_sponsored(decision["ad"])
    client.track("impression", decision)
Configuration

Two env vars

Keep endpoints separate.

NEXT_PUBLIC_AI_EXCHANGE_ENDPOINT <coming soon>
NEXT_PUBLIC_LLM_ENDPOINT <coming soon>
Callout

LLM endpoint ≠ AI’Exchange endpoint.

Keep them separate so model responses and ad decisions scale independently.

Render

Response shape

Tiny AdDecision example.

{
  "request_id": "req_123",
  "slot_type": "INLINE_SNIPPET",
  "ad": {
    "ad_id": "bid_abc",
    "advertiser": "Example Advertiser",
    "title": "Sponsored title",
    "body": "Sponsored body text…",
    "cta": "Learn more",
    "click_url": "https://example.com"
  }
}
Events

Track the basics

Only impressions and clicks to start.

  • Track an impression when the ad renders.
  • Track a click when the user taps it.
  • Optional: track hide if the user dismisses.

Events endpoint: <coming soon>