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 { Maskea, retries, budget, secrets, pii, logging } from "@nopeatech/maskea";
import OpenAI from "openai";
const openai = new OpenAI();
const maskea = new Maskea()
.use(retries({ max: 3, backoff: "exponential" }))
.use(budget({ maxMonthlyUsd: 50 }))
.use(secrets({ mode: "mask" }))
.use(pii({ mode: "mask" }))
.use(logging({ format: "pretty" }));
const chat = maskea.wrap(
openai.chat.completions.create.bind(openai.chat.completions)
);Checked against the shipped @nopeatech/maskea API. Full docs at nopea.tech/maskea/docs.