Skip to main content
Use response_format when your application needs machine-readable output. Prism supports JSON mode and JSON Schema on POST /v1/chat/completions.

JSON mode

JSON mode guarantees valid JSON but does not enforce a specific shape.
Tell the model to return JSON in the prompt. Without that instruction, the model may spend the token budget generating whitespace.

JSON Schema

Use strict JSON Schema when downstream code requires known fields:
Example content:

Validate in your application

Schema-constrained generation reduces invalid responses, but it does not replace application validation or authorization.
Keep schemas small and explicit. Deep nesting, large enums, and ambiguous field descriptions make the model’s job harder.
Tool schemas and response schemas solve different problems. A tool schema constrains a function call. response_format constrains the assistant’s final response.
Last modified on September 9, 2026