Providers
Anthropic Claude with retries + secret masking
Same pattern as OpenAI -- klaro.wrap() doesn't care which provider's method it's wrapping.
← All recipes
import { Klaro, retries, secrets } from "@klaroshield/sdk";
import Anthropic from "@anthropic-ai/sdk";
const anthropic = new Anthropic();
const klaro = new Klaro()
.use(retries({ max: 3 }))
.use(secrets({ mode: "mask" }));
const chat = klaro.wrap(
anthropic.messages.create.bind(anthropic.messages)
);
const reply = await chat({
model: "claude-3-5-haiku-20241022",
max_tokens: 1024,
messages: [{ role: "user", content: "hello" }],
});Checked against the shipped @klaroshield/sdk API. Full docs at klaro.services/klaroshield/docs.