InferenceNetStructured Output Model

    Schematron V2 Small

    A specialized extraction model that turns messy HTML into clean, schema-conforming JSON. Schematron V2 Small delivers the family's highest extraction quality — approaching frontier-model accuracy on complex schemas and long pages at a small fraction of the cost.

    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-small",
      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-small
    Output · conforming JSONAlways valid
    {
      "title": "Brompton C Line",
      "price": 1795,
      "city":  "London"
    }

    Start building with Schematron V2 Small today

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