Integrations / Vercel AI SDK

ConnectDocumented

Build AI apps with Vercel AI SDK and Badgr

Point the AI SDK at Badgr with the OpenAI-compatible provider and stream responses in TypeScript.

The steps follow the tool's documented settings. No tested run is recorded for this page yet.

Why use Badgr for Vercel AI SDK

Badgr interface
AI API
Where Vercel AI SDK fits
External SDK
Why Badgr
Inference for TypeScript apps
  • The OpenAI-compatible provider works unchanged, so only the base URL, key and model name differ.
  • Streaming works the way your UI already expects.
  • One account for model calls now and GPU work later.

What you can do

  • A streaming chat route in a Next.js app
  • Server actions that summarise or classify text
  • Swap an existing provider for Badgr by changing one model line

Quickstart: TypeScript streaming example

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

const badgr = createOpenAICompatible({
  name: "badgr",
  baseURL: "https://aibadgr.com/v1",
  apiKey: process.env.BADGR_API_KEY,
});

const result = streamText({
  model: badgr("badgr-auto"),
  prompt: "Say hello in one sentence.",
});

for await (const text of result.textStream) process.stdout.write(text);

How it works

  1. 1.Your code calls streamText with the Badgr model
  2. 2.The SDK sends an OpenAI-style request to Badgr
  3. 3.Tokens stream back as they are produced

What you get

  • A text stream you can pipe into a UI or a response

Requirements

  • A Badgr API key, saved as BADGR_API_KEY (get one at /get-api-key)
  • Node.js 18 or newer
  • Packages: ai and @ai-sdk/openai-compatible

What it costs

  • AI requests are billed per request at the rate listed for the model you choose (see Models). This page does not quote a fixed price.
  • Your application keeps control of how many requests it sends. Use the limits in your own tool to cap usage.

See pricing for how billing works.

Proof

No tested run is recorded for this integration yet. A receipt and example output will be added here after a real run, not before.

Troubleshooting

  • baseURL ignored or wrong path

    Use https://aibadgr.com/v1. The provider appends /chat/completions itself.

  • apiKey is undefined at build time

    Read BADGR_API_KEY on the server only, and confirm it is set in your hosting environment.

  • Stream ends early

    Check your hosting platform's function time limit. Long streams need a longer limit.

Developer reference

Ready to start with Vercel AI SDK?

Every run or service has a spending limit you set before it starts.