Skip to content

Commit b8426af

Browse files
committed
add brain model guard
1 parent 4f147d0 commit b8426af

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

apis/cloudflare/src/billing.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ import { type BillingEvent } from "@braintrust/proxy";
33
const DEFAULT_BILLING_TELEMETRY_URL =
44
"https://api.braintrust.dev/billing/telemetry/ingest";
55

6+
function isBrainModel(model: string): boolean {
7+
return model.startsWith("brain-");
8+
}
9+
610
function buildPayloadEvent(event: BillingEvent) {
711
if (!event.org_id) {
812
console.warn("billing event skipped: missing org_id");
@@ -12,6 +16,10 @@ function buildPayloadEvent(event: BillingEvent) {
1216
console.warn("billing event skipped: missing model");
1317
return null;
1418
}
19+
// Skip non-brain models since braintrust only hosts brain models.
20+
if (!isBrainModel(event.model)) {
21+
return null;
22+
}
1523
if (!event.resolved_model) {
1624
console.warn("billing event skipped: missing resolved_model");
1725
return null;

0 commit comments

Comments
 (0)