spb/chat-spboucher Public
Private universal chat interface over the OpenRouter ecosystem — 400+ models, branching, streaming, usage tracking. Next.js 16 + SQLite, PWA, deployed on m4m64a at chat.spboucher.ai
TypeScript 78.8%
CSS 15.1%
JavaScript 4.9%
Shell 1.2%
1// Author: Simon-Pierre Boucher2// Contact: contact@spboucher.ai3// Project: chat.spboucher.ai45import { NextResponse, type NextRequest } from "next/server";6import { requireSession } from "@/lib/auth/guard";7import { setModelPref } from "@/lib/catalog";89export const runtime = "nodejs";1011export async function POST(req: NextRequest) {12 const { unauthorized } = await requireSession();13 if (unauthorized) return unauthorized;14 let body: { modelId?: string; favorite?: boolean; pinned?: boolean };15 try {16 body = await req.json();17 } catch {18 return NextResponse.json({ error: "Invalid request." }, { status: 400 });19 }20 if (!body.modelId) {21 return NextResponse.json({ error: "modelId is required." }, { status: 400 });22 }23 setModelPref(body.modelId, { favorite: body.favorite, pinned: body.pinned });24 return NextResponse.json({ ok: true });25}26