OpenAI TypeScript SDK with Redline

The Node OpenAI client takes a baseURL in its constructor. Set it to Redline and your chat.completions calls route through the gateway.

baseURL and apiKey

// npm install openai
import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://redline-gateway.pages.dev/v1",
  apiKey: "rl-...",
});

const resp = await client.chat.completions.create({
  model: "deepseek/deepseek-chat-v3.1",
  messages: [{ role: "user", content: "Hello" }],
});
console.log(resp.choices[0].message.content);

Use baseURL: "https://redline-gateway.pages.dev/v1" and apiKey for the key, or set OPENAI_BASE_URL and OPENAI_API_KEY in the environment. Stay on chat.completions.create; the Responses API is not served.

Related guides