Skip to content

Commit 71a412f

Browse files
chitalianclaude
andauthored
Hardcode growth metrics with time-based increments (#5470)
* Hardcode growth metrics with time-based increments Replace API-fetched stats with hardcoded baseline values that grow over time: - Requests: 3 billion base, +50 million/day - Tokens: 31.5 trillion base, +1 trillion/month - Users: 20.6 million base, +1 million/month Baseline date is January 2, 2025. Update the constants periodically with real numbers. * Fix SSR hydration and timezone issues in Stats component - Initialize metrics state as null to avoid SSR/client mismatch - Use UTC format for baseline date to ensure consistent timezone handling - Use 30.44 days/month for more accurate month calculations - Extract magic numbers (MS_PER_DAY, DAYS_PER_MONTH) as named constants - Fall back to baseline values during SSR/initial render - Update baseline date to January 6, 2025 * Update baseline metrics with real numbers - Requests: 4.9 billion (was 3 billion) - Tokens: 1.1 trillion/month (was 31.5 trillion) - Users: 28.6 million (was 20.6 million) * Update growth rates to match actual metrics - Requests: 10M/day (was 50M/day) - Tokens & Users: 5% MoM compound growth (was flat rate) --------- Co-authored-by: Claude <noreply@anthropic.com>
1 parent e00ebfe commit 71a412f

File tree

2 files changed

+56
-43
lines changed

2 files changed

+56
-43
lines changed

bifrost/app/page.tsx

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -24,26 +24,7 @@ const LoadingSection = ({ height = "h-96" }: { height?: string }) => (
2424
></div>
2525
);
2626

27-
export default async function Home() {
28-
const response = await fetch(
29-
"https://api.helicone.ai/v1/public/dataisbeautiful/total-values",
30-
{
31-
method: "POST",
32-
headers: {
33-
"Content-Type": "application/json",
34-
},
35-
next: { revalidate: 3600 },
36-
}
37-
);
38-
39-
const totalValuesData = response.ok
40-
? ((await response.json()).data as {
41-
total_requests?: number;
42-
total_tokens?: number;
43-
total_cost?: number;
44-
})
45-
: undefined;
46-
27+
export default function Home() {
4728
return (
4829
<Layout>
4930
<main className="bg-white text-landing-description">
@@ -72,7 +53,7 @@ export default async function Home() {
7253
<BigDashboard />
7354
</LazyLoadComponent>
7455
<LazyLoadComponent fallback={<LoadingSection height="h-48" />}>
75-
<Stats totalValuesData={totalValuesData} />
56+
<Stats />
7657
</LazyLoadComponent>
7758
<LazyLoadComponent fallback={<LoadingSection />}>
7859
<OpenSource />

bifrost/components/home/Stats.tsx

Lines changed: 54 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,67 @@
11
"use client";
22

33
import { ISLAND_WIDTH } from "@/lib/utils";
4-
// import { humanReadableNumber } from "@/app/utils/formattingUtils";
54
import { cn } from "@/lib/utils";
65
import { useEffect, useRef, useState } from "react";
76

8-
function humanReadableNumber(num: number): string {
9-
if (num >= 1_000_000_000_000) {
10-
return `${Math.ceil(num / 1_000_000_000_00) / 10} trillion`;
11-
} else if (num >= 1_000_000_000) {
12-
return `${Math.ceil(num / 1_000_000_00) / 10} billion`;
13-
} else if (num >= 1_000_000) {
14-
return `${Math.ceil(num / 1_000_00) / 10}M+`;
15-
} else if (num >= 1_000) {
16-
return `${Math.ceil(num / 100) / 10}k+`;
7+
// Baseline date: January 6, 2025 (UTC)
8+
const BASELINE_DATE = new Date("2025-01-06T00:00:00Z");
9+
10+
// Baseline values (update these periodically with real numbers)
11+
const BASELINE_REQUESTS = 4_855_213_721; // ~4.9 billion
12+
const BASELINE_TOKENS_TRILLION = 1.1; // ~1.1 trillion tokens per month
13+
const BASELINE_USERS = 28_645_282; // ~28.6 million
14+
15+
// Growth rates
16+
const REQUESTS_PER_DAY = 10_000_000; // 10 million per day
17+
const MONTHLY_GROWTH_RATE = 0.05; // 5% MoM for tokens and users
18+
19+
const MS_PER_DAY = 1000 * 60 * 60 * 24;
20+
const DAYS_PER_MONTH = 30.44; // Average days per month
21+
22+
function getGrowthMetrics() {
23+
const now = new Date();
24+
const daysSinceBaseline = Math.floor(
25+
(now.getTime() - BASELINE_DATE.getTime()) / MS_PER_DAY
26+
);
27+
const monthsSinceBaseline = daysSinceBaseline / DAYS_PER_MONTH;
28+
29+
return {
30+
requests: BASELINE_REQUESTS + daysSinceBaseline * REQUESTS_PER_DAY,
31+
tokensTrillion:
32+
BASELINE_TOKENS_TRILLION * Math.pow(1 + MONTHLY_GROWTH_RATE, monthsSinceBaseline),
33+
users: BASELINE_USERS * Math.pow(1 + MONTHLY_GROWTH_RATE, monthsSinceBaseline),
34+
};
35+
}
36+
37+
function formatRequests(num: number): string {
38+
if (num >= 1_000_000_000) {
39+
return `${(num / 1_000_000_000).toFixed(1)} billion`;
1740
}
1841
return num.toLocaleString();
1942
}
2043

21-
const Stats = ({
22-
totalValuesData,
23-
}: {
24-
totalValuesData?: {
25-
total_requests?: number;
26-
total_tokens?: number;
27-
total_cost?: number;
28-
};
29-
}) => {
44+
function formatTokens(trillions: number): string {
45+
return `${trillions.toFixed(1)} Trillion`;
46+
}
47+
48+
function formatUsers(num: number): string {
49+
if (num >= 1_000_000) {
50+
return `${(num / 1_000_000).toFixed(1)} million`;
51+
}
52+
return num.toLocaleString();
53+
}
54+
55+
const Stats = () => {
3056
const [isVisible, setIsVisible] = useState(false);
57+
const [metrics, setMetrics] = useState<ReturnType<typeof getGrowthMetrics> | null>(null);
3158
const elementRef = useRef<HTMLDivElement>(null);
3259

60+
useEffect(() => {
61+
// Only compute metrics on client to avoid SSR hydration mismatch
62+
setMetrics(getGrowthMetrics());
63+
}, []);
64+
3365
useEffect(() => {
3466
const observer = new IntersectionObserver(
3567
([entry]) => {
@@ -65,11 +97,11 @@ const Stats = ({
6597
isVisible ? "rotate-[-3deg]" : "rotate-[0 deg]"
6698
)}
6799
>
68-
{humanReadableNumber(totalValuesData?.total_requests ?? 0)}
100+
{formatRequests(metrics?.requests ?? BASELINE_REQUESTS)}
69101
</span>{" "}
70102
requests processed,{" "}
71-
<span className="text-brand">1 Trillion</span> tokens a month, <span className="text-brand">18.3 million</span>{" "}
72-
users tracked
103+
<span className="text-brand">{formatTokens(metrics?.tokensTrillion ?? BASELINE_TOKENS_TRILLION)}</span> tokens a month,{" "}
104+
<span className="text-brand">{formatUsers(metrics?.users ?? BASELINE_USERS)}</span> users tracked
73105
</h1>
74106
</div>
75107
</div>

0 commit comments

Comments
 (0)