Anthropic SDK
5/20/26About 1 min
The native /v1/messages protocol gives Claude family models full fidelity — prompt cache, tool use, document blocks.
Python
import anthropic
client = anthropic.Anthropic(
base_url="https://bridge.pulseneko.com",
api_key="sk-your-key",
)
msg = client.messages.create(
model="claude-opus-4-7",
max_tokens=1024,
messages=[{"role": "user", "content": "Hello"}],
)
print(msg.content[0].text)Don't append /v1
The Anthropic SDK appends /v1/messages internally. Set base URL to https://bridge.pulseneko.com. Adding /v1 yourself yields /v1/v1/messages → 404.
Auth
The Anthropic SDK reads ANTHROPIC_API_KEY by default and sends it as x-api-key. Bridge accepts both x-api-key and Authorization: Bearer.
Streaming
with client.messages.stream(
model="claude-sonnet-4-6",
max_tokens=1024,
messages=[{"role": "user", "content": "..."}],
) as stream:
for text in stream.text_stream:
print(text, end="", flush=True)Prompt cache
msg = client.messages.create(
model="claude-opus-4-7",
max_tokens=1024,
system=[
{
"type": "text",
"text": "<long system prompt>",
"cache_control": {"type": "ephemeral"},
}
],
messages=[{"role": "user", "content": "..."}],
)Cache hits are billed at the Cache column on the Model Catalog — usually much lower than Input.
Tool use
msg = client.messages.create(
model="claude-opus-4-7",
max_tokens=1024,
tools=[{
"name": "get_weather",
"description": "Look up weather",
"input_schema": {
"type": "object",
"properties": {"city": {"type": "string"}},
"required": ["city"],
},
}],
messages=[{"role": "user", "content": "What's the weather in Shanghai?"}],
)Node.js
import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({
baseURL: "https://bridge.pulseneko.com",
apiKey: process.env.PULSENEKO_KEY,
});
const msg = await client.messages.create({
model: "claude-opus-4-7",
max_tokens: 1024,
messages: [{ role: "user", content: "Hello" }],
});
console.log(msg.content[0].text);Recommended models
| Model | Best for |
|---|---|
claude-haiku-4-5 | High QPS, low latency, cheap |
claude-sonnet-4-6 | Daily driver |
claude-opus-4-7 | High-quality reasoning, long context |
claude-opus-4-7-thinking | 4.7 + extended thinking |