ASAI inference

Last updated: 2026-10-29An OpenAI-compatible chat completions endpoint — keys, models, streaming, tool calls, how a request is paid for, and the errors you can get.

ASAI inference

An OpenAI-compatible endpoint. Point any OpenAI SDK at it, change the base URL and the model name, and it works — streaming and tool calls included.

text
Base URL   https://asai.aperturesyndicate.com/api/v1
MethodEndpoint
POST/chat/completionsChat completion, streamed or whole
GET/modelsThe three model names

Keys

Every request carries Authorization: Bearer asai_…. There are two kinds of asai_ key, and they differ only in who pays:

KeyWhereWho pays
Dev Studio keyDev Studio → ASAI keysThe wallet folder the key is attached to, at twice the model's price. No ASAI plan needed
Personal keyASAI → Settings → APIYour ASAI energy, the same pool as the chat. Needs ASAI Pro or Etherane

A key is shown once, when it is created — we keep only its hash. Revoke a leaked key and issue a new one. Keys from the old developer portal list, the ones that do not start with asai_, do not open this API.

Models

ModelFor
asai-miniFast everyday answers
asai-arcHarder reasoning, longer answers
asai-codeCode — the default when the name matches nothing

The name is matched loosely: anything containing arc goes to asai-arc, anything containing mini or chat to asai-mini, everything else to asai-code. The model field of the response always carries one of the three public names.

Request

python
from openai import OpenAI

client = OpenAI(
    api_key="asai_…",
    base_url="https://asai.aperturesyndicate.com/api/v1",
)

stream = client.chat.completions.create(
    model="asai-code",
    messages=[{"role": "user", "content": "Explain this stack trace"}],
    stream=True,
)
for chunk in stream:
    print(chunk.choices[0].delta.content or "", end="")
Field
modelOne of the names above
messagesNon-empty; roles system, user, assistant, tool. content is a string or a list of text and image_url parts
streamtrue for server-sent events in the OpenAI chunk format
temperatureOptional
max_tokens / max_completion_tokensOptional, capped at 32 768. Without it each model uses its own default
toolsFunction tools; parameters must be a JSON schema with type: "object"
tool_choiceauto, none, required, or a named function

Other OpenAI fields are ignored. Responses follow the OpenAI format, including usage.

How a request is paid for

A request costs what its tokens cost on the model that answered: fresh input, cached input and output are priced separately.

  • Dev Studio key — twice that price is charged to the key's wallet folder after the answer, including a stream you cut off midway. When the folder reaches zero, requests get 402 until you add funds in Wallet.
  • Personal key — the price is taken from your ASAI energy, with the same weekly budget and daily brake as the chat. asai-arc is open on plans that include it.

Errors

Errors come in the OpenAI shape, so SDKs raise their usual exceptions:

json
{ "error": { "message": "Invalid API key.", "type": "invalid_request_error", "code": "invalid_api_key" } }
StatuscodeMeans
400invalid_requestBody is not JSON, or messages is empty or malformed
401invalid_api_keyMissing, wrong or revoked key
402budget_exhaustedThe wallet folder behind a Dev Studio key is empty
403model_not_availablePersonal key: the plan has no API access, or no asai-arc
429invalid_request60 requests per minute per key exceeded, or a personal key ran out of daily or weekly energy — the message says which
503billing_unavailableWe could not check the wallet folder — retry
5xxThe model service is unavailable — retry with backoff

Rules

  • Do not resell access to the API.
  • Keep keys on your server. A key in a browser bundle or an app binary will be found.
  • Content rules are the same as in the chat: ASAI Acceptable Use.
  • Full terms: Developer & API Terms.
ASAI inference | AS Docs