Open History to see the last commit
1import { useEffect } from 'react'
2import { createFileRoute } from '@tanstack/react-router'
3import { createServerFn } from '@tanstack/react-start'
4
5import { registerWebMcp } from '#/lib/webmcp.ts'
6import { timeAgo } from '#/lib/time.ts'
7import { EXAMPLES } from '#/lib/examples.ts'
8
9import {
10 ChangeSummary,
11 CodePanel,
12 SectionHead,
13 SiteFooter,
14 SiteNav,
15 StatusDot,
16} from '#/components/site.tsx'
17import type { Completeness, ServiceStatus } from '#/server/status.ts'
18
19interface DashboardChange {
20 id: string
21 type: string
22 providerId: string
23 subjectId: string
24 summary: string
25 createdAt: number
26}
27
28interface DashboardData {
29 status: ServiceStatus
30 changes: Array<DashboardChange>
31}
32
33const getDashboardData = createServerFn({ method: 'GET' }).handler(
34 async (): Promise<DashboardData> => {
35 const { env } = await import('cloudflare:workers')
36 const { getDb } = await import('#/db/index.ts')
37 const { getServiceStatus } = await import('#/server/status.ts')
38 const { listChanges } = await import('#/server/changes-api.ts')
39
40 const db = getDb(env, { replica: true })
41 const [status, changesOutcome] = await Promise.all([
42 getServiceStatus(db),
43 // Updates are mostly router prices moving poll to poll; additions
44 // are what a visitor wants to see first.
45 listChanges(db, { type: 'model.added', limit: 8 }),
46 ])
47 return {
48 status,
49 changes: changesOutcome.ok
50 ? changesOutcome.result.changes.map((c) => ({
51 id: c.id,
52 type: c.type,
53 providerId: c.providerId,
54 subjectId: c.subjectId,
55 summary: c.summary,
56 createdAt: c.createdAt,
57 }))
58 : [],
59 }
60 },
61)
62
63export const Route = createFileRoute('/')({
64 loader: () => getDashboardData(),
65 component: Landing,
66})
67
68const fmt = new Intl.NumberFormat('en-US')
69
70/** Whole-percent coverage, or null when there is nothing to cover. */
71const pct = (part: number, whole: number) =>
72 whole > 0 ? Math.round((part / whole) * 100) : null
73const showPct = (value: number | null) => (value === null ? '—' : `${value}%`)
74/** "2026-10-07 05:15Z (3 polls)" for a status marker's tooltip. */
75const since = (record: { since: number; polls: number }) =>
76 `${new Date(record.since * 1000).toISOString().slice(0, 16).replace('T', ' ')}Z (${record.polls} ${record.polls === 1 ? 'poll' : 'polls'})`
77
78/** An amber word beside the status dot; the detail is its tooltip and label. */
79function Marker({ label, text }: { label: string; text: string }) {
80 return (
81 <span
82 className="ml-2 cursor-help text-xs text-tok-amber"
83 title={text}
84 aria-label={text}
85 >
86 {label}
87 </span>
88 )
89}
90
91function completenessNote(c: Completeness): string {
92 // Defensive: nothing `/v1/status` sends may throw in render.
93 const silent = Array.isArray(c.silent) ? c.silent.join(', ') : ''
94 if (c.needed === 0) {
95 return `Nothing to fill across ${c.rows} models: this provider does not publish ${silent}`
96 }
97 return `${c.filled} of ${c.needed} facts filled across ${c.rows} models${silent ? `; not published by this provider: ${silent}` : ''}`
98}
99
100function Landing() {
101 const { status, changes } = Route.useLoaderData()
102 // WebMCP (task 10.6): in-page tools for browsers that ship
103 // navigator.modelContext; silently absent everywhere else.
104 useEffect(() => {
105 registerWebMcp()
106 }, [])
107 const totals = status.providers.reduce(
108 (acc, p) => ({
109 models: acc.models + p.counts.models,
110 endpoints: acc.endpoints + p.counts.endpoints,
111 schemas: acc.schemas + p.counts.schemas,
112 }),
113 { models: 0, endpoints: 0, schemas: 0 },
114 )
115 // Unweighted across providers, so one huge catalog can't swamp the rest.
116 const pricePcts = status.providers
117 .map((p) => pct(p.counts.priced, p.counts.models))
118 .filter((v) => v !== null)
119 const avgPrice = pricePcts.length
120 ? Math.round(pricePcts.reduce((a, b) => a + b, 0) / pricePcts.length)
121 : null
122 const lastPolledAt = Math.max(
123 0,
124 ...status.providers.map((p) => p.lastPolledAt ?? 0),
125 )
126 const lastSyncedAt = Math.max(
127 0,
128 ...status.providers.map((p) => p.lastSyncedAt ?? 0),
129 )
130
131 return (
132 <div className="min-h-screen text-ink">
133 <SiteNav />
134
135 <main className="mx-auto max-w-[1080px] px-6 pb-16">
136 <header className="pt-13">
137 <h1 className="m-0 mb-3 max-w-[30em] font-mono text-[clamp(22px,3.4vw,30px)] leading-[1.25] font-semibold tracking-[-0.01em] text-balance">
138 Live request & response schemas for every AI model API
139 <span className="text-tok-blue">▌</span>
140 </h1>
141 <p className="m-0 mb-6 max-w-[40em] text-[14.5px] text-ink-soft">
142 Which models exist right now, and what their payloads look like.
143 JSON Schemas for {status.providers.length} providers, refreshed
144 automatically, served as plain JSON over HTTP — no key needed for
145 reads.
146 </p>
147
148 <CodePanel
149 title="try it"
150 copyText="curl https://modelschemas.com/v1/models?q=claude"
151 >
152 <code>
153 <span className="prompt">$</span> curl{' '}
154 <span className="cj-str">
155 https://modelschemas.com/v1/models?q=claude
156 </span>
157 {'\n'}
158 <span className="cj-dim">{'{'} </span>
159 <span className="cj-key">"id"</span>
160 <span className="cj-dim">: </span>
161 <span className="cj-str">"anthropic-claude-sonnet-5"</span>
162 <span className="cj-dim">, </span>
163 <span className="cj-key">"rawId"</span>
164 <span className="cj-dim">: </span>
165 <span className="cj-str">"claude-sonnet-5"</span>
166 <span className="cj-dim">, </span>
167 <span className="cj-key">"lastSeenAt"</span>
168 <span className="cj-dim">: </span>
169 <span className="cj-num">{lastPolledAt || 1783408549}</span>
170 <span className="cj-dim">, … {'}'}</span>
171 </code>
172 </CodePanel>
173
174 <div className="mt-5 flex flex-wrap gap-2.5 font-mono text-[12.5px]">
175 <a
176 href="/models"
177 className="rounded-[4px] border border-ink bg-ink px-3.5 py-2 text-paper transition-opacity hover:opacity-85"
178 >
179 GET /v1/models
180 </a>
181 <a
182 href="/schemas"
183 className="rounded-[4px] border border-rule-strong px-3.5 py-2 transition-colors hover:border-ink"
184 >
185 GET /v1/schemas
186 </a>
187 <a
188 href="/docs"
189 className="rounded-[4px] border border-rule-strong px-3.5 py-2 transition-colors hover:border-ink"
190 >
191 docs
192 </a>
193 <a
194 href="/mcp"
195 className="rounded-[4px] border border-rule-strong px-3.5 py-2 transition-colors hover:border-ink"
196 >
197 /mcp
198 </a>
199 <a
200 href="/llms.txt"
201 className="rounded-[4px] border border-rule-strong px-3.5 py-2 transition-colors hover:border-ink"
202 >
203 /llms.txt
204 </a>
205 </div>
206
207 <div className="hairline mt-11 flex flex-wrap gap-x-5 gap-y-2 border-y py-3 font-mono text-xs text-ink-soft">
208 <span className="inline-flex items-center gap-2">
209 <span className="pulse-dot bg-tok-green" />
210 <span className="text-tok-green">live</span>
211 </span>
212 <span>
213 <b className="font-semibold text-ink tabular-nums">
214 {status.providers.length}
215 </b>{' '}
216 providers
217 </span>
218 <span>
219 <b className="font-semibold text-ink tabular-nums">
220 {fmt.format(totals.models)}
221 </b>{' '}
222 models
223 </span>
224 <span>
225 <b className="font-semibold text-ink tabular-nums">
226 {fmt.format(totals.endpoints)}
227 </b>{' '}
228 endpoints
229 </span>
230 <span>
231 <b className="font-semibold text-ink tabular-nums">
232 {fmt.format(totals.schemas)}
233 </b>{' '}
234 schema versions
235 </span>
236 <span>
237 <b className="font-semibold text-ink tabular-nums">
238 {showPct(avgPrice)}
239 </b>{' '}
240 priced, avg per provider
241 </span>
242 <span>
243 polled{' '}
244 <b className="font-semibold text-ink">
245 {timeAgo(lastPolledAt, status.time)}
246 </b>{' '}
247 · specs synced{' '}
248 <b className="font-semibold text-ink">
249 {timeAgo(lastSyncedAt, status.time)}
250 </b>
251 </span>
252 </div>
253 </header>
254
255 <section>
256 <SectionHead
257 title="Providers"
258 aside={
259 <a className="press-link" href="/v1/providers">
260 GET /v1/providers →
261 </a>
262 }
263 />
264 <div className="figure overflow-x-auto">
265 <table className="dtable dtable-cards">
266 <thead>
267 <tr>
268 <th>provider</th>
269 <th>status</th>
270 <th className="num">models</th>
271 <th className="num">endpoints</th>
272 <th className="num">schemas</th>
273 <th className="num" title="Share of models with a price card">
274 priced
275 </th>
276 <th
277 className="num"
278 title="Completeness: the share of the facts @tanstack/ai-models needs that are filled for this provider's models. Chat rows are scored on the chat facts; image, video and audio rows on price, endpoint and input and output modalities; a row with no activity is a gap; a row whose id another provider also lists needs an origin link. Facts the provider does not publish are left out."
279 >
280 complete
281 </th>
282 <th className="num">polled</th>
283 <th className="num">synced</th>
284 </tr>
285 </thead>
286 <tbody>
287 {status.providers.map((p) => (
288 <tr key={p.id}>
289 <td className="font-medium">
290 <a
291 className="text-ink hover:text-tok-blue"
292 href={`/models?provider=${p.id}`}
293 >
294 {p.displayName}
295 </a>
296 </td>
297 <td>
298 <StatusDot status={p.status} />
299 {p.docsFailing && (
300 <Marker
301 label="docs"
302 text={`docs failing since ${since(p.docsFailing)}: ${[p.docsFailing.sources[0], String(p.docsFailing.error).slice(0, 160)].filter(Boolean).join(' — ')}`}
303 />
304 )}
305 {p.priceClearsRefused && (
306 <Marker
307 label="prices"
308 text={`price clears refused since ${since(p.priceClearsRefused)}: ${p.priceClearsRefused.refused} of ${p.priceClearsRefused.priced} stored prices kept`}
309 />
310 )}
311 {p.updateStorm && (
312 <Marker
313 label="updates"
314 text={`update storm since ${since(p.updateStorm)}: ${p.updateStorm.updated} of ${p.updateStorm.live} live rows updated in one poll`}
315 />
316 )}
317 </td>
318 <td className="num" data-label="models">
319 {fmt.format(p.counts.models)}
320 </td>
321 <td className="num" data-label="endpoints">
322 {fmt.format(p.counts.endpoints)}
323 </td>
324 <td className="num" data-label="schemas">
325 {p.counts.schemas > 0 ? (
326 <a
327 className="text-ink hover:text-tok-blue"
328 href={`/schemas?provider=${p.id}`}
329 >
330 {fmt.format(p.counts.schemas)}
331 </a>
332 ) : (
333 fmt.format(p.counts.schemas)
334 )}
335 </td>
336 <td className="num" data-label="priced">
337 {showPct(pct(p.counts.priced, p.counts.models))}
338 </td>
339 <td className="num" data-label="chat">
340 {p.completeness.score === null ? (
341 '—'
342 ) : (
343 <a
344 className="text-ink hover:text-tok-blue"
345 href={`/models?provider=${p.id}&activity=chat`}
346 title={completenessNote(p.completeness)}
347 >
348 {showPct(
349 Math.round(Number(p.completeness.score) * 100),
350 )}
351 </a>
352 )}
353 </td>
354 <td className="num text-ink-faint" data-label="polled">
355 {timeAgo(p.lastPolledAt, status.time)}
356 </td>
357 <td className="num text-ink-faint max-[899px]:hidden">
358 {timeAgo(p.lastSyncedAt, status.time)}
359 </td>
360 </tr>
361 ))}
362 </tbody>
363 </table>
364 </div>
365 </section>
366
367 <section>
368 <SectionHead
369 title="New models"
370 aside={
371 <a className="press-link" href="/changes?type=model.added">
372 all new models →
373 </a>
374 }
375 />
376 {changes.length === 0 ? (
377 <p className="font-mono text-sm text-ink-faint">
378 no new models yet — the next cron poll will populate this list.
379 </p>
380 ) : (
381 <>
382 <div className="figure overflow-x-auto">
383 <table className="dtable">
384 <tbody>
385 {changes.map((change) => (
386 <tr key={change.id}>
387 <td className="font-mono text-xs whitespace-nowrap text-ink-faint">
388 {timeAgo(change.createdAt, status.time)}
389 </td>
390 <td className="max-w-[38em] truncate">
391 <ChangeSummary change={change} />
392 </td>
393 <td className="font-mono text-xs text-ink-faint max-sm:hidden">
394 {change.providerId}
395 </td>
396 </tr>
397 ))}
398 </tbody>
399 </table>
400 </div>
401 <p className="mt-2.5 font-mono text-xs text-ink-faint">
402 <a className="press-link" href="/changes">
403 every change: GET /v1/changes
404 </a>{' '}
405 · subscribe with a webhook to get these pushed —{' '}
406 <a className="press-link" href="/docs">
407 POST /v1/subscriptions
408 </a>
409 </p>
410 </>
411 )}
412 </section>
413
414 <section>
415 <SectionHead
416 title="Examples"
417 aside={
418 <a className="press-link" href="/examples">
419 /examples →
420 </a>
421 }
422 />
423 <div className="figure overflow-x-auto">
424 <table className="dtable">
425 <tbody>
426 {EXAMPLES.map((example) => (
427 <tr key={example.slug}>
428 <td className="font-mono text-xs whitespace-nowrap">
429 <a
430 className="press-link"
431 href={`/examples/${example.slug}/`}
432 >
433 {example.slug}
434 </a>
435 </td>
436 <td className="max-w-[38em]">{example.blurb}</td>
437 <td className="font-mono text-xs whitespace-nowrap text-ink-faint max-sm:hidden">
438 {example.package}
439 </td>
440 </tr>
441 ))}
442 </tbody>
443 </table>
444 </div>
445 </section>
446 </main>
447
448 <SiteFooter />
449 </div>
450 )
451}