ModelSaar

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: ...

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"}])

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.