SDKs

Relai is OpenAI-compatible, so you can use any OpenAI client by pointing it at our gateway. For first-class support — multi-region routing, per-user metering, native quota warnings, and typed errors — we publish two official packages on npm.

Available Packages

  • @llmrelai/sdk — Native TypeScript SDK with chat completions, multi-region keys, per-user metering, and access to Relai-specific resources (balance, usage, keys, billing).
  • @llmrelai/ai-sdk-provider — Provider for the Vercel AI SDK. Use Relai with generateText, streamText, useChat, and the rest of the AI SDK ecosystem.

Which one should I use?

  • Building a chat UI with React/Next.js and want streaming hooks? Use @llmrelai/ai-sdk-provider.
  • Building a backend service, agent, or anything that needs Relai-native features (balance, usage, end-user quotas)? Use @llmrelai/sdk.
  • Already using the OpenAI SDK and want zero changes? Just swap the baseURL — see the Quickstart.

Installation

# Native SDK
npm install @llmrelai/sdk

# Vercel AI SDK provider
npm install @llmrelai/ai-sdk-provider ai

Both packages are MIT-licensed and published to npm under the @llmrelai scope.