Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apps/api/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { tracingMiddleware } from "./middleware/tracing.js";
import { beacon } from "./routes/beacon.js";
import { routes } from "./routes/index.js";
import { internalModels } from "./routes/internal-models.js";
import { publicApps } from "./routes/public-apps.js";
import { publicChatSupport } from "./routes/public-chat-support.js";
import { publicContact } from "./routes/public-contact.js";
import { publicDiscounts } from "./routes/public-discounts.js";
Expand Down Expand Up @@ -228,6 +229,7 @@ app.route("/public/discounts", publicDiscounts);
app.route("/public/contact", publicContact);
app.route("/public/newsletter", publicNewsletter);
app.route("/public/chat-support", publicChatSupport);
app.route("/public/apps", publicApps);

app.doc("/json", config);

Expand Down
81 changes: 81 additions & 0 deletions apps/api/src/routes/public-apps.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
import { createRoute, OpenAPIHono } from "@hono/zod-openapi";
import { z } from "zod";

import { db, globalSourceStats, ne, sql } from "@llmgateway/db";

import type { ServerTypes } from "@/vars.js";

export const publicApps = new OpenAPIHono<ServerTypes>();

const appStatSchema = z.object({
source: z.string(),
totalTokens: z.number(),
totalRequests: z.number(),
lastUsedAt: z.string().nullable(),
});

const listAppsRoute = createRoute({
method: "get",
path: "/",
request: {
query: z.object({
limit: z
.string()
.optional()
.transform((v) => (v ? Number.parseInt(v, 10) : 100))
.pipe(z.number().int().min(1).max(500)),
}),
},
responses: {
200: {
content: {
"application/json": {
schema: z.object({
apps: z.array(appStatSchema),
totalApps: z.number(),
totalTokens: z.number(),
totalRequests: z.number(),
}),
},
},
description:
"Aggregated token usage per app/source across all LLM Gateway traffic.",
},
},
});

