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.
View JSON Schema on GitHub