ChatGPT · Schema

CreateChatCompletionRequest

AgentsAIChatGPTEmbeddingsFine-TuningGPT-4GPT-5Language ModelOpenAIRealtime

Properties

Name Type Description
model string ID of the model to use. See the model endpoint compatibility table for details on which models work with the Chat Completions API.
messages array A list of messages comprising the conversation so far. Depending on the model, different message types (modalities) are supported, like text, images, and audio.
frequency_penalty number Number between -2.0 and 2.0. Positive values penalize new tokens based on their existing frequency in the text so far, decreasing the model's likelihood to repeat the same line verbatim.
logit_bias object Modify the likelihood of specified tokens appearing in the completion. Maps token IDs to bias values from -100 to 100.
logprobs boolean Whether to return log probabilities of the output tokens.
top_logprobs integer Number of most likely tokens to return at each position, each with an associated log probability. logprobs must be set to true if this parameter is used.
max_completion_tokens integer An upper bound for the number of tokens that can be generated for a completion, including visible output tokens and reasoning tokens. Replaces the deprecated max_tokens parameter.
n integer How many chat completion choices to generate for each input message. Note that you will be charged based on the number of generated tokens across all choices.
presence_penalty number Number between -2.0 and 2.0. Positive values penalize new tokens based on whether they appear in the text so far, increasing the model's likelihood to talk about new topics.
response_format object
seed integer If specified, the system will make a best effort to sample deterministically, such that repeated requests with the same seed and parameters should return the same result.
stop object Up to 4 sequences where the API will stop generating further tokens.
stream boolean If set, partial message deltas will be sent as server-sent events as they become available. The stream is terminated by a data: [DONE] message.
stream_options object Options for streaming responses.
temperature number What sampling temperature to use, between 0 and 2. Higher values like 0.8 will make the output more random, while lower values like 0.2 will make it more focused and deterministic.
top_p number An alternative to sampling with temperature, called nucleus sampling, where the model considers the results of the tokens with top_p probability mass.
tools array A list of tools the model may call. Currently, only functions are supported as a tool. Use this to provide a list of functions the model may generate JSON inputs for.
tool_choice object Controls which (if any) tool is called by the model. "none" means the model will not call any tool. "auto" means the model can pick between generating a message or calling one or more tools. "required
parallel_tool_calls boolean Whether to enable parallel function calling during tool use.
user string A unique identifier representing your end-user, which can help OpenAI to monitor and detect abuse.
store boolean Whether or not to store the output of this chat completion request for use in the model distillation or evals products.
metadata object Set of 16 key-value pairs that can be attached to an object. Useful for storing additional information in a structured format.
View JSON Schema on GitHub

JSON Schema

