The full pipeline
The production-grade default
All five middlewares composed in the recommended order -- this is the exact pipeline the README leads with.
← All recipes
import { Klaro, retries, budget, secrets, pii, logging } from "@klaroshield/sdk";
import OpenAI from "openai";
const openai = new OpenAI();
const klaro = new Klaro()
.use(retries({ max: 3, backoff: "exponential" }))
.use(budget({ maxMonthlyUsd: 50 }))
.use(secrets({ mode: "mask" }))
.use(pii({ mode: "mask" }))
.use(logging({ format: "pretty" }));
const chat = klaro.wrap(
openai.chat.completions.create.bind(openai.chat.completions)
);Checked against the shipped @klaroshield/sdk API. Full docs at klaro.services/klaroshield/docs.