Open History to see the last commit
1import { createFileRoute } from '@tanstack/react-router'
2
3import { halGet, halPost } from '#/server/hal.ts'
4
5export const serviceIndex = {
6 service: 'modelschemas',
7 description:
8 'Live AI model schemas: per-endpoint request/response JSON Schemas and model metadata for monitored providers, auto-refreshed.',
9 documentation: {
10 openapi: '/openapi.json',
11 agents: '/llms.txt',
12 },
13 _links: {
14 self: halGet('/v1'),
15 status: halGet('/v1/status'),
16 providers: halGet('/v1/providers'),
17 models: halGet(
18 '/v1/models{?activity,provider,capability,q,provenance,pricing}',
19 {
20 example: '/v1/models?activity=chat&q=claude',
21 },
22 ),
23 model: halGet('/v1/models/{provider}/{modelId}', {
24 example: '/v1/models/anthropic/claude-sonnet-4-5',
25 }),
26 schemaIndex: halGet('/v1/schemas', {
27 example: '/v1/schemas',
28 }),
29 schemas: halGet('/v1/schemas/{provider}', {
30 example: '/v1/schemas/anthropic',
31 }),
32 activitySchemas: halGet('/v1/schemas/{provider}/{activity}', {
33 example: '/v1/schemas/anthropic/chat',
34 }),
35 schema: halGet(
36 '/v1/schemas/{provider}/{activity}/{endpointId}{?kind,version}',
37 {
38 example: '/v1/schemas/anthropic/chat/v1%2Fmessages?kind=input',
39 },
40 ),
41 providerOpenapi: halGet('/v1/openapi/{provider}{?model,activity}', {
42 example: '/v1/openapi/anthropic',
43 }),
44 validate: halPost('/v1/validate', {
45 example: {
46 provider: 'anthropic',
47 endpointId: 'v1/messages',
48 kind: 'input',
49 payload: { model: 'claude-sonnet-4-5', max_tokens: 1024 },
50 },
51 }),
52 estimate: halPost('/v1/estimate', {
53 example: {
54 provider: 'openai',
55 model: 'gpt-4o',
56 usage: { input_tokens: 1200, output_tokens: 400 },
57 },
58 }),
59 changes: halGet('/v1/changes{?since,provider,type,cursor,limit,wait}', {
60 example: '/v1/changes?limit=20',
61 }),
62 agentDiscovery: halGet('/.well-known/agent-configuration'),
63 },
64}
65
66export const Route = createFileRoute('/v1/')({
67 server: {
68 handlers: {
69 GET: () => Response.json(serviceIndex),
70 },
71 },
72})