Use the OpenAI SDK with Autarcho
The official SDKs take a base URL. Give it this endpoint and the rest of your code does not move.
The change
Set base_url and api_key. Nothing else changes.
from openai import OpenAI
client = OpenAI(
base_url="https://api.autarcho.com/v1",
api_key="ak_...",
)
stream = client.chat.completions.create(
model="lfm2-1.2b-extract@1.0",
messages=[{"role": "user", "content": "Summarise this in one line."}],
stream=True,
)
for chunk in stream:
print(chunk.choices[0].delta.content or "", end="") A key is ak_ followed by 64 hex characters, made on your own machine; the start page covers making one and adding credit. Model ids come from the catalogue.
What works
- Streaming, tool calls and JSON output, with the same shapes the SDK already parses.
- A reasoning model returns its scratchpad in
reasoning_content, separate fromcontent. max_price_per_token_micro_usdcas an extra body field refuses a request priced above it before any credit is held.
What to watch
stop,seed,logprobsandnabove 1 are refused with an error rather than ignored.usage.cost_micro_usdcis the amount charged. Read it rather than multiplying tokens by a price, because input is billed too.- A model that is not loaded anywhere has to be downloaded first; stream so the wait is visible.
The full list of what is refused, what is charged and what a retry costs is on the API reference.