use TwistedBinary\FeedbackWidget\Models\FeedbackAiCost;
// Total tokens for a conversation
FeedbackAiCost::forConversation($id)->sum('total_tokens');
// All costs for a user
FeedbackAiCost::forUser($userId)->get();
// Daily token usage
FeedbackAiCost::whereDate('created_at', today())->sum('total_tokens');
use TwistedBinary\FeedbackWidget\Events\FeedbackAiCostRecorded;
Event::listen(FeedbackAiCostRecorded::class, function (FeedbackAiCostRecorded $event) {
// Report to an external service, log, etc.
});