chatgpt-createchatcompletionrequest-schema.json Raw ↑
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "#/components/schemas/CreateChatCompletionRequest",
  "title": "CreateChatCompletionRequest",
  "type": "object",
  "required": [
    "model",
    "messages"
  ],
  "properties": {
    "model": {
      "type": "string",
      "description": "ID of the model to use. See the model endpoint compatibility\ntable for details on which models work with the Chat Completions API.\n",
      "examples": [
        "gpt-4o",
        "gpt-4o-mini",
        "gpt-4-turbo",
        "gpt-4",
        "gpt-3.5-turbo",
        "o1",
        "o1-mini",
        "o3-mini"
      ]
    },
    "messages": {
      "type": "array",
      "description": "A list of messages comprising the conversation so far.\nDepending on the model, different message types (modalities)\nare supported, like text, images, and audio.\n",
      "minItems": 1,
      "items": {
        "$ref": "#/components/schemas/ChatCompletionMessage"
      },
      "example": []
    },
    "frequency_penalty": {
      "type": "number",
      "description": "Number between -2.0 and 2.0. Positive values penalize new tokens\nbased on their existing frequency in the text so far, decreasing\nthe model's likelihood to repeat the same line verbatim.\n",
      "minimum": -2.0,
      "maximum": 2.0,
      "default": 0,
      "example": 42.5
    },
    "logit_bias": {
      "type": "object",
      "description": "Modify the likelihood of specified tokens appearing in the\ncompletion. Maps token IDs to bias values from -100 to 100.\n",
      "additionalProperties": {
        "type": "integer",
        "minimum": -100,
        "maximum": 100
      },
      "nullable": true,
      "default": null,
      "example": "example_value"
    },
    "logprobs": {
      "type": "boolean",
      "description": "Whether to return log probabilities of the output tokens.\n",
      "nullable": true,
      "default": false,
      "example": true
    },
    "top_logprobs": {
      "type": "integer",
      "description": "Number of most likely tokens to return at each position,\neach with an associated log probability. logprobs must be\nset to true if this parameter is used.\n",
      "minimum": 0,
      "maximum": 20,
      "nullable": true,
      "example": 10
    },
    "max_completion_tokens": {
      "type": "integer",
      "description": "An upper bound for the number of tokens that can be generated\nfor a completion, including visible output tokens and reasoning\ntokens. Replaces the deprecated max_tokens parameter.\n",
      "nullable": true,
      "example": 10
    },
    "n": {
      "type": "integer",
      "description": "How many chat completion choices to generate for each input\nmessage. Note that you will be charged based on the number\nof generated tokens across all choices.\n",
      "minimum": 1,
      "maximum": 128,
      "default": 1,
      "example": 10
    },
    "presence_penalty": {
      "type": "number",
      "description": "Number between -2.0 and 2.0. Positive values penalize new tokens\nbased on whether they appear in the text so far, increasing the\nmodel's likelihood to talk about new topics.\n",
      "minimum": -2.0,
      "maximum": 2.0,
      "default": 0,
      "example": 42.5
    },
    "response_format": {
      "$ref": "#/components/schemas/ResponseFormat"
    },
    "seed": {
      "type": "integer",
      "description": "If specified, the system will make a best effort to sample\ndeterministically, such that repeated requests with the same\nseed and parameters should return the same result.\n",
      "nullable": true,
      "example": 10
    },
    "stop": {
      "description": "Up to 4 sequences where the API will stop generating further\ntokens.\n",
      "oneOf": [
        {
          "type": "string",
          "nullable": true
        },
        {
          "type": "array",
          "items": {
            "type": "string"
          },
          "minItems": 1,
          "maxItems": 4
        }
      ],
      "default": null,
      "example": "example_value"
    },
    "stream": {
      "type": "boolean",
      "description": "If set, partial message deltas will be sent as server-sent\nevents as they become available. The stream is terminated by\na data: [DONE] message.\n",
      "nullable": true,
      "default": false,
      "example": true
    },
    "stream_options": {
      "type": "object",
      "description": "Options for streaming responses.",
      "nullable": true,
      "properties": {
        "include_usage": {
          "type": "boolean",
          "description": "If set, an additional chunk will be streamed before the\ndata: [DONE] message containing the token usage statistics.\n"
        }
      },
      "example": "example_value"
    },
    "temperature": {
      "type": "number",
      "description": "What sampling temperature to use, between 0 and 2. Higher\nvalues like 0.8 will make the output more random, while\nlower values like 0.2 will make it more focused and deterministic.\n",
      "minimum": 0,
      "maximum": 2,
      "default": 1,
      "example": 42.5
    },
    "top_p": {
      "type": "number",
      "description": "An alternative to sampling with temperature, called nucleus\nsampling, where the model considers the results of the tokens\nwith top_p probability mass.\n",
      "minimum": 0,
      "maximum": 1,
      "default": 1,
      "example": 42.5
    },
    "tools": {
      "type": "array",
      "description": "A list of tools the model may call. Currently, only functions\nare supported as a tool. Use this to provide a list of functions\nthe model may generate JSON inputs for.\n",
      "items": {
        "$ref": "#/components/schemas/ChatCompletionTool"
      },
      "example": []
    },
    "tool_choice": {
      "description": "Controls which (if any) tool is called by the model. \"none\"\nmeans the model will not call any tool. \"auto\" means the\nmodel can pick between generating a message or calling one\nor more tools. \"required\" means the model must call one or\nmore tools.\n",
      "oneOf": [
        {
          "type": "string",
          "enum": [
            "none",
            "auto",
            "required"
          ]
        },
        {
          "$ref": "#/components/schemas/ChatCompletionNamedToolChoice"
        }
      ],
      "example": "example_value"
    },
    "parallel_tool_calls": {
      "type": "boolean",
      "description": "Whether to enable parallel function calling during tool use.\n",
      "default": true,
      "example": true
    },
    "user": {
      "type": "string",
      "description": "A unique identifier representing your end-user, which can\nhelp OpenAI to monitor and detect abuse.\n",
      "example": "example_value"
    },
    "store": {
      "type": "boolean",
      "description": "Whether or not to store the output of this chat completion\nrequest for use in the model distillation or evals products.\n",
      "nullable": true,
      "default": false,
      "example": true
    },
    "metadata": {
      "type": "object",
      "description": "Set of 16 key-value pairs that can be attached to an object.\nUseful for storing additional information in a structured format.\n",
      "nullable": true,
      "additionalProperties": {
        "type": "string"
      },
      "maxProperties": 16,
      "example": "example_value"
    }
  }
}