OpenAIChatCompletionRequestBuilder
DSL builder for OpenAIChatCompletionRequest.
The model are required; every other setting is optional and defaults to null (omitted from the JSON payload), except tools which defaults to an empty list.
See also
Samples
return openAIChatCompletionRequest(model = "gpt-5.6-sol") {
messages {
system("You are a helpful assistant.")
user("What's the weather like in London?")
}
}Properties
Audio output parameters for audio generation. null disables audio output.
Number of chat completion choices to generate for each input message.
Penalty for token frequency (-2.0 to 2.0).
Upper bound for tokens generated in a completion.
Maximum number of tokens that can be generated. Deprecated in favor of maxCompletionTokens.
Set of up to 16 key-value pairs attached to the request object.
Output modalities to generate. Defaults to [text], plus [audio] when audio is set.
Whether to enable parallel function calling during tool use.
Penalty for token presence (-2.0 to 2.0).
Reasoning effort level. null uses provider default.
An object specifying the format that the model must output.
A stable identifier for users of your application. Max 64 characters.
Specifies the processing type used for serving the request.
Sequences where the API stops generating further tokens.
Options for streaming responses. Only set this for streaming requests.
Sampling temperature (0.0–2.0).
Controls which (if any) tool is called by the model.
Maximum number of most likely tokens to return at each position (0–20).
Constrains the verbosity of the model's response.
Functions
Appends a single message parameter to the request.
Appends multiple message parameters using a builder DSL.
Appends multiple message parameters to the request.
Appends a single tool definition to the request.
Appends multiple tool definitions to the request.