onrup

Frameworks · TypeScript

Vercel AI SDK

How do I use Vercel AI SDK with Onrup?

Create an OpenAI-compatible provider with your deployment’s base URL and use it with streamText or generateText. Streaming to a React interface works exactly as it does with any other provider.

A TypeScript toolkit for building streaming language-model interfaces in web applications.

Minimal working example

import { createOpenAICompatible } from "@ai-sdk/openai-compatible";
import { streamText } from "ai";

const onrup = createOpenAICompatible({
  name: "onrup",
  baseURL: "https://serve.onrup.com/<tenant>/<deployment>/v1",
  apiKey: process.env.ONRUP_API_KEY,
});

const result = streamText({
  model: onrup("default"),
  prompt: "Draft a reply to this complaint.",
});

The thing that catches people out

Use the openai-compatible provider rather than the OpenAI one. The dedicated OpenAI provider assumes endpoints and behaviours that only OpenAI implements, and the failures are confusing.

Worth knowing

Other frameworks

Start with the free tier

A magic link creates your account, your tenant and your first API key. No card until you ask for compute.