CrossModel

JSON & structured output

If your app needs to parse model output reliably, lean on structured output or tool calling rather than just asking for JSON in the prompt.

Chat Completions

Supported models can use response_format:

{
  "model": "openai/gpt-5-mini",
  "messages": [
    { "role": "user", "content": "Extract the name and company: Jane works at CrossModel." }
  ],
  "response_format": {
    "type": "json_object"
  }
}

Some models also support a stricter JSON Schema. Whether it takes effect depends on the model.

Responses

The Responses endpoint is well suited to organizing input and output as structured items. For complex structures, combine it with tools so the model returns function arguments, then validate the JSON Schema in your code.

Making it more reliable

  1. Give a short, explicit schema.
  2. Put required fields in the schema, not just in prose.
  3. Parse the JSON and validate the schema in your application code.
  4. On validation failure, feed the error back as the next turn so the model can correct itself.
  5. For high-value cases, carry the structured result in a tool call.

Providers vary in how well they support JSON mode, strict schemas, and tool arguments. Validate end-to-end on your target model before shipping.