Structured outputs
Structured outputs guarantee that the model response conforms to a JSON schema you define. Use this for typed API responses, database records, configuration objects or any case where free text is not acceptable.JSON mode
Setresponse_format: {type: "json_object"} to receive valid JSON.
JSON schema
For stricter validation, supply a JSON schema usingjson_schema mode:
Anthropic format
Structured outputs work in the Messages API using the sameresponse_format parameter.