Skip to content

Structured output

Preview

Constrain a response to a JSON schema so downstream code can parse it without defensive guesswork.

Last updated 2026-07-24

Preview: This endpoint ships with the API launch. The shape below is the interface we are building to. It is documented now so you can plan an integration, not so you can call it today.

Asking a model to 'reply in JSON' works until it doesn't. Structured output makes the shape a contract: you supply a schema, and the response conforms to it. This removes an entire category of production failure, the one where a prose preamble or a trailing explanation breaks your parser at 3am.

Use it wherever a model's output feeds code rather than a human: extraction, classification, routing decisions, and any step in a pipeline whose next stage expects fields.

Requesting a schema

curl https://api.webparam.com/v1/chat/completions \
  -H "Authorization: Bearer $WEBPARAM_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "openai/gpt-5.1",
    "messages": [{ "role": "user", "content": "Extract the invoice fields" }],
    "response_format": {
      "type": "json_schema",
      "json_schema": {
        "name": "invoice",
        "schema": {
          "type": "object",
          "properties": {
            "total": { "type": "number" },
            "currency": { "type": "string" }
          },
          "required": ["total", "currency"]
        }
      }
    }
  }'

Illustrative: API not yet live

While the API is in build, you can explore the same models two ways: ask Echo how a request and response fit together, or browse the catalogue to compare pricing, context and capabilities.