OpenAI and Anthropic SDKs
Rendered from docs/clients/sdk-protocols.md at commit 18614e438388. The repository file is authoritative.
Checked 2026-12-05 against openai 3.63.0 and anthropic 2.17.0 (Python), with simulated models
(scripts/protocol_sdk_check.py; record in docs/live-runs/2026-12-04-roadmap/protocol-sdk-check.txt).
Status: wire-compatible with both SDKs' own parsers. With a real model: one responses.create(store=False)
and one messages.create completed through these SDK versions on 2026-12-05 (GX10, Ollama 0.40.16, qwen3.8,
the commit tagged v0.2.0; operator-reported, docs/live-runs/2026-12-05-gx10-0.2.0-canary/). Streaming, tools
and images through the SDKs, and any real agent client, have not been run with a real model.
The exact contract — what is translated, what is refused — is docs/protocols.md.
OpenAI SDK (Chat Completions or Responses)
from openai import OpenAI
client = OpenAI(base_url="http://127.0.0.1:8484/v1", api_key=open("/path/to/.modelsaar/keys/api_keys").readline().strip())
client.chat.completions.create(model="auto", messages=[{"role": "user", "content": "hi"}])
client.responses.create(model="auto", input="hi") # stateless: the answer says store=false
with client.responses.stream(model="auto", input="hi") as s: ...
- Send the whole conversation in
inputon every turn.previous_response_id,conversation,store=True,background, hosted tools andincludeare refused with400(codeunsupported_stateful_feature/unsupported_responses_feature) — there is no response store. - Function tools work as with Chat Completions; replay
function_callandfunction_call_outputitems yourself. On an Ollama backendtool_choice="required"is refused, not weakened. - A client that can only use stored conversation state (it never resends history) cannot work with a stateless gateway; configure it for Chat Completions if it offers that.
Anthropic SDK
import anthropic
client = anthropic.Anthropic(base_url="http://127.0.0.1:8484", api_key="<ModelSaar API key>") # no /v1: the SDK adds it
client.messages.create(model="auto", max_tokens=512, messages=[{"role": "user", "content": "hi"}])
- The ModelSaar key travels in
x-api-key(what the SDK sends) orAuthorization: Bearer. modelis a ModelSaar alias or deployment id (auto,auto-code,ollama/qwen3.8:latest); Anthropic model names mean nothing here and get404 model_not_found. A client that insists on its own model names needs an alias of that name:aliases: {"<the-name-the-client-sends>": {profile: quality}}.- Refused with
400:thinkingbudgets,top_k, server tools (web search, bash, computer use, text editor, code execution),mcp_servers, documents/files,redacted_thinking. Recorded but not forwarded:cache_control,tool_result.is_error. /v1/messages/count_tokensand batches are501. A client that requires token counting before each turn will not start.
Agent clients built on these protocols
Not verified with any real agent client. What to expect from the contract alone: a coding agent that
sends hosted tools, thinking budgets or stored-state references on every request will receive the typed
400 naming the field; one that sends plain messages and custom function tools will be routed like any
chat request, with tool-round-trip affinity keyed by the tool-call ids. Before relying on one, run a
real turn and look at modelsaar decisions --limit 5 — and treat a working chat turn as evidence for
that turn only.