Python SDK
Install and use the native Ablatic Python SDK
The native Python SDK speaks the Ablatic API directly and exposes extras the compatibility surfaces do not. It is MIT-licensed.
Install
pip install ablaticAuthenticate
Pass the key explicitly:
from ablatic import Ablatic
client = Ablatic(api_key="sk-ablatic-...")Or set ABLATIC_API_KEY in the environment and let the client read it:
export ABLATIC_API_KEY="sk-ablatic-..."from ablatic import Ablatic
client = Ablatic() # reads ABLATIC_API_KEY from the environmentKeys are created in the console. See Authentication for the key format and header schemes.
Chat
from ablatic import Ablatic
client = Ablatic(api_key="sk-ablatic-...")
resp = client.chat.completions.create(
model="talos",
messages=[{"role": "user", "content": "Hello"}],
)
print(resp.choices[0].message.content)The model id is talos. By default it runs in thinking mode. For the lowest latency pass reasoning_effort="none".
Async
An async client mirrors the same surface:
import asyncio
from ablatic import AsyncAblatic
client = AsyncAblatic(api_key="sk-ablatic-...")
async def main():
resp = await client.chat.completions.create(
model="talos",
messages=[{"role": "user", "content": "Hello"}],
)
print(resp.choices[0].message.content)
asyncio.run(main())Native extras
These fields are specific to the Ablatic API.
Glassbox confidence
Opt in per request to record a Glassbox audit trace:
resp = client.chat.completions.create(
model="talos",
messages=[{"role": "user", "content": "Hello"}],
glassbox={"confidence": True},
)Confidence is opt-in and off by default. The score is not calibrated yet, so treat it as a signal, not a probability. With Glassbox off, the trace confidence is null.
Refusal mode
Set refusal_mode="strict" to harden refusal behavior, then check whether the response was a refusal:
resp = client.chat.completions.create(
model="talos",
messages=[{"role": "user", "content": "..."}],
refusal_mode="strict",
)
if resp.was_refused():
print("request was refused")The default is soft.
Audit records
Requests that opted into Glassbox are recorded as audit records. You can fetch one or delete it. Deleting an audit record is a GDPR erasure.
record = client.audit.get(request_id)
client.audit.delete(request_id)Alternative: the openai SDK
If you would rather use the official openai SDK, point it at our base URL. You lose the native extras above but keep a familiar client.
from openai import OpenAI
client = OpenAI(
base_url="https://api.ablatic.ai/v1",
api_key="sk-ablatic-...",
)
resp = client.chat.completions.create(
model="talos",
messages=[{"role": "user", "content": "Hello"}],
)
print(resp.choices[0].message.content)