Format run structured output: output_schema or response_format

Pass one JSON Schema as output_schema or response_format on a Format run. Sending both is a 400, and a schema-valid run can still fail with output_error.

4 min readSume
All posts

A Format run takes a structured-output schema under one of two names, output_schema or response_format, and sending both in the same request is a 400. Pick one name and use it everywhere in your client.

The receipt echoes the schema back as output_schema, with the result in output and any problem in output_error.

What each field does

From the Create a run and Runs and results pages (read 2026-10-03).

Structured output fields on a Format run (read 2026-10-03)
FieldWhereMeaning
output_schemaRequestJSON Schema for the result
response_formatRequestThe other spelling; do not send both
output_schemaReceiptThe schema the run used
outputReceiptThe structured result
output_errorReceiptWhy the output is missing or invalid
primary_output_key, primary_output_urlReceiptThe main media output

A request that validates first

Check the body locally for the mutual exclusion, which is cheaper than a round trip.

import json

def check(body):
    if "output_schema" in body and "response_format" in body:
        raise ValueError("send output_schema or response_format, not both")
    return body

schema = {"type": "object", "properties": {"title": {"type": "string"}},
          "required": ["title"]}
body = check({"instruction": "Name this clip", "output_schema": schema})
print(json.dumps(body))

Valid is not complete

A run can produce schema-valid output and still be failed when the primary media output is missing, so read output_error as well as output. See that failure shape before treating a valid object as success.

Sources

Related posts

More in Formats

All Formats posts

Written by Sume