'use client'; import { useEffect, useState } from 'react'; import { api } from '@/lib/api'; import { useSession } from '@/lib/auth-client'; interface ProviderInfo { name: string; enabled: boolean; modelCount: number; } interface ModelInfo { id: string; name: string; provider: string; contextWindow: number; reasoning: boolean; cost: { input: number; output: number }; } export default function SettingsPage(): React.ReactElement { const { data: session } = useSession(); const [providers, setProviders] = useState([]); const [models, setModels] = useState([]); const [loading, setLoading] = useState(true); useEffect(() => { Promise.all([ api('/api/providers').catch(() => []), api('/api/providers/models').catch(() => []), ]) .then(([p, m]) => { setProviders(p); setModels(m); }) .finally(() => setLoading(false)); }, []); return (

Settings

{/* Profile */}

Profile

{session?.user ? (
) : (

Not signed in

)}
{/* Providers */}

LLM Providers

{loading ? (

Loading providers...

) : providers.length === 0 ? (

No providers configured

) : (
{providers.map((p) => (

{p.name}

{p.modelCount} models available

{p.enabled ? 'Active' : 'Disabled'}
))}
)}
{/* Models */}

Available Models

{loading ? (

Loading models...

) : models.length === 0 ? (

No models available

) : (
{models.map((m) => ( ))}
Model Provider Context Cost (in/out)
{m.name} {m.reasoning && ( reasoning )} {m.provider} {(m.contextWindow / 1000).toFixed(0)}k ${m.cost.input} / ${m.cost.output}
)}
); } function Field({ label, value }: { label: string; value: string }): React.ReactElement { return (
{label} {value}
); }