onrup

SDKs and HTTP · TypeScript

OpenAI Node SDK

How do I use OpenAI Node SDK with Onrup?

Construct the OpenAI client with baseURL set to your deployment and apiKey set to an Onrup key. Chat completions, streaming and tool calling all work without further change, because the wire format is the same.

The official TypeScript and JavaScript client for the OpenAI API.

Minimal working example

import OpenAI from "openai";

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

const response = await client.chat.completions.create({
  model: "default",
  messages: [{ role: "user", content: "Extract the invoice total." }],
});

console.log(response.choices[0].message.content);

The thing that catches people out

The SDK refuses to run in a browser unless you explicitly opt in, and you should not opt in — that would ship your API key to every visitor. Call the endpoint from a server route.

Worth knowing

Other sdks and http

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.