Skip to content

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

Nick: fixed billing and acuc cache

Nicolas6e3ceccb5ce7
diff --git a/apps/api/src/controllers/auth.ts b/apps/api/src/controllers/auth.ts
index 52a87145a..d87f59d68 100644
--- a/apps/api/src/controllers/auth.ts
+++ b/apps/api/src/controllers/auth.ts
@@ -79,7 +79,7 @@ export async function getACUC(
useCache = true,
mode?: RateLimiterMode,
): Promise<AuthCreditUsageChunk | null> {
- const cacheKeyACUC = `acuc_${api_key}`;
+ const cacheKeyACUC = `acuc_${api_key}_${mode}`;
if (useCache) {
const cachedACUC = await getValue(cacheKeyACUC);
@@ -94,7 +94,7 @@ export async function getACUC(
let retries = 0;
const maxRetries = 5;
- let rpcName = mode === RateLimiterMode.Extract ? "auth_credit_usage_chunk_extract" : "auth_credit_usage_chunk_test_21_credit_pack";
+ let rpcName = mode === RateLimiterMode.Extract ? "auth_credit_usage_chunk_extract" : "auth_credit_usage_chunk_test_21_credit_pack_n_extract";
while (retries < maxRetries) {
({ data, error } = await supabase_service.rpc(
rpcName,
diff --git a/apps/api/src/services/billing/credit_billing.ts b/apps/api/src/services/billing/credit_billing.ts
index 4aa8b4cf2..1cea9cbc7 100644
--- a/apps/api/src/services/billing/credit_billing.ts
+++ b/apps/api/src/services/billing/credit_billing.ts
@@ -52,12 +52,12 @@ export async function supaBillTeam(
credits,
});
- const { data, error } = await supabase_service.rpc("bill_team_w_extract", {
+ const { data, error } = await supabase_service.rpc("bill_team_w_extract_3", {
_team_id: team_id,
sub_id: subscription_id ?? null,
fetch_subscription: subscription_id === undefined,
credits,
- is_extract,
+ is_extract_param: is_extract,
});
if (error) {