Welcome to ModelRelay
ModelRelay is the platform for building AI-powered SaaS products. Add AI features to your app, track usage per customer, and start billing—all through a single API.
The Problem
Building AI features into your product means solving multiple hard problems at once:
- Provider complexity - Each AI provider has a different API, auth model, and pricing structure
- Usage tracking - You need to know exactly how much each customer costs you
- Billing integration - Turning AI usage into revenue requires Stripe integration, metering, and invoicing
- Access control - Free users need limits, paid users need higher quotas, enterprise needs custom terms
Most teams cobble together LangChain, custom billing code, and provider SDKs. It works, but it’s months of engineering that isn’t your core product.
The Solution
ModelRelay handles the infrastructure so you can focus on your product:
graph LR
A[Your App] --> B[ModelRelay]
B --> C[Anthropic]
B --> D[OpenAI]
B --> E[Google AI]
B --> F[xAI]
B --> G[Customers & Billing]
Unified Provider Access
One API for all major AI providers. Switch models without changing code. Use Claude for reasoning, GPT-4o for vision, Gemini for long context—whatever fits your use case.
Built-in Customer Management
Create customers, assign them to tiers, and track their usage automatically. Know exactly what each customer costs you before you send them an invoice.
Stripe-Native Billing
Checkout sessions, subscriptions, and usage-based billing out of the box. Connect your Stripe account and start monetizing AI features immediately.
Tiered Access Control
Define tiers with different limits and pricing. Free tier gets 100 requests/month. Pro gets 10,000. Enterprise gets unlimited. ModelRelay enforces the limits automatically.
Three Credential Types
- Publishable keys (
mr_pk_*) - Safe for frontends, limited to public operations - Secret keys (
mr_sk_*) - Full access for your backend - Customer tokens - Scoped to a single customer, perfect for end-user requests
Quick Start
import { ModelRelay } from '@modelrelay/sdk';
const mr = new ModelRelay({ apiKey: process.env.MODELRELAY_API_KEY });
// Make an AI request
const answer = await mr.responses.text(
'claude-sonnet-4-20250514',
'You are a helpful assistant.',
'What is the capital of France?'
);
console.log(answer);
// "The capital of France is Paris."
Official SDKs
ModelRelay provides official SDKs with consistent APIs across languages:
- TypeScript SDK -
npm install @modelrelay/sdk - Go SDK -
go get github.com/modelrelay/sdk-go - Rust SDK -
modelrelay = "0.93"
Next Steps
- Getting Started - Create your first project and make a request
- Guides - Learn streaming, tool use, and structured output
- API Reference - Complete endpoint documentation