InferenceNetStructured Output Model

    Schematron V2 Turbo

    The high-throughput tier of the Schematron family, purpose-built to turn messy HTML into schema-conforming JSON. Optimized for speed and cost at scale — pass a JSON Schema and a page, get back clean, typed data over a 128K context.

    import OpenAI from "openai";
    import { z } from "zod";
    import { zodResponseFormat } from "openai/helpers/zod";
    
    const openai = new OpenAI({
      baseURL: "https://api.inference.net/v1",
      apiKey: "<YOUR_API_KEY>",
    });
    
    // Define the shape you want back. There is no prompt — the schema is
    // the only instruction the model needs.
    const Listing = z.object({
      title: z.string(),
      price: z.number(),
      city: z.string(),
    });
    
    // Messy HTML in, conforming JSON out.
    const html = `<div class="listing">
      <h2>Brompton C Line</h2>
      <span class="p">£1,795</span>
      <p>Used · London</p>
    </div>`;
    
    const response = await openai.chat.completions.parse({
      model: "inference-net/schematron-v2-turbo",
      messages: [{ role: "user", content: html }],
      response_format: zodResponseFormat(Listing, "listing"),
      temperature: 0,
    });
    
    console.log(response.choices[0].message.parsed);
    // { title: "Brompton C Line", price: 1795, city: "London" }
    How it worksSchema-constrained decoding — output is valid JSON by construction, not by retry.
    Input · raw HTML
    <div class="listing">
      <h2>Brompton C Line</h2>
      <span class="p">£1,795</span>
      <p>Used · London</p>
    </div>
    Input · JSON Schema
    { "title":  "string",
      "price":  "number",
      "city":   "string" }
    schematron-v2-turbo
    Output · conforming JSONAlways valid
    {
      "title": "Brompton C Line",
      "price": 1795,
      "city":  "London"
    }

    Start building with Schematron V2 Turbo today

    Serverless, OpenAI-compatible, and billed per token. No commitments.