spb/llmindex Public
The discriminative, contamination-resistant, fully transparent LLM ranking — updated live.
TypeScript 77.9%
TeX 15.2%
Python 3.7%
SQL 1.4%
JavaScript 1.1%
Shell 0.5%
1/**2 * llmindex.io — GET /api/v1/leaderboard (global ranking, paginated, cached 1h)3 * Author: Simon-Pierre Boucher4 * Contact: contact@spboucher.ai5 * License: Proprietary — © Simon-Pierre Boucher, all rights reserved6 */7import { type NextRequest } from 'next/server';8import { getLeaderboard } from '@/lib/data';9import { apiError, apiJson } from '@/lib/api';10import { rateLimit } from '@/lib/rate-limit';1112export const dynamic = 'force-dynamic';1314export async function GET(req: NextRequest) {15 const limited = await rateLimit(req);16 if (limited) return limited;17 const params = req.nextUrl.searchParams;18 const limit = Math.min(200, Math.max(1, Number(params.get('limit') ?? 50)));19 const offset = Math.max(0, Number(params.get('offset') ?? 0));20 const data = await getLeaderboard('global', limit, offset);21 if (!data) return apiError(503, 'no_score_run_available');22 return apiJson(23 {24 index_version: data.run.indexVersion,25 run: {26 id: data.run.id,27 kind: data.run.kind,28 status: data.run.status,29 created_at: data.run.createdAt,30 notes: data.run.notes,31 },32 pagination: { limit, offset, count: data.entries.length },33 entries: data.entries.map((e) => ({34 rank: e.rank,35 model: e.slug,36 name: e.name,37 provider: e.provider,38 score: e.score,39 score_low: e.scoreLow,40 score_high: e.scoreHigh,41 })),42 },43 { cacheSeconds: 3600 },44 );45}46