7.4 billion tokens per month. 34 free LLM providers. 635 free model endpoints. All behind one /v1 endpoint, plus any custom OpenAI-compatible endpoint. Smart routing, automatic failover, encrypted keys. Personal experimentation only.
TypeScript
feat(dashboard): UI polish — toggle fix, floating save bar, collapsible budget legend (#194)
Tashfeen5a2f88b094b1
diff --git a/client/public/favicon.svg b/client/public/favicon.svgindex 6893eb13..78bbf8f8 100644--- a/client/public/favicon.svg+++ b/client/public/favicon.svg@@ -1 +1,9 @@-<svg xmlns="http://www.w3.org/2000/svg" width="48" height="46" fill="none" viewBox="0 0 48 46"><path fill="#863bff" d="M25.946 44.938c-.664.845-2.021.375-2.021-.698V33.937a2.26 2.26 0 0 0-2.262-2.262H10.287c-.92 0-1.456-1.04-.92-1.788l7.48-10.471c1.07-1.497 0-3.578-1.842-3.578H1.237c-.92 0-1.456-1.04-.92-1.788L10.013.474c.214-.297.556-.474.92-.474h28.894c.92 0 1.456 1.04.92 1.788l-7.48 10.471c-1.07 1.498 0 3.579 1.842 3.579h11.377c.943 0 1.473 1.088.89 1.83L25.947 44.94z" style="fill:#863bff;fill:color(display-p3 .5252 .23 1);fill-opacity:1"/><mask id="a" width="48" height="46" x="0" y="0" maskUnits="userSpaceOnUse" style="mask-type:alpha"><path fill="#000" d="M25.842 44.938c-.664.844-2.021.375-2.021-.698V33.937a2.26 2.26 0 0 0-2.262-2.262H10.183c-.92 0-1.456-1.04-.92-1.788l7.48-10.471c1.07-1.498 0-3.579-1.842-3.579H1.133c-.92 0-1.456-1.04-.92-1.787L9.91.473c.214-.297.556-.474.92-.474h28.894c.92 0 1.456 1.04.92 1.788l-7.48 10.471c-1.07 1.498 0 3.578 1.842 3.578h11.377c.943 0 1.473 1.088.89 1.832L25.843 44.94z" style="fill:#000;fill-opacity:1"/></mask><g mask="url(#a)"><g filter="url(#b)"><ellipse cx="5.508" cy="14.704" fill="#ede6ff" rx="5.508" ry="14.704" style="fill:#ede6ff;fill:color(display-p3 .9275 .9033 1);fill-opacity:1" transform="matrix(.00324 1 1 -.00324 -4.47 31.516)"/></g><g filter="url(#c)"><ellipse cx="10.399" cy="29.851" fill="#ede6ff" rx="10.399" ry="29.851" style="fill:#ede6ff;fill:color(display-p3 .9275 .9033 1);fill-opacity:1" transform="matrix(.00324 1 1 -.00324 -39.328 7.883)"/></g><g filter="url(#d)"><ellipse cx="5.508" cy="30.487" fill="#7e14ff" rx="5.508" ry="30.487" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(89.814 -25.913 -14.639)scale(1 -1)"/></g><g filter="url(#e)"><ellipse cx="5.508" cy="30.599" fill="#7e14ff" rx="5.508" ry="30.599" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(89.814 -32.644 -3.334)scale(1 -1)"/></g><g filter="url(#f)"><ellipse cx="5.508" cy="30.599" fill="#7e14ff" rx="5.508" ry="30.599" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="matrix(.00324 1 1 -.00324 -34.34 30.47)"/></g><g filter="url(#g)"><ellipse cx="14.072" cy="22.078" fill="#ede6ff" rx="14.072" ry="22.078" style="fill:#ede6ff;fill:color(display-p3 .9275 .9033 1);fill-opacity:1" transform="rotate(93.35 24.506 48.493)scale(-1 1)"/></g><g filter="url(#h)"><ellipse cx="3.47" cy="21.501" fill="#7e14ff" rx="3.47" ry="21.501" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(89.009 28.708 47.59)scale(-1 1)"/></g><g filter="url(#i)"><ellipse cx="3.47" cy="21.501" fill="#7e14ff" rx="3.47" ry="21.501" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(89.009 28.708 47.59)scale(-1 1)"/></g><g filter="url(#j)"><ellipse cx=".387" cy="8.972" fill="#7e14ff" rx="4.407" ry="29.108" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(39.51 .387 8.972)"/></g><g filter="url(#k)"><ellipse cx="47.523" cy="-6.092" fill="#7e14ff" rx="4.407" ry="29.108" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(37.892 47.523 -6.092)"/></g><g filter="url(#l)"><ellipse cx="41.412" cy="6.333" fill="#47bfff" rx="5.971" ry="9.665" style="fill:#47bfff;fill:color(display-p3 .2799 .748 1);fill-opacity:1" transform="rotate(37.892 41.412 6.333)"/></g><g filter="url(#m)"><ellipse cx="-1.879" cy="38.332" fill="#7e14ff" rx="4.407" ry="29.108" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(37.892 -1.88 38.332)"/></g><g filter="url(#n)"><ellipse cx="-1.879" cy="38.332" fill="#7e14ff" rx="4.407" ry="29.108" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(37.892 -1.88 38.332)"/></g><g filter="url(#o)"><ellipse cx="35.651" cy="29.907" fill="#7e14ff" rx="4.407" ry="29.108" style="fill:#7e14ff;fill:color(display-p3 .4922 .0767 1);fill-opacity:1" transform="rotate(37.892 35.651 29.907)"/></g><g filter="url(#p)"><ellipse cx="38.418" cy="32.4" fill="#47bfff" rx="5.971" ry="15.297" style="fill:#47bfff;fill:color(display-p3 .2799 .748 1);fill-opacity:1" transform="rotate(37.892 38.418 32.4)"/></g></g><defs><filter id="b" width="60.045" height="41.654" x="-19.77" y="16.149" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="7.659"/></filter><filter id="c" width="90.34" height="51.437" x="-54.613" y="-7.533" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="7.659"/></filter><filter id="d" width="79.355" height="29.4" x="-49.64" y="2.03" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="e" width="79.579" height="29.4" x="-45.045" y="20.029" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="f" width="79.579" height="29.4" x="-43.513" y="21.178" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="g" width="74.749" height="58.852" x="15.756" y="-17.901" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="7.659"/></filter><filter id="h" width="61.377" height="25.362" x="23.548" y="2.284" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="i" width="61.377" height="25.362" x="23.548" y="2.284" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="j" width="56.045" height="63.649" x="-27.636" y="-22.853" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="k" width="54.814" height="64.646" x="20.116" y="-38.415" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="l" width="33.541" height="35.313" x="24.641" y="-11.323" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="m" width="54.814" height="64.646" x="-29.286" y="6.009" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="n" width="54.814" height="64.646" x="-29.286" y="6.009" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="o" width="54.814" height="64.646" x="8.244" y="-2.416" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter><filter id="p" width="39.409" height="43.623" x="18.713" y="10.588" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_2002_17158" stdDeviation="4.596"/></filter></defs></svg>\ No newline at end of file+<svg xmlns="http://www.w3.org/2000/svg" width="64" height="64" viewBox="0 0 64 64">+ <!-- FreeLLMAPI mark: the brand dot inside a broken routing ring.+ The gap in the ring is the "fallback" — traffic re-routes around it. -->+ <rect width="64" height="64" rx="14" fill="#09090b"/>+ <circle cx="32" cy="32" r="9.5" fill="#fafafa"/>+ <circle cx="32" cy="32" r="18" fill="none" stroke="#fafafa" stroke-opacity=".4"+ stroke-width="3.5" stroke-linecap="round" stroke-dasharray="86 27"+ transform="rotate(-60 32 32)"/>+</svg>diff --git a/client/src/App.tsx b/client/src/App.tsxindex 5525c46d..a9380da5 100644--- a/client/src/App.tsx+++ b/client/src/App.tsx@@ -1,5 +1,5 @@import { useEffect, useState } from 'react'-import { BrowserRouter, Routes, Route, Navigate, NavLink } from 'react-router-dom'+import { BrowserRouter, Routes, Route, Navigate, NavLink, Link } from 'react-router-dom'import { QueryClient, QueryClientProvider } from '@tanstack/react-query'import { Button } from '@/components/ui/button'import { AuthGate } from '@/components/auth-gate'@@ -61,10 +61,10 @@ function DarkModeToggle() {function Brand() {return (- <div className="flex items-center gap-2">+ <Link to="/" className="flex items-center gap-2 transition-opacity hover:opacity-70"><span className="inline-block size-2 rounded-full bg-foreground" /><span className="font-semibold tracking-tight text-sm">FreeLLMAPI</span>- </div>+ </Link>)}@@ -78,9 +78,9 @@ function App() {<div className="max-w-6xl mx-auto px-6 flex items-center"><Brand /><nav className="flex items-center gap-6 ml-10">+ <NavItem to="/fallback">Fallback</NavItem><NavItem to="/playground">Playground</NavItem><NavItem to="/keys">Keys</NavItem>- <NavItem to="/fallback">Fallback</NavItem><NavItem to="/analytics">Analytics</NavItem></nav><div className="ml-auto py-2 flex items-center gap-1">@@ -91,7 +91,7 @@ function App() {</header><main className="max-w-6xl mx-auto px-6 py-8"><Routes>- <Route path="/" element={<Navigate to="/playground" replace />} />+ <Route path="/" element={<Navigate to="/fallback" replace />} /><Route path="/playground" element={<PlaygroundPage />} /><Route path="/keys" element={<KeysPage />} /><Route path="/fallback" element={<FallbackPage />} />diff --git a/client/src/components/auth-gate.tsx b/client/src/components/auth-gate.tsxindex e7526487..4ae87739 100644--- a/client/src/components/auth-gate.tsx+++ b/client/src/components/auth-gate.tsx@@ -51,7 +51,7 @@ function AuthForm({ mode, onAuthed }: { mode: 'setup' | 'login'; onAuthed: () =><span className="inline-block size-2 rounded-full bg-foreground" /><span className="font-semibold tracking-tight text-sm">FreeLLMAPI</span></div>- <div className="rounded-lg border bg-card p-6">+ <div className="rounded-3xl border bg-card p-6"><h1 className="text-base font-medium">{isSetup ? 'Create your account' : 'Sign in'}</h1><p className="text-xs text-muted-foreground mt-1 mb-4">{isSetup@@ -115,7 +115,7 @@ export function AuthGate({ children }: { children: ReactNode }) {if (isError || !data) {return (<Centered>- <div className="rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2.5 text-xs text-destructive">+ <div className="rounded-lg border border-destructive/40 bg-destructive/10 px-3 py-2.5 text-xs text-destructive">Can't reach the server. Make sure the backend is running (<code className="font-mono">npm run dev</code>).</div></Centered>diff --git a/client/src/components/markdown.tsx b/client/src/components/markdown.tsxindex 0c372737..769380cc 100644--- a/client/src/components/markdown.tsx+++ b/client/src/components/markdown.tsx@@ -91,7 +91,7 @@ const components: Components = {)},pre: ({ children }) => (- <pre className="my-2 overflow-x-auto rounded-md border bg-background/60 p-3 first:mt-0 last:mb-0">+ <pre className="my-2 overflow-x-auto rounded-lg border bg-background/60 p-3 first:mt-0 last:mb-0">{children}</pre>),diff --git a/client/src/components/page-header.tsx b/client/src/components/page-header.tsxindex b8131c74..2c61ef3f 100644--- a/client/src/components/page-header.tsx+++ b/client/src/components/page-header.tsx@@ -4,13 +4,15 @@ export function PageHeader({title,description,actions,+ divider = true,}: {title: stringdescription?: stringactions?: ReactNode+ divider?: boolean}) {return (- <div className="flex items-end justify-between gap-6 pb-6 mb-6 border-b">+ <div className={`flex items-end justify-between gap-6 mb-6 ${divider ? 'pb-6 border-b' : ''}`}><div className="min-w-0"><h1 className="text-2xl font-semibold tracking-tight">{title}</h1>{description && (diff --git a/client/src/components/ui/button.tsx b/client/src/components/ui/button.tsxindex 09df7536..84260fe9 100644--- a/client/src/components/ui/button.tsx+++ b/client/src/components/ui/button.tsx@@ -22,14 +22,14 @@ const buttonVariants = cva(size: {default:"h-8 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",- xs: "h-6 gap-1 rounded-[min(var(--radius-md),10px)] px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",- sm: "h-7 gap-1 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",+ xs: "h-6 gap-1 rounded-lg px-2 text-xs in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",+ sm: "h-7 gap-1 rounded-lg px-2.5 text-[0.8rem] in-data-[slot=button-group]:rounded-lg has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5",lg: "h-9 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",icon: "size-8","icon-xs":- "size-6 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3",+ "size-6 rounded-lg in-data-[slot=button-group]:rounded-lg [&_svg:not([class*='size-'])]:size-3","icon-sm":- "size-7 rounded-[min(var(--radius-md),12px)] in-data-[slot=button-group]:rounded-lg",+ "size-7 rounded-lg in-data-[slot=button-group]:rounded-lg","icon-lg": "size-9",},},diff --git a/client/src/components/ui/card.tsx b/client/src/components/ui/card.tsxindex 40cac5f9..422630b7 100644--- a/client/src/components/ui/card.tsx+++ b/client/src/components/ui/card.tsx@@ -12,7 +12,7 @@ function Card({data-slot="card"data-size={size}className={cn(- "group/card flex flex-col gap-4 overflow-hidden rounded-xl bg-card py-4 text-sm text-card-foreground ring-1 ring-foreground/10 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",+ "group/card flex flex-col gap-4 overflow-hidden rounded-3xl bg-card py-4 text-sm text-card-foreground ring-1 ring-foreground/10 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-3xl *:[img:last-child]:rounded-b-3xl",className)}{...props}@@ -25,7 +25,7 @@ function CardHeader({ className, ...props }: React.ComponentProps<"div">) {<divdata-slot="card-header"className={cn(- "group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-xl px-4 group-data-[size=sm]/card:px-3 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3",+ "group/card-header @container/card-header grid auto-rows-min items-start gap-1 rounded-t-3xl px-4 group-data-[size=sm]/card:px-3 has-data-[slot=card-action]:grid-cols-[1fr_auto] has-data-[slot=card-description]:grid-rows-[auto_auto] [.border-b]:pb-4 group-data-[size=sm]/card:[.border-b]:pb-3",className)}{...props}@@ -84,7 +84,7 @@ function CardFooter({ className, ...props }: React.ComponentProps<"div">) {<divdata-slot="card-footer"className={cn(- "flex items-center rounded-b-xl border-t bg-muted/50 p-4 group-data-[size=sm]/card:p-3",+ "flex items-center rounded-b-3xl border-t bg-muted/50 p-4 group-data-[size=sm]/card:p-3",className)}{...props}diff --git a/client/src/components/ui/select.tsx b/client/src/components/ui/select.tsxindex e8021f5f..491bb3f8 100644--- a/client/src/components/ui/select.tsx+++ b/client/src/components/ui/select.tsx@@ -41,7 +41,7 @@ function SelectTrigger({data-slot="select-trigger"data-size={size}className={cn(- "flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-[min(var(--radius-md),10px)] *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",+ "flex w-fit items-center justify-between gap-1.5 rounded-lg border border-input bg-transparent py-2 pr-2 pl-2.5 text-sm whitespace-nowrap transition-colors outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-placeholder:text-muted-foreground data-[size=default]:h-8 data-[size=sm]:h-7 data-[size=sm]:rounded-lg *:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-1.5 dark:bg-input/30 dark:hover:bg-input/50 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4",className)}{...props}diff --git a/client/src/index.css b/client/src/index.cssindex 6e6cf39d..878806cb 100644--- a/client/src/index.css+++ b/client/src/index.css@@ -41,13 +41,15 @@--color-card: var(--card);--color-foreground: var(--foreground);--color-background: var(--background);- --radius-sm: calc(var(--radius) * 0.6);- --radius-md: calc(var(--radius) * 0.8);+ /* --radius is 0.5rem, so: sm 4px · md 6px · lg 8px (buttons/inputs)+ · xl 12px · 2xl 16px (tables/lists) · 3xl 24px (cards) · 4xl 32px */+ --radius-sm: calc(var(--radius) * 0.5);+ --radius-md: calc(var(--radius) * 0.75);--radius-lg: var(--radius);- --radius-xl: calc(var(--radius) * 1.4);- --radius-2xl: calc(var(--radius) * 1.8);- --radius-3xl: calc(var(--radius) * 2.2);- --radius-4xl: calc(var(--radius) * 2.6);+ --radius-xl: calc(var(--radius) * 1.5);+ --radius-2xl: calc(var(--radius) * 2);+ --radius-3xl: calc(var(--radius) * 3);+ --radius-4xl: calc(var(--radius) * 4);}:root {diff --git a/client/src/pages/AnalyticsPage.tsx b/client/src/pages/AnalyticsPage.tsxindex e72dd800..3c803752 100644--- a/client/src/pages/AnalyticsPage.tsx+++ b/client/src/pages/AnalyticsPage.tsx@@ -21,7 +21,7 @@ function formatTokens(n?: number): string {function Stat({ label, value, className }: { label: string; value: string | number; className?: string }) {return (- <div className="rounded-lg border bg-card px-4 py-3">+ <div className="rounded-3xl border bg-card px-4 py-3"><p className="text-[11px] text-muted-foreground uppercase tracking-wider">{label}</p><p className={`text-xl font-semibold tabular-nums mt-1 ${className ?? ''}`}>{value}</p></div>@@ -30,7 +30,7 @@ function Stat({ label, value, className }: { label: string; value: string | numbfunction Panel({ title, children }: { title: string; children: React.ReactNode }) {return (- <div className="rounded-lg border bg-card">+ <div className="rounded-3xl border bg-card"><div className="px-4 py-3 border-b"><h3 className="text-sm font-medium">{title}</h3></div>@@ -82,7 +82,7 @@ export default function AnalyticsPage() {title="Analytics"description="Request volume, latency, token usage, and failures."actions={- <div className="flex gap-1 rounded-md border p-0.5">+ <div className="flex gap-1 rounded-lg border p-0.5">{(['24h', '7d', '30d'] as TimeRange[]).map(r => (<Buttonkey={r}diff --git a/client/src/pages/FallbackPage.tsx b/client/src/pages/FallbackPage.tsxindex 0ac7285b..63b0c875 100644--- a/client/src/pages/FallbackPage.tsx+++ b/client/src/pages/FallbackPage.tsx@@ -1,4 +1,4 @@-import { useState, useRef, type ReactNode } from 'react'+import { useEffect, useState, useRef, type ReactNode } from 'react'import { createPortal } from 'react-dom'import { useQuery, useMutation, useQueryClient } from '@tanstack/react-query'import {@@ -18,6 +18,7 @@ import {verticalListSortingStrategy,} from '@dnd-kit/sortable'import { CSS } from '@dnd-kit/utilities'+import { ChevronDown } from 'lucide-react'import { apiFetch } from '@/lib/api'import { Button } from '@/components/ui/button'import { Switch } from '@/components/ui/switch'@@ -137,7 +138,7 @@ function Tooltip({ text, children }: { text: string; children: ReactNode }) {<spanrole="tooltip"style={{ position: 'fixed', left: coords.x, top: coords.y - 8, transform: 'translate(-50%, -100%)', zIndex: 9999 }}- className="pointer-events-none w-56 rounded-md bg-foreground px-2.5 py-1.5 text-xs leading-snug text-background shadow-md"+ className="pointer-events-none w-56 rounded-lg bg-foreground px-2.5 py-1.5 text-xs leading-snug text-background shadow-md">{text}</span>,@@ -162,11 +163,30 @@ function AxisBar({ value, color }: { value: number | undefined; color: string }))}+// Legend rows visible while collapsed (~6 rows: 6 × 16px line + 5 × 6px gap).+const LEGEND_COLLAPSED_PX = 126+function TokenUsageBar({ data }: { data: TokenUsageData }) {const { totalBudget, totalUsed, models } = dataconst remaining = Math.max(0, totalBudget - totalUsed)const remainingPct = totalBudget > 0 ? Math.round((remaining / totalBudget) * 100) : 0+ // Collapse the per-model legend to a few rows; the chevron reveals the rest.+ // The toggle only appears when the legend actually overflows the collapsed+ // height (column count — and so row count — depends on viewport width).+ const [expanded, setExpanded] = useState(false)+ const [collapsible, setCollapsible] = useState(false)+ const legendRef = useRef<HTMLDivElement>(null)+ useEffect(() => {+ const el = legendRef.current+ if (!el) return+ const check = () => setCollapsible(el.scrollHeight > LEGEND_COLLAPSED_PX + 1)+ check()+ const ro = new ResizeObserver(check)+ ro.observe(el)+ return () => ro.disconnect()+ }, [models.length])+const modelsWithWidth = models.map(m => ({...m,remainingTokens: totalBudget > 0 ? (m.budget / totalBudget) * remaining : 0,@@ -175,7 +195,7 @@ function TokenUsageBar({ data }: { data: TokenUsageData }) {const usedPct = totalBudget > 0 ? (totalUsed / totalBudget) * 100 : 0return (- <section className="rounded-lg border bg-card p-5">+ <section className="rounded-3xl border bg-card p-5"><div className="flex items-baseline justify-between mb-3"><h2 className="text-sm font-medium">Monthly token budget</h2><span className="text-xs text-muted-foreground tabular-nums">@@ -205,23 +225,68 @@ function TokenUsageBar({ data }: { data: TokenUsageData }) {)}</div>- <div className="mt-4 grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-x-5 gap-y-1.5 text-xs tabular-nums">- {modelsWithWidth.map((m, i) => (- <div key={i} className="flex items-center gap-2 min-w-0">- <span- className="size-2 rounded-sm flex-shrink-0"- style={{ backgroundColor: platformColors[m.platform] ?? '#94a3b8' }}- />- <span className="truncate">{m.displayName}</span>- <span className="flex-1" />- <span className="font-mono text-muted-foreground">{formatTokens(m.remainingTokens)}</span>- </div>- ))}+ <div+ ref={legendRef}+ className="mt-4 overflow-hidden transition-[max-height] duration-300 ease-in-out"+ style={collapsible ? { maxHeight: expanded ? legendRef.current?.scrollHeight : LEGEND_COLLAPSED_PX } : undefined}+ >+ <div className="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 gap-x-5 gap-y-1.5 text-xs tabular-nums">+ {modelsWithWidth.map((m, i) => (+ <div key={i} className="flex items-center gap-2 min-w-0">+ <span+ className="size-2 rounded-sm flex-shrink-0"+ style={{ backgroundColor: platformColors[m.platform] ?? '#94a3b8' }}+ />+ <span className="truncate">{m.displayName}</span>+ <span className="flex-1" />+ <span className="font-mono text-muted-foreground">{formatTokens(m.remainingTokens)}</span>+ </div>+ ))}+ </div></div>++ {collapsible && (+ <button+ onClick={() => setExpanded(e => !e)}+ className="mt-2 flex w-full items-center justify-center gap-1 text-xs text-muted-foreground hover:text-foreground transition-colors"+ >+ {expanded ? 'Show less' : `Show all ${models.length} models`}+ <ChevronDown className={`size-3.5 transition-transform duration-300 ${expanded ? 'rotate-180' : ''}`} />+ </button>+ )}</section>)}+// Viewport-fixed action bar that slides up when shown and — instead of+// vanishing — slides back down before unmounting (kept in the tree for the+// duration of the exit animation).+function FloatingBar({ show, children }: { show: boolean; children: ReactNode }) {+ const [render, setRender] = useState(show)+ useEffect(() => {+ if (show) {+ setRender(true)+ return+ }+ const t = setTimeout(() => setRender(false), 300) // match animation duration+ return () => clearTimeout(t)+ }, [show])+ if (!render) return null+ return (+ <div+ className={`fixed inset-x-0 bottom-6 z-50 flex justify-center px-6 pointer-events-none duration-300 ${+ show+ ? 'animate-in slide-in-from-bottom-4 fade-in'+ : 'animate-out slide-out-to-bottom-4 fade-out fill-mode-forwards'+ }`}+ >+ <div className="pointer-events-auto flex items-center gap-3 rounded-full border bg-card px-4 py-2 shadow-lg">+ {children}+ </div>+ </div>+ )+}+// ── One row of the unified table ────────────────────────────────────────────function RowContent({row,@@ -363,7 +428,9 @@ export default function FallbackPage() {const configured = allEntries.filter(e => e.keyCount > 0)const unconfiguredPlatforms = [...new Set(allEntries.filter(e => e.keyCount === 0).map(e => e.platform))]- const rows: Row[] = configured.map(e => ({ ...e, ...(scoreById.get(e.modelDbId) ?? {}) }))+ // Entry fields win on overlap: the routing snapshot also carries `enabled`+ // (and identity fields), which would otherwise clobber unsaved local toggles.+ const rows: Row[] = configured.map(e => ({ ...(scoreById.get(e.modelDbId) ?? {}), ...e }))// Manual → the order you set (by priority). Bandit → ranked by live score.const ordered = isManual? [...rows].sort((a, b) => a.priority - b.priority)@@ -433,6 +500,7 @@ export default function FallbackPage() {<PageHeadertitle="Fallback chain"description="Pick a routing strategy. In Manual mode you drag to set the order; the other strategies route by live score across reliability, speed and intelligence."+ divider={false}/><div className="space-y-6">@@ -440,7 +508,7 @@ export default function FallbackPage() {{tokenUsage && tokenUsage.totalBudget > 0 && <TokenUsageBar data={tokenUsage} />}{/* Strategy selector */}- <section className="rounded-lg border bg-card p-5">+ <section className="rounded-3xl border bg-card p-5"><div className="flex items-baseline justify-between mb-3"><h2 className="text-sm font-medium">Routing strategy</h2>{routing?.weights && (@@ -452,13 +520,13 @@ export default function FallbackPage() {)}</div>- <div className="inline-flex flex-wrap gap-1 rounded-lg border p-1">+ <div className="inline-flex flex-wrap gap-1 rounded-xl border p-1">{STRATEGIES.map(s => (<Tooltip key={s.key} text={s.blurb}><buttondisabled={strategyMutation.isPending}onClick={() => strategyMutation.mutate(s.key)}- className={`px-3 py-1.5 text-xs rounded-md transition-colors ${+ className={`px-3 py-1.5 text-xs rounded-lg transition-colors ${s.key === strategy? 'bg-foreground text-background font-medium': 'text-muted-foreground hover:text-foreground hover:bg-muted'@@ -481,7 +549,7 @@ export default function FallbackPage() {{isLoading ? (<p className="text-sm text-muted-foreground">Loading…</p>) : ordered.length === 0 ? (- <div className="rounded-lg border border-dashed p-8 text-center">+ <div className="rounded-3xl border border-dashed p-8 text-center"><p className="text-sm text-muted-foreground">No models available. Add API keys on the <a href="/keys" className="underline text-foreground">Keys page</a> first.</p>@@ -492,7 +560,7 @@ export default function FallbackPage() {live-region <div>s, which are invalid as direct <table> children. */}{isManual ? (<DndContext sensors={sensors} collisionDetection={closestCenter} onDragEnd={handleDragEnd}>- <div className="rounded-lg border overflow-x-auto">+ <div className="rounded-2xl border overflow-x-auto"><table className="w-full text-sm">{tableHead}<SortableContext items={ordered.map(e => e.modelDbId)} strategy={verticalListSortingStrategy}>@@ -506,7 +574,7 @@ export default function FallbackPage() {</div></DndContext>) : (- <div className="rounded-lg border overflow-x-auto">+ <div className="rounded-2xl border overflow-x-auto"><table className="w-full text-sm">{tableHead}<tbody>@@ -520,14 +588,15 @@ export default function FallbackPage() {</div>)}- {hasChanges && (- <div className="flex justify-end gap-2">- <Button variant="outline" size="sm" onClick={() => setLocalEntries(null)}>Discard</Button>- <Button size="sm" onClick={handleSave} disabled={saveMutation.isPending}>- {saveMutation.isPending ? 'Saving…' : 'Save changes'}- </Button>- </div>- )}+ {/* Floating action bar — fixed to the viewport so it's always visible,+ sliding up when there are unsaved changes and back down on save/discard. */}+ <FloatingBar show={hasChanges}>+ <span className="text-xs text-muted-foreground">Unsaved changes</span>+ <Button variant="outline" size="sm" onClick={() => setLocalEntries(null)}>Discard</Button>+ <Button size="sm" onClick={handleSave} disabled={saveMutation.isPending}>+ {saveMutation.isPending ? 'Saving…' : 'Save changes'}+ </Button>+ </FloatingBar>{unconfiguredPlatforms.length > 0 && (<p className="text-xs text-muted-foreground">Hidden (no keys): {unconfiguredPlatforms.join(', ')}</p>diff --git a/client/src/pages/KeysPage.tsx b/client/src/pages/KeysPage.tsxindex c99cb0a6..506e892a 100644--- a/client/src/pages/KeysPage.tsx+++ b/client/src/pages/KeysPage.tsx@@ -120,7 +120,7 @@ function UnifiedKeySection() {}return (- <section className="rounded-lg border bg-card p-5">+ <section className="rounded-3xl border bg-card p-5"><div className="flex items-start justify-between gap-4 mb-3"><div><h2 className="text-sm font-medium">Your unified API key</h2>@@ -139,14 +139,14 @@ function UnifiedKeySection() {</div>{isError ? (- <div className="rounded-md border border-destructive/40 bg-destructive/10 px-3 py-2.5 text-xs text-destructive">+ <div className="rounded-lg border border-destructive/40 bg-destructive/10 px-3 py-2.5 text-xs text-destructive">Can't reach the server on <code className="font-mono">{baseUrl.replace('/v1', '')}</code>. Make sure thebackend is running — <code className="font-mono">npm run dev</code> starts both, and the server logs printunder the <code className="font-mono">server</code> prefix.</div>) : (<div className="flex items-center gap-2">- <code className="flex-1 font-mono text-xs bg-muted px-3 py-2 rounded-md select-all truncate tabular-nums">+ <code className="flex-1 font-mono text-xs bg-muted px-3 py-2 rounded-lg select-all truncate tabular-nums">{showKey ? apiKey : masked}</code><Button variant="outline" size="sm" onClick={() => setShowKey(!showKey)}>@@ -202,7 +202,7 @@ function CustomProviderSection() {gateway. Add each model you want routed; they all share the one endpoint. The API key is optional(most local servers don't need one).</p>- <form onSubmit={submit} className="flex flex-wrap items-end gap-3 rounded-lg border p-4 bg-card">+ <form onSubmit={submit} className="flex flex-wrap items-end gap-3 rounded-3xl border p-4 bg-card"><div className="space-y-1.5 flex-1 min-w-[240px]"><Label className="text-xs">Base URL</Label><Input@@ -398,7 +398,7 @@ export default function KeysPage() {<section><h2 className="text-sm font-medium mb-3">Add a provider key</h2>- <form onSubmit={handleSubmit} className="flex flex-wrap items-end gap-3 rounded-lg border p-4 bg-card">+ <form onSubmit={handleSubmit} className="flex flex-wrap items-end gap-3 rounded-3xl border p-4 bg-card"><div className="space-y-1.5"><Label className="text-xs">Platform</Label><Select value={platform} onValueChange={(v) => setPlatform(v as Platform)}>@@ -468,7 +468,7 @@ export default function KeysPage() {{isLoading ? (<p className="text-sm text-muted-foreground">Loading…</p>) : keys.length === 0 ? (- <div className="rounded-lg border border-dashed p-8 text-center">+ <div className="rounded-3xl border border-dashed p-8 text-center"><p className="text-sm text-muted-foreground">No provider keys yet. Add one above to start routing.</p>@@ -493,7 +493,7 @@ export default function KeysPage() {{group.keys.length} key{group.keys.length === 1 ? '' : 's'}</span></div>- <div className="rounded-lg border divide-y bg-card overflow-hidden">+ <div className="rounded-2xl border divide-y bg-card overflow-hidden">{group.keys.map(k => {const h = healthKeyMap.get(k.id)const status = h?.status ?? k.statusdiff --git a/client/src/pages/PlaygroundPage.tsx b/client/src/pages/PlaygroundPage.tsxindex 2ba0449e..7a93948c 100644--- a/client/src/pages/PlaygroundPage.tsx+++ b/client/src/pages/PlaygroundPage.tsx@@ -169,7 +169,7 @@ export default function PlaygroundPage() {}/>- <div className="flex-1 flex flex-col rounded-lg border bg-card overflow-hidden min-h-0">+ <div className="flex-1 flex flex-col rounded-3xl border bg-card overflow-hidden min-h-0"><div className="flex-1 overflow-y-auto p-6 space-y-4">{messages.length === 0 ? (<div className="flex items-center justify-center h-full text-center">@@ -234,7 +234,7 @@ export default function PlaygroundPage() {onKeyDown={handleKeyDown}placeholder="Type a message… (⏎ to send, ⇧⏎ for newline)"rows={1}- className="flex-1 resize-none rounded-md border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-ring/50 min-h-[40px] max-h-[160px]"+ className="flex-1 resize-none rounded-lg border bg-background px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-ring/50 min-h-[40px] max-h-[160px]"style={{ height: 'auto', overflow: 'hidden' }}onInput={e => {const el = e.target as HTMLTextAreaElement