> ## Documentation Index
> Fetch the complete documentation index at: https://docs.abliteration.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Python

> Use the official OpenAI or Anthropic Python SDKs with abliteration.ai by changing the base URL.

Use the official OpenAI or Anthropic Python SDKs by pointing them at abliteration.ai.

## Install

```sh theme={"system"}
pip install openai
```

## OpenAI SDK

```python theme={"system"}
import os
from openai import OpenAI

client = OpenAI(
    base_url="https://api.abliteration.ai/v1",
    api_key=os.environ["ABLIT_KEY"],
)

resp = client.chat.completions.create(
    model="abliterated-model",
    messages=[{"role": "user", "content": "Hello"}],
)
print(resp.choices[0].message.content)
```

## Async

```python theme={"system"}
from openai import AsyncOpenAI

client = AsyncOpenAI(base_url="https://api.abliteration.ai/v1", api_key=os.environ["ABLIT_KEY"])

async def main():
    resp = await client.chat.completions.create(
        model="abliterated-model",
        messages=[{"role": "user", "content": "Hello"}],
    )
    print(resp.choices[0].message.content)
```

## Anthropic SDK

```sh theme={"system"}
pip install anthropic
```

```python theme={"system"}
from anthropic import Anthropic

client = Anthropic(
    base_url="https://api.abliteration.ai",
    api_key=os.environ["ABLIT_KEY"],
)
```

See [Anthropic compatibility](/api/anthropic-compatibility) for details.
