Structured Data Extraction & HTML-to-JSON Inference
Extract clean, strictly typed JSON from messy HTML and long web documents using Inference.net's Schematron V2 Small and Schematron V2 Turbo models. Purpose-trained for schema-first extraction up to 128K tokens with 100% JSON Schema adherence over a standard OpenAI-compatible API.
- Schema-first extraction: pass Pydantic or Zod schemas via `response_format` with 100% JSON adherence
- Two tuned tiers: `inference-net/schematron-v2-small` (highest quality) and `schematron-v2-turbo` (highest throughput)
- Long-context HTML handling up to 128K tokens — robust against noisy real-world markup
- Scales cleanly from real-time `/v1` extraction to 1M-page JSONL Batch API and Group API webhooks
Built for production reliability
| Capability | Specification | How it helps |
|---|---|---|
| Schematron V2 Small | `inference-net/schematron-v2-small` | Highest extraction quality approaching frontier-model accuracy on complex schemas. |
| Schematron V2 Turbo | `inference-net/schematron-v2-turbo` | Optimized for maximum throughput and lowest per-page extraction cost at scale. |
| Context window | Up to 128K tokens | Handles long, noisy real-world HTML documents without brittle CSS selectors. |
| Schema adherence | 100% strict JSON mode | Strict JSON Schema enforcement via OpenAI SDK `response_format` (Zod or Pydantic). |
| Bulk extraction scale | Sync, Group, and Batch ready | Pairs directly with synchronous `/v1`, Group API (50 reqs), or Batch API (1M JSONL). |
Extract typed JSON from messy HTML with Zod
Keep temperature at 0 and strip <script>/<style> tags with lxml or an HTML cleaner before sending.
import OpenAI from "openai";
import { zodResponseFormat } from "openai/helpers/zod";
import { z } from "zod";
const openai = new OpenAI({
baseURL: "https://api.inference.net/v1",
apiKey: process.env.INFERENCE_API_KEY,
});
const Product = z.object({
name: z.string().describe("Exact product title on the page."),
price: z.number().describe("Primary listed price."),
tags: z.array(z.string()).describe("Product category tags."),
});
const resp = await openai.chat.completions.parse({
model: "inference-net/schematron-v2-small",
temperature: 0,
messages: [{ role: "user", content: cleanedHtml }],
response_format: zodResponseFormat(Product, "product"),
});Guides and references
Full TypeScript, Python, and cURL examples plus lxml preprocessing guidance.
Open guide Structured outputs docsJSON Schema mode and strict structured outputs across Inference.net models.
Open guide Schematron V2 Small model pageLive pricing, context window, and quickstart for Schematron V2 Small.
Open guide Schematron V2 Turbo model pageLive pricing, context window, and quickstart for Schematron V2 Turbo.
Open guide Explore all modelsCompare Schematron V2 against general-purpose models in the full catalog.
Open guideFrequently asked questions.
Quick answers to help you get started
Use `inference-net/schematron-v2-small` when you need the highest extraction accuracy on complex nested schemas or very long pages. Use `inference-net/schematron-v2-turbo` when maximum throughput and lowest cost at scale are the priority.
No. Schematron is schema-first: pass the HTML in the user message and define your fields and field descriptions directly in your Pydantic or Zod JSON Schema via `response_format`.
Pre-cleaning HTML with `lxml.html.clean.Cleaner` to strip scripts, styles, and inline JavaScript matches how Schematron was trained, improving accuracy while cutting input tokens.
Yes. Combine Schematron V2 with the Group API (up to 50 pages per job) or Batch API (up to 1,000,000 pages per JSONL file) for large-scale crawling and product-catalog ingestion pipelines.
Ship on Inference.net today
Start self-serve with an API key, explore live model pricing, or talk with our team about dedicated capacity and custom SLAs.