Skip to main content
Model Inference uses JSON Schema to define the structure of responses. This reference documents supported features and patterns.

Supported draft version

Model Inference validates output_format_schema against JSON Schema Draft 2019-09 on the server side after each inference call. Draft 2020-12 features commonly used for structured output definition are also supported.

Schema requirements

A few constraints apply to every output_format_schema:
  • The top-level schema must have type: "object".
  • For forced-tool-use models — currently Claude Sonnet 5.0 and Claude Opus 4.7 / 4.8 — the top-level object must set additionalProperties: false. The forced-tool path rejects a schema that omits it or sets it to true.
  • The server validates the model’s response against your schema; a violation fails the inference job with a typed error rather than returning invalid data.

Basic types

String

With constraints:

Number

With constraints:

Integer

Boolean

Null

Object type

Define structured objects with named properties:

Required properties

Use the required array to specify mandatory fields:

Additional properties

Control whether extra properties are allowed:

Array type

Simple arrays

Array constraints

Arrays of objects

Enum constraint

Restrict values to a predefined set:
Enum with numbers:

Numeric constraints

Example:

String constraints

Example:

Array constraints

Example:

Descriptions

Add descriptions to help the model understand field purpose:

Nested structures

Nested objects

Common patterns

Classification result

Entity extraction

Summary with key points

CRON expression result

TypeScript mapping

Using Structured Output

Practical guide to schema definition

Model Inference API

Complete API reference

Structured Output Concepts

Why structured output matters

Running Inference

Submit inference requests