Anthropic-compatible API
Base URL: https://<hub-host>/anthropic, API key: a client key (sk-aigw-…), sent as x-api-key (what
ANTHROPIC_API_KEY sends) or Authorization: Bearer. anthropic-version and anthropic-beta headers are
accepted and ignored.
Requests run on chat models of your own nodes (llama.cpp on kinherd-node), with the same rules as the
OpenAI-compatible API: key scopes, your own devices first, local-only keys, rate and token
limits, daily quotas, budgets and the audit log. Cloud models are not served here.
| Method | Path | Notes |
|---|---|---|
| POST | /v1/messages |
model (a node chat model id), max_tokens (required, capped by the hub), messages with text, base64 image, tool_use and tool_result blocks, system, tools (custom tools), tool_choice, stop_sequences, temperature, top_p. stream: true sends the Anthropic events (message_start, content_block_delta with text_delta or input_json_delta, message_delta, message_stop) |
| POST | /v1/messages/count_tokens |
an estimate (about 4 characters per token); no node runs |
| GET | /v1/models, /v1/models/{id} |
the node chat models your key may use |
Not supported (400): image URL or file sources, document blocks and server tools (web search, code execution, …).
thinking and cache_control are ignored. Errors use the Messages API error shape.
Environment variables
Section titled “Environment variables”The Anthropic SDKs and most Messages API clients read these:
export ANTHROPIC_BASE_URL=https://<hub-host>/anthropicexport ANTHROPIC_API_KEY=sk-aigw-…The model is a node chat model id from GET /anthropic/v1/models, for example qwen3-coder-30b. Coding clients
need tool use and a large context: pick a coding model that knows tools, and set it up on its node
with "tools": true and a context of 32k tokens or more.
Python
Section titled “Python”import anthropicc = anthropic.Anthropic(base_url="https://<hub-host>/anthropic", api_key="sk-aigw-…")m = c.messages.create(model="qwen2.5-1.5b-instruct", max_tokens=256, messages=[{"role": "user", "content": "Hi"}])print(m.content[0].text)Sealed (end-to-end encrypted) bodies are not accepted here: the hub would have to read a request to translate it. Use the native run API for sealed requests.