Skip to content

Commit d787401

Browse files
committed
Introduce CREDITS_PER_USD constant
1 parent 26e8ba0 commit d787401

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Diff for: packages/ai-bot/lib/ai-cost.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ import * as Sentry from '@sentry/node';
99

1010
let log = logger('ai-bot');
1111

12+
const CREDITS_PER_USD = 1000;
13+
1214
export async function saveUsageCost(
1315
pgAdapter: PgAdapter,
1416
matrixUserId: string,
@@ -21,7 +23,7 @@ export async function saveUsageCost(
2123
delayMs: 500,
2224
});
2325

24-
let creditsConsumed = Math.round(costInUsd / 0.001);
26+
let creditsConsumed = Math.round(costInUsd * CREDITS_PER_USD);
2527

2628
let user = await getUserByMatrixUserId(pgAdapter, matrixUserId);
2729

0 commit comments

Comments
 (0)