OpenAI · Schema

CreateChatCompletionRequest

AIArtificial IntelligenceLarge Language ModelsT1

Properties

Name Type Description
model string ID of the model to use. See the model endpoint compatibility table for which models work with the Chat API.
messages array A list of messages comprising the conversation so far. Each message has a role (system, user, assistant, or tool) and content.
frequency_penalty number 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 An integer specifying the number of most likely tokens to return at each token position, each with an associated log probability. logprobs must be set to true if this parameter is used.
max_tokens integer The maximum number of tokens that can be generated in the chat completion. The total length of input tokens and generated tokens is limited by the model's context length.
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.
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 of the choices.
presence_penalty number 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 An object specifying the format that the model must output. Setting to json_object enables JSON mode. Setting to json_schema enables Structured Outputs with a supplied JSON schema.
seed integer If specified, the system will make a best effort to sample deterministically so 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. 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 make the output more random, lower values more focused and deterministic.
top_p number An alternative to sampling with temperature, called nucleus sampling. 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 mean
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.
View JSON Schema on GitHub