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 — public API helpers (envelope, maintainer credit, caching)3 * Author: Simon-Pierre Boucher4 * Contact: contact@spboucher.ai5 * License: Proprietary — © Simon-Pierre Boucher, all rights reserved6 */7import 'server-only';8import { NextResponse } from 'next/server';910export const MAINTAINER = `${process.env.MAINTAINER_NAME ?? 'Simon-Pierre Boucher'} <${11 process.env.MAINTAINER_EMAIL ?? 'contact@spboucher.ai'12}>`;1314/** v1 envelope. Breaking changes go to /api/v2 — never mutate these shapes. */15export function apiJson(data: Record<string, unknown>, opts?: { cacheSeconds?: number; status?: number }) {16 const res = NextResponse.json(17 { ...data, maintainer: MAINTAINER },18 { status: opts?.status ?? 200 },19 );20 const cache = opts?.cacheSeconds ?? 0;21 if (cache > 0) {22 res.headers.set('Cache-Control', `public, s-maxage=${cache}, stale-while-revalidate=${cache}`);23 }24 return res;25}2627export function apiError(status: number, error: string) {28 return NextResponse.json({ error, maintainer: MAINTAINER }, { status });29}30