New Tool Radar

AI Concepts

How to Check That a Model Supports Structured Outputs Before Using It

Check that a model supports Structured Outputs before using it, because older models only offer JSON mode.

Schematic illustration of check that a model supports structured outputs before using it: step one read the model page, step two send a test request, step three fall back if needed.

Structured Outputs is available in the latest large language models, starting with GPT-4o, and older models like GPT-4 Turbo and earlier may use JSON mode instead. JSON mode only guarantees valid JSON, not schema adherence, so code written for Structured Outputs will fail on a model that does not support it. Check support before you build on it.

Prerequisites

  • The model you plan to use.
  • The provider’s documentation for Structured Outputs support.
  • A small test schema and a test prompt.

Steps

Step 1: Read the model page

Read the provider’s documentation for the model: does it list Structured Outputs as supported, and on which APIs? Note the answer with the date, because support changes as models are added.

Step 2: Send a test request

Send a test request with a small schema and read the reply. If the reply matches the schema and parses, support is confirmed; if the API rejects the request, the model does not support it.

Step 3: Fall back if needed

If the model does not support Structured Outputs, either switch to a model that does, or rewrite the code to use JSON mode with validation in code. Do not assume a JSON-mode reply follows the schema.

Worked example: Maple Corner bakery order extract

The fictional Maple Corner bakery tests 2 models for extracting order fields into JSON.

Model Structured Outputs listed Test reply Use it
Model A (newer) Yes Matches the schema Yes
Model B (older) No: JSON mode only Valid JSON, missing a field No: switch models

Model A returns JSON matching the schema, and model B returns valid JSON with a missing field, so the bakery uses model A for extraction.

Expected result. Support is confirmed by a test request, not assumed from the model name, and the fallback is decided before building. UNTESTED: this guide was not run against a live model or API. The worked example below is fictional practice material, and its result is the expected result, not a measured one.

Limits

  • Support can differ between the provider’s APIs; check the API you actually use.
  • A model that supports Structured Outputs today may be replaced; re-check when you change models.
  • This guide does not cover the supported JSON Schema subset.

Sources

See all