Use Redline with the Vercel AI SDK

The Vercel AI SDK reaches a custom endpoint through @ai-sdk/openai-compatible. Use it rather than the plain openai provider, whose default path is the Responses API that Redline does not serve.

createOpenAICompatible

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

const redline = createOpenAICompatible({
  name: "redline",
  baseURL: "https://redline-gateway.pages.dev/v1",
  apiKey: process.env.REDLINE_API_KEY,
  includeUsage: true,
});

const { text } = await generateText({
  model: redline("deepseek/deepseek-chat-v3.1"),
  prompt: "Hello",
});
console.log(text);
Why not @ai-sdk/openai The plain openai provider defaults to the Responses API, which 404s on Redline. If you must use it, call redline.chat("id") to force chat completions. The openai-compatible provider is the one to reach for.

Related guides