Docs
Build on the Relay AI gateway
Docs Getting Started

Route your first AI request

Relay is a drop-in gateway for OpenAI, Anthropic, and Gemini — with built-in wallets, multi-tenant quotas, and platform fee monetization. Swap your baseURL and you're live.

node
python
curl
app.ts
import OpenAI from "openai";

const client = new OpenAI({
  apiKey: process.env.RELAY_TENANT_KEY,
  baseURL: "https://gateway.relay.dev/v1",
});

const res = await client.chat.completions.create({
  model: "gpt-4o-mini",
  messages: [{ role: "user", content: "Summarize Q3 revenue" }],
  // Relay-specific routing controls
  // @ts-expect-error provider routing
  relay: { strategy: "cost-optimized", fallback: ["anthropic", "gemini"] },
});
API Keys
Platform vs tenant keys, scopes, and rotation policies.
Read more
Wallets
Compute credits, top-ups, deductions, and reconciliation.
Read more
Billing Modes
Embedded vs Direct Wallet — when to choose each.
Read more