Skip to main content

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.

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.

Quickstart

From zero to your first ad in under five minutes.

How it works

The request flow, the auction, and what makes matching contextual.

Who this is for

AI Platforms

Running an AI chat, coding assistant, search app, or consumer AI product. Show ads, earn revenue.

Advertisers

Brands running campaigns across the Gravity network. Target by conversation context, pay per impression.

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, 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✅ automaticYou fire impUrl when ad becomes visible
Experiments (A/B)✅ variants auto-swap via ad.variantHandle ad.variant yourself if you want to participate
UpdatesMinor-version bumps pull in engine improvementsYou 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.

AI Platforms

Integration guide, SDK docs, pixel, going live, payouts.

Advertisers

Campaign setup, conversion pixel, analytics.

API Reference

Full HTTP API surface. Authentication, endpoints, response codes.