> ## Documentation Index
> Fetch the complete documentation index at: https://docs.trygravity.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Monetize your AI app with contextual ads

> Gravity is the advertising layer for AI applications — ship ads that match the conversation, earn per impression.

## What Gravity is

Gravity is ad infrastructure built for AI platforms. You add a few lines of code; we match relevant ads to the conversation your users are having, handle the auction, render the ad, and pay you for impressions.

The ad request runs in parallel with your model call, so your user-perceived latency doesn't move.

<CardGroup cols={2}>
  <Card title="Quickstart" icon="rocket" href="/ai-platforms/quickstart">
    From zero to your first ad in under five minutes.
  </Card>

  <Card title="How it works" icon="diagram-project" href="/introduction/how-it-works">
    The request flow, the auction, and what makes matching contextual.
  </Card>
</CardGroup>

## Who this is for

<CardGroup cols={2}>
  <Card title="AI Platforms" icon="newspaper" href="/ai-platforms/quickstart">
    Running an AI chat, coding assistant, search app, or consumer AI product. Show ads, earn revenue.
  </Card>

  <Card title="Advertisers" icon="bullhorn" href="/advertisers/quickstart">
    Brands running campaigns across the Gravity network. Target by conversation context, pay per impression.
  </Card>
</CardGroup>

## Two ways to integrate

**SDK — recommended.** A few lines in your chat component (client) and your request handler (server). The SDK handles context preparation, impression tracking, and — importantly — [experiments](/ai-platforms/experiments), which let us test different ad creative and formats to find what converts best for your traffic. You don't have to change anything to benefit.

**API — fully supported.** Hit `POST https://server.trygravity.ai/api/v1/ad` directly. You own the rendering. The SDK's value-adds (experiments, pre-built React components, automatic tracking) are yours to build, but nothing stops you from using the API — it's the same engine.

|                     | SDK (`@gravity-ai/api` + `@gravity-ai/react`)   | API (direct)                                            |
| ------------------- | ----------------------------------------------- | ------------------------------------------------------- |
| Request ads         | ✅                                               | ✅                                                       |
| Show ads            | ✅ pre-built renderers                           | ✅ your code                                             |
| Impression tracking | ✅ automatic                                     | You fire `impUrl` when ad becomes visible               |
| Experiments (A/B)   | ✅ variants auto-swap via `ad.variant`           | Handle `ad.variant` yourself if you want to participate |
| Updates             | Minor-version bumps pull in engine improvements | You track our changes                                   |

Both paths are fully supported and hit the same engine. The SDK is the fastest path to production if you're on Node / TypeScript / Python / React; the API is the right call if you're on an unusual stack or want full rendering control.

## Supported surfaces

AI chat, coding assistants and IDEs, AI consumer apps, AI-powered search. Any surface where a user has a conversation with a model.

## What to read next

<CardGroup cols={3}>
  <Card title="AI Platforms" icon="newspaper" href="/ai-platforms/quickstart">
    Integration guide, SDK docs, pixel, going live, payouts.
  </Card>

  <Card title="Advertisers" icon="bullhorn" href="/advertisers/quickstart">
    Campaign setup, pixel, and conversion tracking.
  </Card>

  <Card title="API Reference" icon="code" href="/engine/introduction">
    Full HTTP API surface. Authentication, endpoints, response codes.
  </Card>
</CardGroup>
