OpenAI SDK
The official OpenAI SDKs work unchanged. Set the base URL to https://api.abliteratedllm.dev/v1 and use your API key. Both chat completions and the stateless Responses API are available.
Placeholders:
$API_BASEishttps://api.abliteratedllm.dev/v1,$API_ORIGINishttps://api.abliteratedllm.dev, and$YOUR_KEYis your API key.
Both SDKs also read the OPENAI_BASE_URL and OPENAI_API_KEY environment variables, so existing code can switch without edits:
export OPENAI_BASE_URL="$API_BASE"
export OPENAI_API_KEY="$YOUR_KEY"
Python
pip install openai
Chat completions, streamed:
from openai import OpenAI
client = OpenAI(base_url="$API_BASE", api_key="$YOUR_KEY")
stream = client.chat.completions.create(
model="glm-5.3-flash-abliterated",
messages=[
{"role": "system", "content": "You are a witty fantasy narrator."},
{"role": "user", "content": "Describe a tavern brawl in four sentences."},
],
reasoning_effort="low",
max_tokens=1024,
stream=True,
)
for chunk in stream:
# Usage arrives in a final chunk whose choices list is empty.
if chunk.choices:
print(chunk.choices[0].delta.content or "", end="", flush=True)
if chunk.usage:
print(f"\n\n{chunk.usage.prompt_tokens} in, {chunk.usage.completion_tokens} out")
Responses API (stateless, so send the whole conversation each time):
response = client.responses.create(
model="glm-5.3-flash-abliterated",
instructions="Answer in one sentence.",
input="What is the boiling point of water at sea level in Fahrenheit?",
reasoning={"effort": "low"},
)
print(response.output_text)
JavaScript and TypeScript
npm install openai
Chat completions, streamed:
import OpenAI from "openai";
const client = new OpenAI({ baseURL: "$API_BASE", apiKey: "$YOUR_KEY" });
const stream = await client.chat.completions.create({
model: "glm-5.3-flash-abliterated",
messages: [
{ role: "system", content: "You are a witty fantasy narrator." },
{ role: "user", content: "Describe a tavern brawl in four sentences." },
],
reasoning_effort: "low",
max_tokens: 1024,
stream: true,
});
for await (const chunk of stream) {
// Usage arrives in a final chunk whose choices array is empty.
process.stdout.write(chunk.choices[0]?.delta?.content ?? "");
if (chunk.usage) console.log(`\n\n${chunk.usage.prompt_tokens} in, ${chunk.usage.completion_tokens} out`);
}
Responses API:
const response = await client.responses.create({
model: "glm-5.3-flash-abliterated",
instructions: "Answer in one sentence.",
input: "What is the boiling point of water at sea level in Fahrenheit?",
reasoning: { effort: "low" },
});
console.log(response.output_text);
Good to know
- Errors use the OpenAI shape, so the SDKs raise their usual exceptions (
RateLimitError,AuthenticationErrorand so on). Each error carries one of our error codes incode. - Retries. By default the SDKs retry 429 and 5xx responses a few times and honor the
Retry-Afterheader we send withcapacity_exhausted. - Responses are stateless:
storeis alwaysfalse, andprevious_response_idreturns 400stateless_only. See POST /v1/responses. - Text only. Image, audio and file inputs fail with 400
unsupported_content.
Verified against OpenAI SDK docs on 2026-11-03: openai-python (base_url, OPENAI_BASE_URL) and openai-node (baseURL, OPENAI_BASE_URL).