Know the cost of every AWS Bedrock call — before it returns. Then cap, degrade, or alarm on it.
bedrock-meter is real-time, in-process, pre-flight AWS Bedrock
spend metering and capping. You npm install it and wrap your
BedrockRuntimeClient; a TypeScript CDK construct provisions the store,
control flags, budget, alarms, and the correct Bedrock IAM.
bedrock-meter
gives you the number pre-flight. This is the core differentiator.onCapExceeded) and alarm — enforcement, not
just observation. You pick the model; the meter meters it.import { meter } from "@polycode-projects/bedrock-meter";
import { BedrockRuntimeClient, ConverseCommand } from "@aws-sdk/client-bedrock-runtime";
const client = meter(new BedrockRuntimeClient({ region: "eu-west-2" }), {
caps: { dailyGbp: 3 }, // refuse the call once today's £3 cap is hit
onCapExceeded: "throw",
});
await client.send(new ConverseCommand({ /* ... */ })); // metered + capped
const today = await client.meter.spentToday();
Real-time, in-process, pre-flight AWS Bedrock spend metering and capping.
AWS CDK construct that provisions the store, flags, budget, alarms, dashboard and correct Bedrock IAM for @polycode-projects/bedrock-meter.