Skip to main content
Pass a JSON Schema in text.format to constrain the model’s output to a specific structure. The schema definition matches Chat Completions; the parameter path differs.

Prerequisites

  • An Auriko API key
  • Python 3.10+ with the OpenAI SDK (pip install openai) or the Auriko SDK (pip install auriko)
    • OR Node.js 18+ with the OpenAI SDK (npm install openai) or @auriko/sdk (npm install @auriko/sdk)

Return JSON

Constrain the output to valid JSON:
Include the word “JSON” in your prompt or instructions. Some models return non-JSON output without it, matching the Chat Completions json_object constraint.

Enforce schema

Constrain the output to a specific JSON Schema:

Map parameters

Chat CompletionsResponse API
response_format: {type: "json_object"}text: {format: {type: "json_object"}}
response_format: {type: "json_schema", json_schema: {name, schema}}text: {format: {type: "json_schema", name, schema}}
In Chat Completions, the schema lives under json_schema.schema. In the Response API, it’s under format.schema (one less level of nesting). See Structured Output guide for model support and strict parameter behavior.