Vercel AI SDK

The Vercel AI SDK reaches UberLLM through the official @ai-sdk/openai-compatible provider.

Install

pnpm add ai @ai-sdk/openai-compatible
# or: npm i ai @ai-sdk/openai-compatible

Configure the provider

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

const uberllm = createOpenAICompatible({
  name: "uberllm",
  apiKey: process.env.UBERLLM_API_KEY,
  baseURL: "https://api.uberllm.dev/v1",
  includeUsage: true, // return token usage on streaming responses
});

Fields:

  • name: an identifier for the provider (used in routing/telemetry).
  • apiKey: your ull_ key (sent as Authorization: Bearer).
  • baseURL: https://api.uberllm.dev/v1.
  • includeUsage: set true so streamed responses carry usage — recommended.

Generate and stream

import { generateText, streamText } from "ai";

// One-shot
const { text } = await generateText({
  model: uberllm("deepseek/deepseek-v4-flash"),
  prompt: "Say hello in one sentence.",
});
console.log(text);

// Streaming
const result = streamText({
  model: uberllm("deepseek/deepseek-v4-flash"),
  prompt: "Count to five.",
});
for await (const delta of result.textStream) {
  process.stdout.write(delta);
}

Routing

Use the plain model id. Every call goes to the cheapest healthy seller on a live marketplace and is billed at the price shown, which includes UberLLM's 10% fee. See Models & routing and Pricing.