Your LLM’s JSON output will drift.
Catch it before prod.
Validate OpenAI / Claude / Gemini structured output against a Zod schema — or infer one from a few good responses. 100% local. No API keys. Your data never leaves your machine.
The drift nobody notices
You ship a feature on top of response_format: json_schema or tool calls. It works. Then you bump the model — gpt-4o → gpt-5, Claude Sonnet 4.5 → 4.6 — and the JSON quietly changes shape:
- •a number comes back as "0.9" — a string
- •a required field goes missing in 2 of every 10 responses
- •a new enum value appears that your parser doesn't handle
- •the model adds an extra field you never asked for
Your JSON.parse succeeds. Your app breaks downstream. Nobody noticed.
Paste your outputs. Get a per-record report.
✓ 8 passed ✗ 2 failed of 10
✗ output #3
"confidence": expected number, got string ("0.92")
→ model returned a quoted number — use z.coerce.number()
✗ output #7
missing required field "sources" (expected string[])
⚠ unexpected field "reasoning" appeared
wrong type ×1 · missing field ×1 · extra field ×1- No schema yet? Click Infer schema — TypeMorph builds a Zod schema from your known-good responses.
- Human-readable diagnosis, not a cryptic stack trace — with a suggested fix.
- Batch / drift mode: feed a
.jsonlof logged outputs and see exactly how many drifted, and why.
In your code, or your CI
# Validate logged outputs against your schema typemorph validate schema.ts responses.jsonl # Bootstrap a schema from known-good responses typemorph validate --infer good-responses.jsonl --out schema.ts # In CI — advisory PR comment, fails the job if outputs drift typemorph validate schema.ts fixtures/llm-outputs.jsonl --format github
Why local matters here
LLM outputs often contain your users’ data — prompts, PII, proprietary content. Most online “validators” upload it to a server. TypeMorph runs entirely in your browser tab, or in your own CI runner. No upload. No API key. No retention. Nothing to leak.
Honest limits
TypeMorph validates structure: types, required fields, nulls, shapes — and flags enum/format drift as warnings (it never hard-fails an unknown value). It’s a fast safety net and a great starting point, not a replacement for the real Zod schema you own. Inference from samples can’t know every valid value, so treat it as advisory: a signal in your PR, not a gate you blindly trust.
FAQ
Does my data get uploaded?
No. Validation runs locally — in your browser or your CI runner. No server, no API keys, no retention.
Is this a production validator?
It's structural and advisory. Use it to catch drift fast and to scaffold the Zod schema you then own and refine — not as a gate you blindly trust.
Which providers does it work with?
Any that return JSON — OpenAI structured outputs, Anthropic tool use, Vercel AI generateObject, MCP tools, or raw responses.
Is it free?
The web validator and the `typemorph validate` CLI are free. Batch/folder mode, saved schema libraries, and CI history are Pro.