Celedog + Vercel AI SDK Tutorial

Vercel's AI SDK is the modern toolkit for streaming AI apps. Wired through Celedog, it gains access to GPT, Claude, Gemini, and the full 200+ catalog through one provider object.

The Vercel AI SDK has first-class support for OpenAI-compatible providers, which is exactly what Celedog is. Configure a custom provider once and every AI SDK helper — generateText, streamText, tool calling — works against 200+ models.

Create a Celedog provider

Use createOpenAI from the AI SDK's OpenAI package, pointing baseURL at Celedog and reading the key from the environment.

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

export const celedog = createOpenAI({
  baseURL: "https://celedog.io/v1",
  apiKey: process.env.CELEDOG_API_KEY,
});

Generate and stream

generateText returns a full completion; streamText streams tokens for a responsive UI. Both take celedog(modelId) so you choose the model inline.

import { generateText } from "ai";
import { celedog } from "./celedog";

const { text } = await generateText({
  model: celedog("gpt-5.5"),
  prompt: "Explain an AI gateway to a product manager.",
});
console.log(text);

Streaming in a route

In a Next.js route, streamText returns a response you can hand straight back to the client with toDataStreamResponse, giving you a streaming chat endpoint in a few lines.

import { streamText } from "ai";
import { celedog } from "./celedog";

export async function POST(req) {
  const { messages, model } = await req.json();
  const result = streamText({
    model: celedog(model || "gpt-5.5"),
    messages,
  });
  return result.toDataStreamResponse();
}

Switch models freely

Pass any Celedog model id to celedog() — "claude-opus-4-7", "gemini-2.5-pro", "deepseek-v4-pro" — and the rest of your AI SDK code is unchanged. Tool calling and structured output work with the model families that support them.

One provider object, every AI SDK helper, 200+ models. The Vercel AI SDK plus Celedog is the fastest way to ship a model-agnostic AI feature in a TypeScript app.

Written by · Last updated May 28, 2026

Where to go next