Docs

Python SDK quickstart

Use the OpenAI Python SDK with abliteration.ai by setting base_url and api_key. OpenAI-compatible chat completions.

Updated 2026-08-04

The OpenAI Python SDK works with abliteration.ai by setting base_url and api_key.

The request body is the same as OpenAI chat completions, including streaming support.

from openai import OpenAI

client = OpenAI(
    base_url="https://api.abliteration.ai/v1",
    api_key="YOUR_ABLIT_KEY",
)

completion = client.chat.completions.create(
    model="abliterated-model",
    messages=[{"role": "user", "content": "Give me three bullet points."}],
)

print(completion.choices[0].message.content)
FAQ

Frequently asked questions.

How do I fix a 401 Unauthorized error from abliteration.ai?

Check that your API key is set and sent as a Bearer token.

How do I fix a 404 Not Found error from abliteration.ai?

Make sure the base URL ends with /v1 and you call /chat/completions.

How do I fix a 400 Bad Request error from abliteration.ai?

Verify the model id and that messages are an array of { role, content } objects.

How do I fix a 429 Rate limit error from abliteration.ai?

Back off and retry. Use the Retry-After header for pacing.