ResponseRequest

@Serializable
class ResponseRequest(val model: ChatModel, val input: ResponseInput? = null, val instructions: String? = null, val reasoning: ReasoningConfig? = null, val maxOutputTokens: Int? = null, val stream: Boolean? = null, val temperature: Double? = null, val topP: Double? = null, val text: TextConfig? = null, val tools: List<ResponseTool>? = null, val toolChoice: ResponseToolChoice? = null, val topLogprobs: Int? = null, val user: String? = null)

A request to the Responses API.

The conversation travels in input, either as one user message (ResponseInput.Text) or as a list of items (ResponseInput.Items) — the API is stateless, so the list carries the whole history every turn. At least one of input and instructions must be present.

Build one through ResponseParams.createRequest or the createResponse { } DSL rather than by hand when more than the input varies.

See also

Constructors

Link copied to clipboard
constructor(model: ChatModel, input: ResponseInput? = null, instructions: String? = null, reasoning: ReasoningConfig? = null, maxOutputTokens: Int? = null, stream: Boolean? = null, temperature: Double? = null, topP: Double? = null, text: TextConfig? = null, tools: List<ResponseTool>? = null, toolChoice: ResponseToolChoice? = null, topLogprobs: Int? = null, user: String? = null)
constructor(model: ChatModel, input: String, instructions: String? = null, reasoning: ReasoningConfig? = null, maxOutputTokens: Int? = null, stream: Boolean? = null, temperature: Double? = null, topP: Double? = null, text: TextConfig? = null, tools: List<ResponseTool>? = null, toolChoice: ResponseToolChoice? = null, topLogprobs: Int? = null, user: String? = null)

Creates a request whose input is a single user message.

constructor(model: ChatModel, input: List<ResponseItem>, instructions: String? = null, reasoning: ReasoningConfig? = null, maxOutputTokens: Int? = null, stream: Boolean? = null, temperature: Double? = null, topP: Double? = null, text: TextConfig? = null, tools: List<ResponseTool>? = null, toolChoice: ResponseToolChoice? = null, topLogprobs: Int? = null, user: String? = null)

Creates a request whose input is a list of conversation items.

Types

Link copied to clipboard
class Builder

Builder for non-streaming Responses API requests.

Link copied to clipboard

DSL for building the multimodal content of a single message or tool output.

Link copied to clipboard

DSL for building the input of a Responses API call.

Link copied to clipboard

Builder for streaming Responses API requests.

Properties

Link copied to clipboard

The conversation, as one user message or as a list of items; null when the request is driven by instructions alone.

Link copied to clipboard

System-level instruction, inserted as the first system message of the model's context.

Link copied to clipboard

Ceiling on the tokens generated for the response, counting both the visible answer and the reasoning.

Link copied to clipboard

ID of the model to use.

Link copied to clipboard

Thinking-mode configuration; see ReasoningConfig.

Link copied to clipboard

If set, the response is streamed as semantic server-sent events, ending with response.completed / response.incomplete / response.failed — there is no [DONE] marker.

Link copied to clipboard

Sampling temperature between 0 and 2; has no effect in thinking mode.

Link copied to clipboard

Shape of the answer, including JSON-Schema-constrained output; see TextConfig.

Link copied to clipboard

Which tool, if any, the model must call.

Link copied to clipboard

Tools the model may use — functions, and the server-side web search.

Link copied to clipboard

How many most likely tokens to report at each position.

Link copied to clipboard
val topP: Double?

Nucleus sampling mass, at most 1; has no effect in thinking mode.

Link copied to clipboard
val user: String?

Custom identifier of the end user behind the request, used for content safety review, KVCache isolation, scheduling isolation and privacy management. Must not carry personal data.

Functions

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean
Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard
open override fun toString(): String