Stav speaks the Anthropic Messages contract as a first-class API surface, in parallel with the OpenAI Chat Completions one. If you already use the official Anthropic SDK, the migration is two lines.
The change
Python
import anthropic
client = anthropic.Anthropic(
base_url="https://api.stav.ai/v1", # ← was api.anthropic.com
api_key=os.environ["STAV_API_KEY"], # ← was ANTHROPIC_API_KEY
)
Node / TypeScript
import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({
baseURL: "https://api.stav.ai/v1", // ← was api.anthropic.com
apiKey: process.env.STAV_API_KEY,
});
Every other call — messages.create, messages.stream, tool use, extended thinking, prompt caching, vision — works as published in the Anthropic SDK.
How Stav serves Anthropic requests
There are two paths under the hood, and which one you get depends on the model identifier:
Both paths support streaming, tools, and structured output. The decision is per-request, based on the model you pass.
Model identifiers
client.messages.create(model="claude-sonnet-4-5", ...) # → Anthropic upstream
client.messages.create(model="claude-haiku-4-5-20251001", ...) # → Anthropic upstream
client.messages.create(model="anthropic/claude-sonnet-4-5", ...) # alias, same as above
client.messages.create(model="qwen3-32b", ...) # → sovereign worker
client.messages.create(model="auto", ...) # → Smart Router
client.messages.create(model="meta-llama/llama-4-maverick", ...) # → sovereign worker
The catalogue at /v1/public/models lists every identifier with its sovereignty tier and pricing.
What's identical (for claude-* models)
What's identical (for sovereign models)
The translation layer covers the common surface area, but with two natural limits:
- Anthropic-only features map to their closest equivalent.
thinkingbecomes equivalent reasoning steering on models that support it (most large sovereign models do).cache_controlmarkers are honoured by Stav's prompt-caching layer. - Beta flags that require Anthropic-specific implementations (e.g. computer-use tools, which require Anthropic's vision-action models) only work with
claude-*models.
If you need a feature that's specifically Anthropic's implementation, target a Claude model. If you need any compatible model on the same SDK and call shape, point at auto or any sovereign model identifier — the translation handles the rest.
What's different — Stav extensions
The same set of extensions as the OpenAI surface. You can use them with the Anthropic SDK by passing them as extra_headers or in the body (the Anthropic SDK doesn't have a built-in extra_body parameter — see below).
Sovereignty tier on every response
response = client.messages.with_raw_response.create(
model="claude-sonnet-4-5", max_tokens=1024,
messages=[{"role": "user", "content": "..."}],
)
tier = response.headers["X-Stav-Sovereignty-Tier"] # "routed-commercial" for claude-*
parsed = response.parse()
model="auto" — Smart Router
Same semantics as the OpenAI side. model="auto" lets the Smart Router pick the best model per request based on team policy, including the option to land on a Claude model. The response carries X-Stav-Selected-Model so you know what ran.
:fast / :precision tier suffix
Append to any sovereign model identifier. Claude models do not have a tier suffix — Anthropic chooses the quantization for their hosted endpoints.
Sovereign built-in tools
Pass stav.*-named tools in the tools array; Stav executes them server-side and folds the result back into the conversation in the same request. See Built-in tools.
client.messages.create(
model="auto",
max_tokens=1024,
messages=[{"role": "user", "content": "What did the EU AI Act say about general-purpose model obligations?"}],
tools=[{"name": "stav.web_search", "description": "Stav sovereign web search", "input_schema": {"type": "object", "properties": {}}}],
)
(The Anthropic schema requires an input_schema; Stav ignores its content for stav.* tools — the canonical schema is server-side.)
Stav-specific request parameters
When using the Anthropic SDK, Stav extensions go in extra_headers:
client.messages.create(
model="auto",
max_tokens=1024,
messages=[...],
extra_headers={
"X-Stav-Sovereignty-Required": "true",
"X-Stav-Max-Tool-Iterations": "3",
},
)
Migrating a real codebase — checklist
Known compatibility gaps
- Computer-use tools. Only work with
claude-*models. Stav doesn't yet have a sovereign equivalent (it's on the sovereign-tools roadmap; see the sovereign-tools strategy doc). - PDF / files upload via Anthropic's Files API. Use the
stav.file_searchingestion pipeline (/v1/vector_stores) instead.
Next steps
- OpenAI SDK migration — if you also have OpenAI-SDK call sites.
- Built-in tools — sovereign tools accessible through both SDKs.
- Smart Router — the cost-down recommendation that follows the base-URL swap.