← klaro.services
SentinelConsentraKlaroShieldBundlesPricing
Budgeting & cost

Separate budgets for staging vs production

budget() tracks spend from .klaro/budget.jsonl in the current working directory -- run staging and prod as separate processes/deployments and each gets its own independent cap.

← All recipes
import { Klaro, budget } from "@klaroshield/sdk";

const isProd = process.env.NODE_ENV === "production";

const klaro = new Klaro().use(
  budget({ maxMonthlyUsd: isProd ? 500 : 20 })
);

// Each environment's .klaro/ directory is independent -- staging
// hitting its (much lower) cap never affects production's budget.

Checked against the shipped @klaroshield/sdk API. Full docs at klaro.services/klaroshield/docs.

More in Budgeting & cost

Handle a budget cap without crashing