Create a response

Create a model response using the OpenAI Responses API shape. Use this endpoint when you want input items, function-call output items, [server-side tools](/server-side-tools), structured text output, response storage, or Responses-style streaming events. Set `stream` to true to receive typed server-sent events; the stream ends with `data: [DONE]`.

Authentication

AuthorizationBearer
Mixlayer API key or console user session supplied as a Bearer token.

Request

Response generation parameters
inputstring or list of objectsRequired
Text prompt or Responses input items.
modelstringRequired
Model identifier.
frequency_penaltyfloat or nullOptional
Penalizes tokens based on their frequency in the generated text.
includelist of enums or nullOptional
Additional response fields to include.
instructionsstring or nullOptional
System or developer instructions prepended to the request.
max_output_tokensinteger or nullOptional>=0
Maximum generated output tokens.
max_tool_callsinteger or nullOptional>=0
Maximum tool calls is not currently supported.
metadataanyOptional

Metadata stored with the response when store is true.

parallel_tool_callsboolean or nullOptionalDefaults to true

Whether tool calls may run in parallel. Only true is supported.

presence_penaltyfloat or nullOptional
Penalizes tokens that have already appeared in the generated text.
previous_response_idstring or nullOptional
Stored response to continue from.
prompt_cache_keystring or nullOptional

Prompt-cache key echoed on the response object.

reasoningobject or nullOptional
repetition_penaltyfloat or nullOptional
Multiplicative repetition penalty.
safety_identifierstring or nullOptional

End-user or session identifier echoed on the response object.

service_tierenum or nullOptionalDefaults to default
Service tier returned by the Responses API.
storeboolean or nullOptionalDefaults to false

Store the response for later use with previous_response_id.

streambooleanOptionalDefaults to false

If true, return Responses Server-Sent Events. Defaults to false.

stream_optionsobject or nullOptional
temperaturefloat or nullOptional
Sampling temperature. Higher values make output more random.
textobject or nullOptional
tool_choiceenum or object or nullOptional
toolslist of objects or nullOptional

Function and hosted web-search tools available to the model.

top_kinteger or nullOptional

Restricts sampling to the highest-probability tokens.

top_logprobsinteger or nullOptional>=0Defaults to 0
Log probabilities are not supported and must be zero.
top_pfloat or nullOptional
Nucleus sampling probability mass.
truncationenum or nullOptionalDefaults to disabled
Truncation policy returned by the Responses API.
backgroundboolean or nullOptionalDefaults to false
Background processing is not supported and must be false.

Response

A complete response or a stream of typed response events, selected by the request’s stream field

backgroundboolean

Whether background processing was requested, always false.

created_atlong>=0
Unix timestamp when the response was created.
frequency_penaltyfloat
Frequency penalty used for generation.
idstring
Unique response identifier.
metadataany
Metadata stored with the response.
modelstring
Model used to generate the response.
objectenum

Object type, always response.

outputlist of objects

Generated message, reasoning, and function-call items.

output_textstring
Concatenated text from output message content.
parallel_tool_callsboolean
Whether tool calls may run in parallel.
presence_penaltyfloat
Presence penalty used for generation.
reasoningobject
Reasoning configuration used for generation.
service_tierenum

Processing tier, always default.

statusenum

Response status: in_progress, completed, or incomplete.

storeboolean
Whether the response was stored for later continuation.
textobject
Text output configuration.
tool_choiceany
Tool selection policy used for the response.
toolslist of objects
Function tools available to the model.
top_logprobsinteger>=0
Number of top log probabilities requested, always zero.
top_pfloat
Nucleus sampling value.
truncationenum

Input truncation policy, always disabled.

completed_atlong or nullOptional>=0
Unix timestamp when the response completed.
erroranyOptional

Response-level error details, when generation fails.

incomplete_detailsanyOptional
Details explaining why a response is incomplete, when applicable.
instructionsstring or nullOptional
System or developer instructions prepended to the request.
max_output_tokensinteger or nullOptional>=0
Maximum generated output tokens.
max_tool_callsinteger or nullOptional>=0
Maximum tool calls, when configured.
previous_response_idstring or nullOptional
Stored response this response continues from.
prompt_cache_keystring or nullOptional

Prompt-cache key supplied with the request.

safety_identifierstring or nullOptional

End-user or session identifier supplied with the request.

temperaturefloat or nullOptional
Sampling temperature used for generation.
usageobject or nullOptional

Errors

400
Bad Request Error
401
Unauthorized Error
402
Payment Required Error
403
Forbidden Error
429
Too Many Requests Error
500
Internal Server Error