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. |
| 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 | string | 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 | string | 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. |
JSON Schema
{
"$schema": "https://json-schema.org/draft/2020-12/schema",
"title": "CreateChatCompletionRequest",
"type": "object",
"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"
},
"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"
},
"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"
},
"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"
},
"logprobs": {
"type": "boolean",
"description": "Whether to return log probabilities of the output tokens.\n"
},
"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"
},
"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"
},
"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"
},
"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"
},
"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"
},
"stop": {
"type": "string",
"description": "Up to 4 sequences where the API will stop generating further\ntokens.\n"
},
"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"
},
"stream_options": {
"type": "object",
"description": "Options for streaming responses."
},
"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"
},
"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"
},
"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"
},
"tool_choice": {
"type": "string",
"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"
},
"parallel_tool_calls": {
"type": "boolean",
"description": "Whether to enable parallel function calling during tool use.\n"
},
"user": {
"type": "string",
"description": "A unique identifier representing your end-user, which can\nhelp OpenAI to monitor and detect abuse.\n"
},
"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"
},
"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"
}
}
}