Anthropic SDK
The Anthropic SDKs work against Cloakray's Messages endpoint. Set the base URL to https://api.cloakray.com — without /v1, which the SDK adds — and use an Cloakray key.
TypeScript
npm install @anthropic-ai/sdk
import Anthropic from "@anthropic-ai/sdk";
const client = new Anthropic({
baseURL: "https://api.cloakray.com",
apiKey: process.env.CLOAKRAY_API_KEY,
});
const message = await client.messages.create({
model: "claude-opus-4-8",
max_tokens: 1024,
messages: [{ role: "user", content: "Hello, Claude" }],
});
Python
pip install anthropic
import os
import anthropic
client = anthropic.Anthropic(base_url="https://api.cloakray.com", api_key=os.environ["CLOAKRAY_API_KEY"])
message = client.messages.create(
model="claude-opus-4-8",
max_tokens=1024,
messages=[{"role": "user", "content": "Hello, Claude"}],
)
Without changing code
The SDKs read ANTHROPIC_BASE_URL and ANTHROPIC_API_KEY:
export ANTHROPIC_BASE_URL="https://api.cloakray.com"
export ANTHROPIC_API_KEY="ckr_..."
What works
messages.create and messages.stream, with tools, images, PDFs, extended thinking and prompt caching — see Anthropic Messages. The model can be any text model in the catalogue, not only Claude.
Token counting, the Message Batches API, the Files API and the Admin API are not offered.