Integrations
FastAPI integration
Proxy abliteration.ai through FastAPI with an async httpx client. OpenAI-compatible chat completions.
Updated 2026-01-03
Create a small FastAPI endpoint that forwards prompts to abliteration.ai.
Keep your ABLIT_KEY in an environment variable and return the JSON response.
from fastapi import FastAPI
from pydantic import BaseModel
import httpx
import os
app = FastAPI()
class ChatIn(BaseModel):
prompt: str
@app.post("/chat")
async def chat(payload: ChatIn):
async with httpx.AsyncClient() as client:
res = await client.post(
"https://api.abliteration.ai/v1/chat/completions",
headers={
"Authorization": f"Bearer {os.environ['ABLIT_KEY']}",
"Content-Type": "application/json",
},
json={
"model": "abliterated-model",
"messages": [{"role": "user", "content": payload.prompt}],
},
)
return res.json()