SDK MigrationUpdated 2026-01-22

Switch OpenAI Node SDK base URL

Switch your OpenAI Node SDK to abliteration.ai in one line. Change baseURL and keep your existing TypeScript/JavaScript code.

The OpenAI Node SDK supports custom endpoints via baseURL. Switch to abliteration.ai without rewriting your application.

Your existing async/await patterns, streaming handlers, and TypeScript types work unchanged.

Definition

Switch OpenAI Node SDK base URL

Switching the OpenAI Node SDK base URL means changing one parameter to route requests through an alternative OpenAI-compatible provider.

Why it matters
  • Keep all existing OpenAI Node SDK code unchanged.
  • Full TypeScript type compatibility maintained.
  • Test alternative providers without refactoring your codebase.
  • Works with Express, Next.js, and any Node.js environment.
How it works
  1. 01Install or update the openai npm package.
  2. 02Set baseURL: "https://api.abliteration.ai/v1" in the client constructor.
  3. 03Replace your OpenAI key with your abliteration.ai API key.
  4. 04Use a supported model id like abliterated-model.
Node SDK base URL switch
import OpenAI from "openai";

// Before: OpenAI default
// const client = new OpenAI({ apiKey: "sk-..." });

// After: abliteration.ai
const client = new OpenAI({
  baseURL: "https://api.abliteration.ai/v1",
  apiKey: process.env.ABLIT_KEY,
});

const completion = await client.chat.completions.create({
  model: "abliterated-model",
  messages: [{ role: "user", content: "Summarize this document." }],
});

console.log(completion.choices[0]?.message?.content);
FAQ

Frequently asked questions.

Do TypeScript types still work?

Yes. The response types are identical to OpenAI, so your existing type annotations work unchanged.

Does streaming work?

Yes. Use stream: true and iterate over the async iterator exactly like OpenAI.

Can I use this with Next.js?

Yes. The SDK works in Next.js API routes, Server Actions, and Edge Runtime.