Docs / Recipes / Anthropic SDK
// LANGUAGE SDK · ANTHROPIC
Anthropic SDK (native /v1/messages)
Pattern A · full governance
Keep the official Anthropic SDK. Point it at the Agentics native ingress and pass your ak_ key as the Anthropic API key — the SDK appends /v1/messages and every call is governed and receipted.
Pattern A — routed through the gateway. Your call travels through Agentics via a base-URL swap, so it is governed (routing, budgets, guardrails) inline and the Proof Ledger writes one verifiable receipt server-side. The receipt hash comes back in the
x-agentics-receipt response header.
Install
shell
pip install anthropicPoint the SDK at Agentics
Set base_url to https://agentics.you (the SDK adds /v1/messages). Your ak_ key is sent as the Anthropic x-api-key.
Python
from anthropic import Anthropic
client = Anthropic(
base_url="https://agentics.you", # native Anthropic ingress
api_key="ak_…", # your Agentics key, sent as x-api-key: ak_…
)Run one call → see the receipt
Python
resp = client.messages.with_raw_response.create(
model="claude-opus-4-8",
max_tokens=256,
messages=[{"role": "user", "content": "hi"}],
)
print(resp.headers["x-agentics-receipt"]) # the receipt_hash you can verifyPrefer raw HTTP? The header comes back the same way:
cURL
curl https://agentics.you/v1/messages -i \
-H "x-api-key: ak_…" \
-H "anthropic-version: 2023-06-01" \
-H "content-type: application/json" \
-d '{"model":"claude-opus-4-8","max_tokens":256,
"messages":[{"role":"user","content":"hi"}]}'
# response header: x-agentics-receipt: <receipt_hash>