Skip to content
Source
Sign inSign up
TanStack/schemas

Architecture

Describes commit 20d83ebUpdated Made by anthropic/claude-haiku-5.5

Overview

A live AI model schema service on Cloudflare Workers, with build-time pull tooling for client projects.

What it does

  • Serves per-endpoint request and response JSON Schemas for monitored AI providers.
  • Serves model metadata, pricing data and a changes feed.
  • Exposes an HTTP API under /v1, an MCP server at /mcp and an agent guide at /llms.txt.
  • Ships a TypeScript client, a CLI and a Vite plugin that commit schemas into client projects.

Main parts

  • packages/client: typed fetch client generated from the service OpenAPI spec.
  • packages/cli: the modelschemas command, a thin layer over the client.
  • packages/codegen: pull core with selection grammar, lockfile manifest and file writer.
  • packages/vite: Vite plugin that pulls missing schemas in dev and verifies files at build.
  • packages/rate-card: pricing schema, evaluator and listing compilers, with no dependencies.
  • src: the Cloudflare Worker app, with routes, server code, database access and components.
  • examples: three sample apps that consume the client or the Vite plugin.

How the parts work together

  • The service derives schemas from upstream provider specs on a schedule.
  • The client and CLI call the public /v1 API.
  • The codegen package writes schema modules and a .manifest.json lockfile into a project.
  • The Vite plugin calls codegen. It pulls in dev and verifies offline in build.
  • The rate-card package supplies pricing types and the evaluator used by the service.

Where to start

  • Read src/ for the service and packages/codegen/src/pull.ts for the pull flow.
  • Read packages/client/src/index.ts for the client entry.
  • Read scripts/rederive.ts to reproduce content hashes from upstream specs.