AiUsage.h header
#include <ew/app/AiUsage.h>
Namespace ew::app
AiUsageTracker class
class ew::app::AiUsageTracker
Accumulates the token usage of the AI calls made during a session, so the UI can show a running total and warn when a configured budget is exceeded. A plain value type: the desktop app keeps one per session and records each response's usage into it.
Members
void ew::app::AiUsageTracker::add(const TokenUsage &usage)
Adds usage (a single call's reported tokens) to the running totals.
const TokenUsage & ew::app::AiUsageTracker::total() const
The cumulative usage recorded so far.
void ew::app::AiUsageTracker::reset()
Clears the running totals back to zero.
bool ew::app::AiUsageTracker::exceedsBudget(int budget) const
Whether the cumulative total tokens have reached or passed budget. A budget of 0 (or less) means "no limit" and never exceeds.