Skip to contentOceanToken

Glossary term

What is Structured output?

Making a model reply in JSON that matches a schema you give.

Definition

Structured output makes a model reply with JSON that follows a schema you supply, with the fields, types and required keys you named, instead of free text. The model's output is constrained to that format, so your code can parse the reply without guessing or cleaning it up.

Why it matters

Extracting data, filling forms and feeding one step's output into the next all break when the reply is not valid JSON. Structured output removes that whole class of errors.

How it works on OceanToken

On OceanToken, send response_format in the OpenAI format on models that support it; on models that don't, it is dropped and the model answers in prose, so check the answer. See text generation in the docs for examples.