Skip to main content
Use the official OpenAI or Anthropic JavaScript SDKs by pointing them at abliteration.ai.

Install

npm install openai

OpenAI SDK

import OpenAI from "openai";

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

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

Streaming

const stream = await client.chat.completions.create({
  model: "abliterated-model",
  messages: [{ role: "user", content: "Write a haiku" }],
  stream: true,
});

for await (const chunk of stream) {
  process.stdout.write(chunk.choices[0].delta.content ?? "");
}

Edge runtimes

Works in Cloudflare Workers, Vercel Edge, and Bun. Use fetch directly if you want to avoid the SDK bundle:
const res = await fetch("https://api.abliteration.ai/v1/chat/completions", {
  method: "POST",
  headers: {
    Authorization: `Bearer ${env.ABLIT_KEY}`,
    "Content-Type": "application/json",
  },
  body: JSON.stringify({
    model: "abliterated-model",
    messages: [{ role: "user", content: "Hello" }],
  }),
});
See Cloudflare Workers and Vercel AI SDK for framework-specific setups.