Skip to content
Source
Sign inSign up
TanStack/schemas
Open History to see the last commit

openapi.json

888 lines23.8 KB

1{
2 "openapi": "3.1.0",
3 "info": {
4 "title": "modelschemas",
5 "version": "0.1.0",
6 "description": "Live AI model schema service: per-endpoint request/response JSON Schemas and model metadata for monitored providers, with stale-while-revalidate caching and a change feed. Anonymous reads are allowed at a low rate limit; register (agent-auth or API key) for higher limits and webhook subscriptions."
7 },
8 "servers": [
9 {
10 "url": "/"
11 }
12 ],
13 "paths": {
14 "/v1": {
15 "get": {
16 "operationId": "getServiceIndex",
17 "summary": "Service description and endpoint index",
18 "responses": {
19 "200": {
20 "description": "Service index with _links to every surface.",
21 "content": {
22 "application/json": {
23 "schema": {
24 "type": "object"
25 }
26 }
27 }
28 }
29 }
30 }
31 },
32 "/v1/status": {
33 "get": {
34 "operationId": "getStatus",
35 "summary": "Per-provider sync status and row counts",
36 "parameters": [
37 {
38 "name": "wait",
39 "in": "query",
40 "description": "Long-poll: hold up to N seconds (cap 60; \"30s\" form accepted) until new data exists, then return current data.",
41 "schema": {
42 "type": "string"
43 }
44 }
45 ],
46 "responses": {
47 "200": {
48 "description": "Service status.",
49 "content": {
50 "application/json": {
51 "schema": {
52 "$ref": "#/components/schemas/ServiceStatus"
53 }
54 }
55 }
56 }
57 }
58 }
59 },
60 "/v1/providers": {
61 "get": {
62 "operationId": "listProviders",
63 "summary": "List monitored providers with sync status",
64 "responses": {
65 "200": {
66 "description": "Providers.",
67 "content": {
68 "application/json": {
69 "schema": {
70 "type": "object"
71 }
72 }
73 }
74 }
75 }
76 }
77 },
78 "/v1/providers/{provider}/models": {
79 "get": {
80 "operationId": "listProviderModels",
81 "summary": "List models for one provider",
82 "parameters": [
83 {
84 "name": "provider",
85 "in": "path",
86 "required": true,
87 "description": "Provider slug (see GET /v1/providers).",
88 "schema": {
89 "type": "string"
90 }
91 }
92 ],
93 "responses": {
94 "200": {
95 "description": "Models for the provider.",
96 "content": {
97 "application/json": {
98 "schema": {
99 "type": "object"
100 }
101 }
102 }
103 },
104 "404": {
105 "description": "Error",
106 "content": {
107 "application/json": {
108 "schema": {
109 "$ref": "#/components/schemas/Error"
110 }
111 }
112 }
113 }
114 }
115 }
116 },
117 "/v1/models": {
118 "get": {
119 "operationId": "listModels",
120 "summary": "Cross-provider model catalog",
121 "description": "The headline \"what can I use right now\" endpoint. Filterable.",
122 "parameters": [
123 {
124 "name": "activity",
125 "in": "query",
126 "schema": {
127 "type": "string",
128 "enum": [
129 "chat",
130 "image",
131 "video",
132 "audio",
133 "embeddings",
134 "moderation"
135 ]
136 }
137 },
138 {
139 "name": "provider",
140 "in": "query",
141 "schema": {
142 "type": "string"
143 }
144 },
145 {
146 "name": "capability",
147 "in": "query",
148 "description": "Substring match against model capabilities.",
149 "schema": {
150 "type": "string"
151 }
152 },
153 {
154 "name": "q",
155 "in": "query",
156 "description": "Free-text match against id and display name.",
157 "schema": {
158 "type": "string"
159 }
160 }
161 ],
162 "responses": {
163 "200": {
164 "description": "Matching models.",
165 "content": {
166 "application/json": {
167 "schema": {
168 "type": "object"
169 }
170 }
171 }
172 }
173 }
174 }
175 },
176 "/v1/models/{provider}/{modelId}": {
177 "get": {
178 "operationId": "getModel",
179 "summary": "Full metadata for one model",
180 "parameters": [
181 {
182 "name": "provider",
183 "in": "path",
184 "required": true,
185 "description": "Provider slug (see GET /v1/providers).",
186 "schema": {
187 "type": "string"
188 }
189 },
190 {
191 "name": "modelId",
192 "in": "path",
193 "required": true,
194 "description": "Model slug or raw provider id.",
195 "schema": {
196 "type": "string"
197 }
198 }
199 ],
200 "responses": {
201 "200": {
202 "description": "Model metadata with activity, schemaEndpointId (canonical generation route on grain=provider catalogs), and _links.schema when bound.",
203 "content": {
204 "application/json": {
205 "schema": {
206 "type": "object"
207 }
208 }
209 }
210 },
211 "404": {
212 "description": "Error",
213 "content": {
214 "application/json": {
215 "schema": {
216 "$ref": "#/components/schemas/Error"
217 }
218 }
219 }
220 }
221 }
222 }
223 },
224 "/v1/schemas": {
225 "get": {
226 "operationId": "listAllSchemas",
227 "summary": "System-wide schema index",
228 "description": "Every provider with extracted schemas, each with its activities and endpoint ids — the discovery entry point for all schemas on the system.",
229 "responses": {
230 "200": {
231 "description": "Provider → activity → endpoint-id index.",
232 "content": {
233 "application/json": {
234 "schema": {
235 "type": "object"
236 }
237 }
238 }
239 }
240 }
241 }
242 },
243 "/v1/schemas/{provider}": {
244 "get": {
245 "operationId": "listProviderSchemas",
246 "summary": "Activities and endpoint ids for a provider",
247 "parameters": [
248 {
249 "name": "provider",
250 "in": "path",
251 "required": true,
252 "description": "Provider slug (see GET /v1/providers).",
253 "schema": {
254 "type": "string"
255 }
256 }
257 ],
258 "responses": {
259 "200": {
260 "description": "Activity → endpoint-id index.",
261 "content": {
262 "application/json": {
263 "schema": {
264 "type": "object"
265 }
266 }
267 }
268 },
269 "404": {
270 "description": "Error",
271 "content": {
272 "application/json": {
273 "schema": {
274 "$ref": "#/components/schemas/Error"
275 }
276 }
277 }
278 }
279 }
280 }
281 },
282 "/v1/schemas/{provider}/{activity}": {
283 "get": {
284 "operationId": "getActivitySchemas",
285 "summary": "Endpoint-id-keyed schema map for one activity",
286 "parameters": [
287 {
288 "name": "provider",
289 "in": "path",
290 "required": true,
291 "description": "Provider slug (see GET /v1/providers).",
292 "schema": {
293 "type": "string"
294 }
295 },
296 {
297 "name": "activity",
298 "in": "path",
299 "required": true,
300 "description": "Activity group.",
301 "schema": {
302 "type": "string",
303 "enum": [
304 "chat",
305 "image",
306 "video",
307 "audio",
308 "embeddings",
309 "moderation"
310 ]
311 }
312 }
313 ],
314 "responses": {
315 "200": {
316 "description": "Map of endpoint id → { input, output } self-contained JSON Schemas (current versions).",
317 "content": {
318 "application/json": {
319 "schema": {
320 "type": "object"
321 }
322 }
323 }
324 },
325 "404": {
326 "description": "Error",
327 "content": {
328 "application/json": {
329 "schema": {
330 "$ref": "#/components/schemas/Error"
331 }
332 }
333 }
334 }
335 }
336 }
337 },
338 "/v1/schemas/{provider}/{activity}/{endpointId}": {
339 "get": {
340 "operationId": "getSchema",
341 "summary": "One self-contained JSON Schema",
342 "parameters": [
343 {
344 "name": "provider",
345 "in": "path",
346 "required": true,
347 "description": "Provider slug (see GET /v1/providers).",
348 "schema": {
349 "type": "string"
350 }
351 },
352 {
353 "name": "activity",
354 "in": "path",
355 "required": true,
356 "description": "Activity group.",
357 "schema": {
358 "type": "string",
359 "enum": [
360 "chat",
361 "image",
362 "video",
363 "audio",
364 "embeddings",
365 "moderation"
366 ]
367 }
368 },
369 {
370 "name": "endpointId",
371 "in": "path",
372 "required": true,
373 "description": "Path-derived endpoint id (URL-encode slashes), or a listed model rawId/slug which aliases onto that activity's generation route and pins the request `model` field.",
374 "schema": {
375 "type": "string"
376 }
377 },
378 {
379 "name": "kind",
380 "in": "query",
381 "description": "Defaults to input.",
382 "schema": {
383 "type": "string",
384 "enum": [
385 "input",
386 "output"
387 ]
388 }
389 },
390 {
391 "name": "version",
392 "in": "query",
393 "description": "Content hash of a historical version.",
394 "schema": {
395 "type": "string"
396 }
397 },
398 {
399 "name": "format",
400 "in": "query",
401 "description": "json (default) or types — a self-contained TypeScript module (schema const + generated types, tree-shakeable, zero imports). format=types on an input schema with a model property overlays the live catalog union plus ListedModelId; the schema const and content hash stay the bundled schema.",
402 "schema": {
403 "type": "string",
404 "enum": [
405 "json",
406 "types"
407 ]
408 }
409 },
410 {
411 "name": "optional",
412 "in": "query",
413 "description": "format=types only: optional-property style. exact (default) emits `foo?: T`; undefined emits `foo?: T | undefined`.",
414 "schema": {
415 "type": "string",
416 "enum": [
417 "exact",
418 "undefined"
419 ]
420 }
421 }
422 ],
423 "responses": {
424 "200": {
425 "description": "Self-contained JSON Schema ($defs-bundled) — or, with format=types, a TypeScript module — served with ETag. JSON responses carry `provenance` (upstream sourceUrl, sourceHash, fetchedAt, extractorVersion) so derivations are independently verifiable. `provenance.derivation` grades how the content was arrived at — `upstream-spec` and `generated` are re-derived every sync and self-heal, while `probe-verified` (confirmed against live API calls on `provenance.verifiedAt`) and `docs-derived` (never confirmed) are point-in-time claims that can go stale.",
426 "content": {
427 "application/json": {
428 "schema": {
429 "type": "object"
430 }
431 },
432 "text/typescript": {
433 "schema": {
434 "type": "string"
435 }
436 }
437 }
438 },
439 "404": {
440 "description": "Error",
441 "content": {
442 "application/json": {
443 "schema": {
444 "$ref": "#/components/schemas/Error"
445 }
446 }
447 }
448 }
449 }
450 }
451 },
452 "/v1/openapi/{provider}": {
453 "get": {
454 "operationId": "getProviderOpenApi",
455 "summary": "Generation-only OpenAPI document for one provider",
456 "description": "Assembled from classified endpoints plus the provider connect profile (servers, auth, required headers). Not a raw upstream-spec mirror. Model-grained providers (today: FAL) require ?model=. Selections over 40 classified endpoints, or a filter that matches none, return 400 spec_requires_selector. An unsynced provider returns 404 no_endpoints. ?model= pins the live model enum on provider-grained specs; it does not drop endpoints.",
457 "parameters": [
458 {
459 "name": "provider",
460 "in": "path",
461 "required": true,
462 "description": "Provider slug (see GET /v1/providers).",
463 "schema": {
464 "type": "string"
465 }
466 },
467 {
468 "name": "model",
469 "in": "query",
470 "description": "Pin to one model (raw id or slug). Required for model-grained providers.",
471 "schema": {
472 "type": "string"
473 }
474 },
475 {
476 "name": "activity",
477 "in": "query",
478 "description": "Restrict to one activity group.",
479 "schema": {
480 "type": "string",
481 "enum": [
482 "chat",
483 "image",
484 "video",
485 "audio",
486 "embeddings",
487 "moderation"
488 ]
489 }
490 }
491 ],
492 "responses": {
493 "200": {
494 "description": "OpenAPI 3.1 document.",
495 "content": {
496 "application/openapi+json": {
497 "schema": {
498 "type": "object"
499 }
500 },
501 "application/json": {
502 "schema": {
503 "type": "object"
504 }
505 }
506 }
507 },
508 "400": {
509 "description": "Error",
510 "content": {
511 "application/json": {
512 "schema": {
513 "$ref": "#/components/schemas/Error"
514 }
515 }
516 }
517 },
518 "404": {
519 "description": "Error",
520 "content": {
521 "application/json": {
522 "schema": {
523 "$ref": "#/components/schemas/Error"
524 }
525 }
526 }
527 },
528 "500": {
529 "description": "Error",
530 "content": {
531 "application/json": {
532 "schema": {
533 "$ref": "#/components/schemas/Error"
534 }
535 }
536 }
537 }
538 }
539 }
540 },
541 "/v1/validate": {
542 "post": {
543 "operationId": "validatePayload",
544 "summary": "Validate a payload against a provider endpoint schema",
545 "requestBody": {
546 "required": true,
547 "content": {
548 "application/json": {
549 "schema": {
550 "$ref": "#/components/schemas/ValidateRequest"
551 }
552 }
553 }
554 },
555 "responses": {
556 "200": {
557 "description": "Validation result.",
558 "content": {
559 "application/json": {
560 "schema": {
561 "$ref": "#/components/schemas/ValidateResult"
562 }
563 }
564 }
565 },
566 "400": {
567 "description": "Error",
568 "content": {
569 "application/json": {
570 "schema": {
571 "$ref": "#/components/schemas/Error"
572 }
573 }
574 }
575 },
576 "404": {
577 "description": "Error",
578 "content": {
579 "application/json": {
580 "schema": {
581 "$ref": "#/components/schemas/Error"
582 }
583 }
584 }
585 }
586 }
587 }
588 },
589 "/v1/changes": {
590 "get": {
591 "operationId": "listChanges",
592 "summary": "Changelog feed (cursor-paginated)",
593 "description": "The polling-friendly alternative to webhooks.",
594 "parameters": [
595 {
596 "name": "since",
597 "in": "query",
598 "description": "Unix epoch seconds lower bound.",
599 "schema": {
600 "type": "integer"
601 }
602 },
603 {
604 "name": "provider",
605 "in": "query",
606 "schema": {
607 "type": "string"
608 }
609 },
610 {
611 "name": "type",
612 "in": "query",
613 "schema": {
614 "type": "string",
615 "enum": [
616 "model.added",
617 "model.removed",
618 "model.updated",
619 "schema.added",
620 "schema.updated",
621 "endpoint.added",
622 "endpoint.removed"
623 ]
624 }
625 },
626 {
627 "name": "cursor",
628 "in": "query",
629 "schema": {
630 "type": "string"
631 }
632 },
633 {
634 "name": "wait",
635 "in": "query",
636 "description": "Long-poll: hold up to N seconds (cap 60; \"30s\" form accepted) until new data exists, then return current data.",
637 "schema": {
638 "type": "string"
639 }
640 },
641 {
642 "name": "limit",
643 "in": "query",
644 "schema": {
645 "type": "integer",
646 "minimum": 1,
647 "maximum": 200
648 }
649 }
650 ],
651 "responses": {
652 "200": {
653 "description": "Changes page with next cursor.",
654 "content": {
655 "application/json": {
656 "schema": {
657 "type": "object"
658 }
659 }
660 }
661 }
662 }
663 }
664 },
665 "/v1/admin/sync/{provider}": {
666 "post": {
667 "operationId": "syncProvider",
668 "summary": "Manually trigger a provider spec sync (admin only)",
669 "parameters": [
670 {
671 "name": "provider",
672 "in": "path",
673 "required": true,
674 "description": "Provider slug (see GET /v1/providers).",
675 "schema": {
676 "type": "string"
677 }
678 }
679 ],
680 "security": [
681 {
682 "adminKey": []
683 }
684 ],
685 "responses": {
686 "200": {
687 "description": "Sync outcome.",
688 "content": {
689 "application/json": {
690 "schema": {
691 "type": "object"
692 }
693 }
694 }
695 },
696 "401": {
697 "description": "Error",
698 "content": {
699 "application/json": {
700 "schema": {
701 "$ref": "#/components/schemas/Error"
702 }
703 }
704 }
705 },
706 "404": {
707 "description": "Error",
708 "content": {
709 "application/json": {
710 "schema": {
711 "$ref": "#/components/schemas/Error"
712 }
713 }
714 }
715 },
716 "502": {
717 "description": "Error",
718 "content": {
719 "application/json": {
720 "schema": {
721 "$ref": "#/components/schemas/Error"
722 }
723 }
724 }
725 }
726 }
727 }
728 }
729 },
730 "components": {
731 "securitySchemes": {
732 "adminKey": {
733 "type": "apiKey",
734 "in": "header",
735 "name": "X-Admin-Key"
736 },
737 "bearerAuth": {
738 "type": "http",
739 "scheme": "bearer",
740 "description": "Agent JWT (agent-auth) or API key."
741 }
742 },
743 "schemas": {
744 "Error": {
745 "type": "object",
746 "required": [
747 "error"
748 ],
749 "properties": {
750 "error": {
751 "type": "object",
752 "required": [
753 "code",
754 "message"
755 ],
756 "properties": {
757 "code": {
758 "type": "string"
759 },
760 "message": {
761 "type": "string"
762 }
763 }
764 }
765 }
766 },
767 "ServiceStatus": {
768 "type": "object",
769 "required": [
770 "service",
771 "time",
772 "providers"
773 ],
774 "properties": {
775 "service": {
776 "type": "string",
777 "const": "modelschemas"
778 },
779 "time": {
780 "type": "integer"
781 },
782 "providers": {
783 "type": "array",
784 "items": {
785 "type": "object",
786 "properties": {
787 "id": {
788 "type": "string"
789 },
790 "displayName": {
791 "type": "string"
792 },
793 "status": {
794 "type": "string",
795 "enum": [
796 "active",
797 "degraded",
798 "disabled",
799 "pending"
800 ]
801 },
802 "lastPolledAt": {
803 "type": [
804 "integer",
805 "null"
806 ]
807 },
808 "lastSyncedAt": {
809 "type": [
810 "integer",
811 "null"
812 ]
813 },
814 "counts": {
815 "type": "object",
816 "properties": {
817 "models": {
818 "type": "integer"
819 },
820 "endpoints": {
821 "type": "integer"
822 },
823 "schemas": {
824 "type": "integer"
825 }
826 }
827 }
828 }
829 }
830 }
831 }
832 },
833 "ValidateRequest": {
834 "type": "object",
835 "required": [
836 "provider",
837 "endpointId",
838 "payload"
839 ],
840 "properties": {
841 "provider": {
842 "type": "string"
843 },
844 "endpointId": {
845 "type": "string"
846 },
847 "kind": {
848 "type": "string",
849 "enum": [
850 "input",
851 "output"
852 ]
853 },
854 "payload": {}
855 }
856 },
857 "ValidateResult": {
858 "type": "object",
859 "required": [
860 "valid",
861 "errors"
862 ],
863 "properties": {
864 "valid": {
865 "type": "boolean"
866 },
867 "errors": {
868 "type": "array",
869 "items": {
870 "type": "object",
871 "properties": {
872 "path": {
873 "type": "string"
874 },
875 "message": {
876 "type": "string"
877 },
878 "keyword": {
879 "type": "string"
880 }
881 }
882 }
883 }
884 }
885 }
886 }
887 }