Skip to main content
Chat Completions API exposes structured outputs through response_format. Use this API when you need the OpenAI chat protocol rather than the newer Responses shape. Use json_schema when the output must match a known shape. Use json_object when valid JSON is enough.

Request

Wire Response Shape

Raw HTTP responses keep the result in choices[0].message.content as JSON text.

JSON Mode

If you only need valid JSON and not a full schema, use:

Which mode should you use?

Common mistakes

  • expecting a native JSON object instead of parsing choices[0].message.content
  • choosing Chat Completions for new work when Responses structured outputs would be the cleaner default
  • using an open schema when downstream code expects strict shape guarantees