docs

Use the OpenAI SDK with an uncensored API

The gateway implements the chat-completions shape, not the full OpenAI platform. That means the official SDKs work for chat, streaming and tools; Responses, embeddings and audio do not.

Last updated: 2026-10-23

Python

import os
from openai import OpenAI

client = OpenAI(
    base_url="https://abliteratly.beer/v1",
    api_key=os.environ["ABLITERATLY_API_KEY"],
)

r = client.chat.completions.create(
    model="magnum-v4-72b",
    messages=[
        {"role": "system", "content": "You are concise."},
        {"role": "user", "content": "Explain the trade-off in one paragraph."},
    ],
    temperature=0.7,
    max_tokens=400,
)
print(r.choices[0].message.content)
print(r.usage)

JavaScript / TypeScript

import OpenAI from "openai";

const client = new OpenAI({
  baseURL: "https://abliteratly.beer/v1",
  apiKey: process.env.ABLITERATLY_API_KEY!,
});

const r = await client.chat.completions.create({
  model: "magnum-v4-72b",
  messages: [{ role: "user", content: "Reply with OK." }],
  max_tokens: 20,
});
console.log(r.choices[0]?.message?.content);

Tools

Pass a standard tools array and handle tool_calls in the response. Only use models whose model page lists tool support. Test a full loop: model call, tool execution, tool result message, second model call. A single successful call is not enough.

Streaming

Set stream: true and accumulate delta.content. Some models pause between chunks while reasoning; set a generous client timeout. If your client aborts a slow stream, the request may still be billed for generated tokens.

What not to use

Configuration tips

Keep the base URL at /v1; the SDK appends the resource path. Use environment variables or a secret file, never a key in source control. Set a client timeout and retry 502/503 with exponential backoff. Handle 429 using Retry-After. For a full first request, see the quickstart.

Questions

Which SDK should I use?

Any OpenAI-compatible client works for chat completions. The official OpenAI Python and JavaScript SDKs are the shortest path. Use @ai-sdk/openai-compatible for OpenCode.

Does the SDK need a special provider?

No. Set base_url to the API's /v1 endpoint and use a model ID from the catalog. Do not use the Responses API; this gateway implements chat completions.

Can I use async clients?

Yes, if the client supports a custom base URL. The wire format is the standard chat-completions shape.

Why is the model list empty in my client?

Custom providers may require you to list models manually. Copy enabled IDs from the directory; not every client discovers custom model catalogs.

Create account - no emailSee pricingBrowse models