OpenAI Compatibility
Use the OpenAI SDK against Ablatic
Point the official OpenAI SDK at Ablatic and keep your code. Three things change: the base URL, the key, and the model.
What to change
Keep the openai SDK you already use. Then:
- Set
base_urltohttps://api.ablatic.ai/v1. - Set
api_keyto your Ablatic key, which looks likesk-ablatic-.... - Set
modeltotalos.
Everything else stays the same. Auth uses the Authorization: Bearer header that the SDK already sends.
Python
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)JavaScript
import OpenAI from "openai";
const client = new OpenAI({
baseURL: "https://api.ablatic.ai/v1",
apiKey: "sk-ablatic-...",
});
const resp = await client.chat.completions.create({
model: "talos",
messages: [{ role: "user", content: "Hello" }],
});
console.log(resp.choices[0].message.content);Streaming
Set stream: true and read tokens over Server-Sent Events. The stream terminates with a data: [DONE] line, the same as OpenAI.
stream = client.chat.completions.create(
model="talos",
messages=[{"role": "user", "content": "Write a haiku about Linz"}],
stream=True,
)
for chunk in stream:
print(chunk.choices[0].delta.content or "", end="")Compatibility notes
response_format is supported on this surface. You can request text, json_object, or json_schema. This is the OpenAI-style surface, so structured outputs work here. On the Anthropic-style surface they do not.
Two norms are worth knowing if you carry options over from another OpenAI-compatible provider:
- Expect
nto be 1. Request a single completion per call. - Very high
temperatureis treated conservatively. The accepted range is 0 to 2. Keep values modest for predictable behavior.
The model field is not strictly validated. Send model="talos" and set the reasoning mode with reasoning_effort: none/minimal (fast), low (brief thinking), medium (thinking), high/xhigh/max (thinking, larger reasoning budget). An unknown effort value falls back to thinking rather than failing.
Vercel AI SDK
The AI SDK's OpenAI provider defaults to the Responses API. Ablatic serves it, so the default path works:
import { createOpenAI } from "@ai-sdk/openai";
import { generateText } from "ai";
const ablatic = createOpenAI({
baseURL: "https://api.ablatic.ai/v1",
apiKey: "sk-ablatic-...",
});
const { text } = await generateText({
model: ablatic("talos-preview"), // -> /v1/responses (stateless)
prompt: "Hello",
});The Responses surface is stateless and does not surface the reasoning trace (see Responses). If you want the reasoning trace or the Chat Completions shape, use ablatic.chat("talos-preview"), which targets /v1/chat/completions.