latestUsage property

GroqUsage? get latestUsage

Returns the latest resource usage in the conversation

final usage = chat.latestUsage;
print(usage.totalTokens); //prints the total tokens used in the latest response

Implementation

GroqUsage? get latestUsage =>
    _chatItems.whereType<ResponseChatEvent>().lastOrNull?.usage;