publicApps.openapi(listAppsRoute, async (c) => {
const { limit } = c.req.valid("query");

const rows = await db
.select({
source: globalSourceStats.source,
totalTokens: sql<string>`COALESCE(SUM(CAST(${globalSourceStats.totalTokens} AS NUMERIC)), 0)`,
totalRequests: sql<string>`COALESCE(SUM(${globalSourceStats.requestCount}), 0)`,
lastUsedAt: sql<Date | null>`MAX(${globalSourceStats.dayTimestamp})`,
})
.from(globalSourceStats)
.where(ne(globalSourceStats.source, "unknown"))
.groupBy(globalSourceStats.source)
.orderBy(
sql`COALESCE(SUM(CAST(${globalSourceStats.totalTokens} AS NUMERIC)), 0) DESC`,
)
.limit(limit);
Comment thread
coderabbitai[bot] marked this conversation as resolved.

const apps = rows.map((r) => ({
source: r.source,
totalTokens: Number(r.totalTokens) || 0,
totalRequests: Number(r.totalRequests) || 0,
lastUsedAt: r.lastUsedAt ? new Date(r.lastUsedAt).toISOString() : null,
}));

const totalTokens = apps.reduce((sum, a) => sum + a.totalTokens, 0);
const totalRequests = apps.reduce((sum, a) => sum + a.totalRequests, 0);

return c.json({
apps,
totalApps: apps.length,
totalTokens,
totalRequests,
});
});
47 changes: 47 additions & 0 deletions apps/code/src/lib/api/v1.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,53 @@ export interface paths {
patch?: never;
trace?: never;
};
"/public/apps": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
get: {
parameters: {
query?: {
limit?: string;
};
header?: never;
path?: never;
cookie?: never;
};
requestBody?: never;
responses: {
/** @description Aggregated token usage per app/source across all LLM Gateway traffic. */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
apps: {
source: string;
totalTokens: number;
totalRequests: number;
lastUsedAt: string | null;
}[];
totalApps: number;
totalTokens: number;
totalRequests: number;
};
};
};
};
};
put?: never;
post?: never;
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/user/me": {
parameters: {
query?: never;
Expand Down
47 changes: 47 additions & 0 deletions apps/playground/src/lib/api/v1.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,53 @@ export interface paths {
patch?: never;
trace?: never;
};
"/public/apps": {
parameters: {
query?: never;
header?: never;
path?: never;
cookie?: never;
};
get: {
parameters: {
query?: {
limit?: string;
};
header?: never;
path?: never;
cookie?: never;
};
requestBody?: never;
responses: {
/** @description Aggregated token usage per app/source across all LLM Gateway traffic. */
200: {
headers: {
[name: string]: unknown;
};
content: {
"application/json": {
apps: {
source: string;
totalTokens: number;
totalRequests: number;
lastUsedAt: string | null;
}[];
totalApps: number;
totalTokens: number;
totalRequests: number;
};
};
};
};
};
put?: never;
post?: never;
delete?: never;
options?: never;
head?: never;
patch?: never;
trace?: never;
};
"/user/me": {
parameters: {
query?: never;
Expand Down
193 changes: 193 additions & 0 deletions apps/ui/src/app/apps/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,193 @@
import { ArrowRight } from "lucide-react";

import { AppsGrid } from "@/components/apps/apps-grid";
import { DevPassUpsell } from "@/components/apps/devpass-upsell";
import { AnimatedGroup } from "@/components/landing/animated-group";
import Footer from "@/components/landing/footer";
import { HeroRSC } from "@/components/landing/hero-rsc";
import { fetchServerData } from "@/lib/server-api";

import type { Metadata } from "next";

export const metadata: Metadata = {
title: "Apps using LLM Gateway",
description:
"Browse coding agents and tools sending traffic through LLM Gateway, ranked by tokens processed. Claude Code, Cursor, Cline, OpenCode, Aider, Continue, and more.",
openGraph: {
title: "Apps using LLM Gateway",
description:
"Coding agents and tools running on LLM Gateway, ranked by tokens processed.",
},
};

export const revalidate = 300;

interface AppsResponse {
apps: Array<{
source: string;
totalTokens: number;
totalRequests: number;
lastUsedAt: string | null;
}>;
totalApps: number;
totalTokens: number;
totalRequests: number;
}

const numberFormatter = new Intl.NumberFormat("en-US");

function formatBigNumber(n: number): string {
if (n >= 1_000_000_000) {
return `${(n / 1_000_000_000).toFixed(2)}B`;
}
if (n >= 1_000_000) {
return `${(n / 1_000_000).toFixed(2)}M`;
}
if (n >= 1_000) {
return `${(n / 1_000).toFixed(1)}K`;
}
return numberFormatter.format(n);
}

function HeroStat({
value,
label,
accent,
}: {
value: string;
label: string;
accent?: boolean;
}) {
return (
<div className="flex flex-col items-center gap-1">
<span
className={`font-display text-5xl md:text-6xl font-bold leading-none tracking-tighter tabular-nums ${
accent ? "text-blue-500 dark:text-blue-400" : "text-foreground"
}`}
>
{value}
</span>
<span className="text-[11px] uppercase tracking-[0.2em] text-muted-foreground">
{label}
</span>
</div>
);
}

export default async function AppsPage() {
const data = await fetchServerData<AppsResponse>("GET", "/public/apps", {
params: { query: { limit: "200" } },
});

const apps = data?.apps ?? [];
const totalApps = data?.totalApps ?? apps.length;
const totalTokens = data?.totalTokens ?? 0;
const totalRequests = data?.totalRequests ?? 0;

return (
<div className="min-h-screen bg-background text-foreground">
<main>
<HeroRSC navbarOnly />

<section className="relative overflow-hidden pt-36 md:pt-44 pb-12">
<div
aria-hidden
className="pointer-events-none absolute left-1/2 top-32 -translate-x-1/2 w-[900px] h-[420px] bg-blue-500/[0.07] dark:bg-blue-500/[0.05] rounded-full blur-3xl"
/>
<div
aria-hidden
className="absolute inset-0 -z-10 size-full [background:radial-gradient(125%_125%_at_50%_100%,transparent_0%,var(--background)_75%)]"
/>

<div className="container relative mx-auto px-4">
<AnimatedGroup
preset="blur-slide"
className="mx-auto max-w-4xl text-center"
>
<div className="mb-8 flex justify-center">
<div className="inline-flex items-center gap-2 rounded-full border bg-muted/40 px-4 py-1.5 text-xs text-muted-foreground backdrop-blur">
<span className="h-1.5 w-1.5 rounded-full bg-emerald-500 animate-pulse" />
Live · refreshed every 5 minutes
</div>
</div>

<h1 className="font-display text-4xl md:text-6xl lg:text-7xl font-bold tracking-tight text-balance">
Apps shipping with
<br />
<span className="text-muted-foreground">LLM Gateway</span>
</h1>
<p className="mx-auto mt-6 max-w-2xl text-balance text-base md:text-lg text-muted-foreground leading-relaxed">
Real coding agents, real traffic. Every tool below routes
through one API, ranked by tokens processed.
</p>

<div className="mt-14 flex flex-wrap items-center justify-center gap-x-12 md:gap-x-20 gap-y-8">
<HeroStat
value={numberFormatter.format(totalApps)}
label="apps tracked"
/>
<span
aria-hidden
className="hidden h-14 w-px bg-border md:block"
/>
<HeroStat
value={formatBigNumber(totalTokens)}
label="tokens processed"
accent
/>
<span
aria-hidden
className="hidden h-14 w-px bg-border md:block"
/>
<HeroStat
value={formatBigNumber(totalRequests)}
label="requests routed"
/>
</div>
</AnimatedGroup>
</div>
</section>

<div className="h-px bg-gradient-to-r from-transparent via-border to-transparent" />

<section className="container mx-auto px-4 py-12 md:py-16">
{apps.length > 0 ? (
<>
<div className="mb-8 flex flex-col items-start justify-between gap-3 rounded-xl border bg-card/40 px-5 py-4 sm:flex-row sm:items-center">
<p className="text-sm text-muted-foreground">
Want your app on this list? Set{" "}
<code className="rounded bg-muted px-1.5 py-0.5 font-mono text-xs text-foreground">
x-source: your-app.com
</code>{" "}
on requests to LLM Gateway.
</p>
<a
href="/docs"
className="group inline-flex items-center gap-1.5 text-sm font-medium text-foreground hover:text-blue-500"
>
Read the docs
<ArrowRight className="h-3.5 w-3.5 transition-transform group-hover:translate-x-0.5" />
</a>
Comment thread
smakosh marked this conversation as resolved.
</div>

<AppsGrid apps={apps} />
</>
) : (
<div className="rounded-2xl border border-dashed py-24 text-center">
<p className="font-display text-lg font-semibold">
No app traffic recorded yet
</p>
<p className="mt-1 text-sm text-muted-foreground">
Once requests start flowing, apps will show up here ranked by
tokens processed.
</p>
</div>
)}
</section>

<DevPassUpsell />
</main>
<Footer />
</div>
);
}
Loading
Loading