Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

feat: add bypassCreditChecks team flag for infinite graceful credit checks (#2578)

devin-ai-integration[bot]4cbe71002c0c
diff --git a/apps/api/src/controllers/v1/types.ts b/apps/api/src/controllers/v1/types.ts
index 423877100..fb550f156 100644
--- a/apps/api/src/controllers/v1/types.ts
+++ b/apps/api/src/controllers/v1/types.ts
@@ -1256,6 +1256,7 @@ export type TeamFlags = {
skipCountryCheck?: boolean;
extractV3Beta?: boolean;
agentBeta?: boolean;
+ bypassCreditChecks?: boolean;
} | null;
export type AuthCreditUsageChunkFromTeam = Omit<
diff --git a/apps/api/src/controllers/v2/types.ts b/apps/api/src/controllers/v2/types.ts
index afaf176e7..ac0b5c75e 100644
--- a/apps/api/src/controllers/v2/types.ts
+++ b/apps/api/src/controllers/v2/types.ts
@@ -1229,6 +1229,7 @@ export type TeamFlags = {
allowTeammateInvites?: boolean;
crawlTtlHours?: number;
ipWhitelist?: boolean;
+ bypassCreditChecks?: boolean;
} | null;
interface RequestWithMaybeACUC<
diff --git a/apps/api/src/services/billing/credit_billing.ts b/apps/api/src/services/billing/credit_billing.ts
index 618a29f93..2f0638f9e 100644
--- a/apps/api/src/services/billing/credit_billing.ts
+++ b/apps/api/src/services/billing/credit_billing.ts
@@ -78,6 +78,16 @@ async function supaCheckTeamCredits(
throw new Error("NULL ACUC passed to supaCheckTeamCredits");
}
+ // If bypassCreditChecks flag is set, return success with infinite credits (infinitely graceful)
+ if (chunk.flags?.bypassCreditChecks) {
+ return {
+ success: true,
+ message: "Credit checks bypassed",
+ remainingCredits: Infinity,
+ chunk,
+ };
+ }
+
const remainingCredits = chunk.price_should_be_graceful
? chunk.remaining_credits + chunk.price_credits
: chunk.remaining_credits;