Anthropic Integration
Use Noirdoc with the Anthropic Python and Node.js SDKs.
Overview
Noirdoc supports the Anthropic Messages API out of the box. Point the Anthropic SDK at the Noirdoc proxy and replace your API key with a Noirdoc proxy key. PII is pseudonymized before reaching Anthropic and restored transparently in the response.
Important: base URL has no /v1 suffix
The Anthropic SDK automatically appends /v1 to the base URL. Set the base URL to https://api.noirdoc.de without a trailing /v1:
# Correct
base_url="https://api.noirdoc.de"
# Wrong — results in double /v1/v1
base_url="https://api.noirdoc.de/v1"
Python — Messages API
Install the Anthropic SDK:
pip install anthropic
from anthropic import Anthropic
client = Anthropic(
base_url="https://api.noirdoc.de",
api_key="px-your-noirdoc-key",
)
message = client.messages.create(
model="claude-sonnet-4-6",
max_tokens=1024,
messages=[
{
"role": "user",
"content": "Summarize the contract for Max Mustermann, born 15.03.1985, IBAN DE89370400440532013000.",
}
],
)
print(message.content[0].text)
Noirdoc detects the x-api-key header used by the Anthropic SDK, routes the request through the Anthropic pipeline, and pseudonymizes entities like PERSON, DATE, and IBAN before the prompt reaches Claude.
Node.js
npm install @anthropic-ai/sdk
import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({
baseURL: "https://api.noirdoc.de",
apiKey: "px-your-noirdoc-key",
});
const message = await client.messages.create({
model: "claude-sonnet-4-6",
max_tokens: 1024,
messages: [
{
role: "user",
content: "Send a reminder to julia.weber@example.com about her appointment on 2025-04-10.",
},
],
});
console.log(message.content[0].text);
Streaming
Streaming is fully supported. The proxy reidentifies pseudonyms in real time as SSE chunks arrive. See the Streaming page for SDK examples and SSE details.
Supported models
All Anthropic models work through Noirdoc, including claude-sonnet-4-6, claude-opus-4-6, claude-haiku-4-5-20251001, and future releases. Noirdoc does not filter the model parameter — it forwards the pseudonymized request to Anthropic as-is.
Authentication details
The Anthropic SDK sends the API key via the x-api-key header. Noirdoc detects this header format and routes the request through the Anthropic provider pipeline automatically. No additional configuration is needed.
Your Anthropic provider key is stored securely in the Noirdoc portal and never appears in your application code.