---
title: "AssistantsApiResponseFormatOption"
url: "https://kongair.terwilligar.com/apis/openai-api-2-3-0/versions/ea92d048-c746-4ead-a6a8-da28d93137d1/schemas/AssistantsApiResponseFormatOption"
---

> Full API specification: https://kongair.terwilligar.com/apis/openai-api-2-3-0/versions/ea92d048-c746-4ead-a6a8-da28d93137d1.md

# AssistantsApiResponseFormatOption

Specifies the format that the model must output. Compatible with [GPT-4o](/docs/models#gpt-4o), [GPT-4 Turbo](/docs/models#gpt-4-turbo-and-gpt-4), and all GPT-3.5 Turbo models since `gpt-3.5-turbo-1106`. Setting to `{ "type": "json_schema", "json_schema": {...} }` enables Structured Outputs which ensures the model will match your supplied JSON schema. Learn more in the [Structured Outputs guide](/docs/guides/structured-outputs). Setting to `{ "type": "json_object" }` enables JSON mode, which ensures the message the model generates is valid JSON. **Important:** when using JSON mode, you **must** also instruct the model to produce JSON yourself via a system or user message. Without this, the model may generate an unending stream of whitespace until the generation reaches the token limit, resulting in a long-running and seemingly "stuck" request. Also note that the message content may be partially cut off if `finish_reason="length"`, which indicates the generation exceeded `max_tokens` or the conversation exceeded the max context length.

## OpenAPI definition

```yaml
openapi: 3.0.0
info:
  title: OpenAI API
  version: 2.3.0
servers:
  - url: https://api.openai.com/v1
components:
  schemas:
    ResponseFormatText:
      type: object
      properties:
        type:
          type: string
          description: "The type of response format being defined: `text`"
          enum:
            - text
          x-stainless-const: true
      required:
        - type
    ResponseFormatJsonObject:
      type: object
      properties:
        type:
          type: string
          description: "The type of response format being defined: `json_object`"
          enum:
            - json_object
          x-stainless-const: true
      required:
        - type
    ResponseFormatJsonSchema:
      type: object
      properties:
        type:
          type: string
          description: "The type of response format being defined: `json_schema`"
          enum:
            - json_schema
          x-stainless-const: true
        json_schema:
          type: object
          properties:
            description:
              type: string
              description: A description of what the response format is for, used by the model
                to determine how to respond in the format.
            name:
              type: string
              description: The name of the response format. Must be a-z, A-Z, 0-9, or contain
                underscores and dashes, with a maximum length of 64.
            schema:
              $ref: "#/components/schemas/ResponseFormatJsonSchemaSchema"
            strict:
              type: boolean
              nullable: true
              default: false
              description: Whether to enable strict schema adherence when generating the
                output. If set to true, the model will always follow the exact
                schema defined in the `schema` field. Only a subset of JSON
                Schema is supported when `strict` is `true`. To learn more, read
                the [Structured Outputs guide](/docs/guides/structured-outputs).
          required:
            - name
      required:
        - type
        - json_schema
    ResponseFormatJsonSchemaSchema:
      type: object
      description: The schema for the response format, described as a JSON Schema object.
      additionalProperties: true
    AssistantsApiResponseFormatOption:
      description: >
        Specifies the format that the model must output. Compatible with
        [GPT-4o](/docs/models#gpt-4o), [GPT-4
        Turbo](/docs/models#gpt-4-turbo-and-gpt-4), and all GPT-3.5 Turbo models
        since `gpt-3.5-turbo-1106`.


        Setting to `{ "type": "json_schema", "json_schema": {...} }` enables
        Structured Outputs which ensures the model will match your supplied JSON
        schema. Learn more in the [Structured Outputs
        guide](/docs/guides/structured-outputs).


        Setting to `{ "type": "json_object" }` enables JSON mode, which ensures
        the message the model generates is valid JSON.


        **Important:** when using JSON mode, you **must** also instruct the
        model to produce JSON yourself via a system or user message. Without
        this, the model may generate an unending stream of whitespace until the
        generation reaches the token limit, resulting in a long-running and
        seemingly "stuck" request. Also note that the message content may be
        partially cut off if `finish_reason="length"`, which indicates the
        generation exceeded `max_tokens` or the conversation exceeded the max
        context length.
      oneOf:
        - type: string
          description: |
            `auto` is the default value
          enum:
            - auto
          x-stainless-const: true
        - $ref: "#/components/schemas/ResponseFormatText"
        - $ref: "#/components/schemas/ResponseFormatJsonObject"
        - $ref: "#/components/schemas/ResponseFormatJsonSchema"
      x-oaiExpandable: true
```
