ResponseParams

Everything about a Responses API call except the conversation itself.

The Responses API is stateless, so the same parameters are reused turn after turn while only the input grows:

val params = responseParams { instructions = "You are a helpful assistant." }
val history = mutableListOf<ResponseItem>(MessageItem(ResponseRole.USER, "Hi"))
val first = client.createResponse(params, history)
history += first.output

Every constraint the API documents is checked on construction, so an invalid combination fails here rather than as a 400 from the server.

See also

Types

Link copied to clipboard
class Builder

Builder for creating ResponseParams with standard (non-streaming) configuration.

Link copied to clipboard

Builder for creating ResponseParams configured for streaming responses.

Properties

Link copied to clipboard

System-level instruction, inserted as the first system message of the model's context. Either this or an input is required.

Link copied to clipboard

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

Link copied to clipboard

The DeepSeek model to use; defaults to ChatModel.DEEPSEEK_FLASH.

Link copied to clipboard

Thinking-mode configuration; see ReasoningConfig.

Link copied to clipboard

Whether the response is streamed as semantic server-sent events.

Link copied to clipboard

Sampling temperature between 0.0 and 2.0; 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; 0 to 20.

Link copied to clipboard
val topP: Double?

Nucleus sampling mass between 0.0 and 1.0; has no effect in thinking mode.

Link copied to clipboard
val user: String?

Custom identifier of the end user behind the request; 1 to 512 characters from [a-zA-Z0-9\-_]. Must not carry personal data. The chat endpoint spells the same field user_id.

Functions

Link copied to clipboard
fun copy(model: ChatModel = this.model, instructions: String? = this.instructions, reasoning: ReasoningConfig? = this.reasoning, maxOutputTokens: Int? = this.maxOutputTokens, stream: Boolean? = this.stream, temperature: Double? = this.temperature, topP: Double? = this.topP, text: TextConfig? = this.text, tools: List<ResponseTool>? = this.tools, toolChoice: ResponseToolChoice? = this.toolChoice, topLogprobs: Int? = this.topLogprobs, user: String? = this.user): ResponseParams

Creates a copy of these parameters with optional changes to specific properties.

Link copied to clipboard

Creates a ResponseRequest with no input, driven by instructions alone.

Creates a ResponseRequest carrying a single user message.

Creates a ResponseRequest carrying a conversation.

Creates a ResponseRequest from an already-shaped input.

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