+
Usage
+
+ {/* Summary cards */}
+
+ {([
+ { label: "Today", data: stats.today },
+ { label: "This Week", data: stats.week },
+ { label: "This Month", data: stats.month },
+ ] as const).map(({ label, data }) => (
+
+ {label}
+
+ {formatNumber(data.total_tokens)} tokens
+
+
+ {data.request_count} request{data.request_count !== 1 ? "s" : ""}
+ {" · "}
+ {formatNumber(data.prompt_tokens)} prompt / {formatNumber(data.completion_tokens)} completion
+
+
+ ))}
+
+
+ {/* Daily bar chart */}
+ {stats.daily_counts.length > 0 && (
+
+
Last 7 Days
+
+ {stats.daily_counts.map((d) => (
+
+
{d.request_count}
+
+
{shortDay(d.date)}
+
+ ))}
+
+
+ )}
+
+ {/* Top creators */}
+
+
Top Creators (This Month)
+ {stats.top_creators.length === 0 ? (
+
No creator usage data yet.
+ ) : (
+
+
+
+ | Creator |
+ Requests |
+ Tokens |
+
+
+
+ {stats.top_creators.map((c) => (
+
+ | {c.creator_slug} |
+ {c.request_count.toLocaleString()} |
+ {formatNumber(c.total_tokens)} |
+
+ ))}
+
+
+ )}
+
+
+ {/* Top users */}
+
+
Top Users (This Month)
+ {stats.top_users.length === 0 ? (
+
No user usage data yet.
+ ) : (
+
+
+
+ | User / IP |
+ Requests |
+ Tokens |
+
+
+
+ {stats.top_users.map((u, i) => (
+
+ | {u.identifier} |
+ {u.request_count.toLocaleString()} |
+ {formatNumber(u.total_tokens)} |
+
+ ))}
+
+
+ )}
+
+
+ );
+}