feat: log token usage

This commit is contained in:
2025-02-10 21:07:52 -08:00
parent a347ff8eb6
commit 8c72375761
8 changed files with 62 additions and 0 deletions
+4
View File
@@ -6,6 +6,7 @@
import { MessageFlags, type ChatInputCommandInteraction } from "discord.js";
import { personality } from "../config/personality.js";
import { ai } from "../utils/ai.js";
import { calculateCost } from "../utils/calculateCost.js";
import { isSubscribed } from "../utils/isSubscribed.js";
import type { ImageBlockParam } from "@anthropic-ai/sdk/resources/index.js";
@@ -109,4 +110,7 @@ export const alt = async(
response?.text
?? "I'm sorry, I don't have an answer for that. Please try again later.",
);
const { usage } = messages;
await calculateCost(usage, interaction.user.username, "alt-text");
};