Providers
OpenRouter (OpenAI-compatible endpoint)
OpenRouter uses the OpenAI SDK shape with a different baseURL and key -- the wrap is identical to the direct OpenAI recipe.
← All recipes
import { Maskea, retries, budget } from "@nopeatech/maskea";
import OpenAI from "openai";
const openrouter = new OpenAI({
apiKey: process.env.OPENROUTER_API_KEY,
baseURL: "https://openrouter.ai/api/v1",
});
const maskea = new Maskea()
.use(retries({ max: 3 }))
.use(budget({ maxMonthlyUsd: 50 }));
const chat = maskea.wrap(
openrouter.chat.completions.create.bind(openrouter.chat.completions)
);Checked against the shipped @nopeatech/maskea API. Full docs at nopea.tech/maskea/docs.