Skip to main content

Generate responses from a large language model based on a given input. The Responses API provides a unified interface for text generation, multi-turn continuation, tool calling, reasoning configuration, and optional streaming.

Authorization

The AccessToken must be included in the request as a header when making REST API requests, along with the Content-Type header. You can use the following format for authorization:

--header 'Authorization: Bearer <your_token_here>'
--header 'Content-Type: application/json'

Note: Replace your_token_here with your actual AccessToken. It contains information that allows the server to verify your identity and permissions. You can create your API key here.

Request Body

FieldTypeRequiredDescription
backgroundboolean, nullNoWhether to run the model response in the background.
includestring[]NoAn array of additional output data to include in the response, such as file_search_call.results, message.output_text.logprobs, web_search_call.action.sources, or reasoning.encrypted_content.
modelstringYesThe name of the model to use for generating responses
inputstring, string[]YesThe input to use for generating responses, it can be a single string or an array of strings
instructionsstringNoOptional instructions to guide the model's response generation, providing specific directives or constraints for the output.
streamboolean, nullNoWhether to stream the response back as it's generated (default: false)
max_output_tokensinteger, nullNoThe maximum number of tokens to generate in the response
max_tool_callsinteger, nullNoThe maximum number of tool calls allowed during response generation, helping to control the extent of external tool usage.
temperaturenumber, nullNoThe sampling temperature to use when generating response
top_pnumber, nullNoThe nucleus sampling probability to use when generating response, helping balance randomness and coherence in the generated response.
textobjectNoConfiguration options for text output, including plain text and structured JSON output through text.format.
parallel_tool_callsboolean, nullNoWhether to allow parallel tool calls during response generation, enabling multiple tools to be called simultaneously for more efficient processing.
previous_response_idstring, nullNoThe ID of a previous response to use as context for generating the new response, allowing for continued conversations or follow-up responses based on prior interactions.
metadataobjectNoAn object containing additional metadata to include in the request, which can be used for various purposes such as tracking, logging, or providing extra context for response generation.
reasoningobjectNoAn object containing configuration for the reasoning model, which can be used to enable or customize the reasoning capabilities of the model during response generation.
storeboolean, nullNoWhether to store the generated response in the system for future reference or analysis (default: false)
tool_choicestring, nullNoThe strategy to use when the model needs to choose between multiple tools during response generation, such as auto, none, or required.
toolsarray, nullNoAn array of tool definitions that the model can call during response generation, allowing for enhanced functionality and integration with external systems. Each tool definition includes the tool's name, description, parameters, and other relevant information to guide the model in using the tool effectively.
truncationstring, nullNoThe truncation strategy to use for the model response. Supported values are auto and disabled (default).

Tool Configuration

Currently, the API supports only function tools. Each object in the tools array should have the following structure:

FieldTypeRequiredDescription
typestringYesThe type of the tool. Currently, function is supported.
namestringYesThe function name that the model can call.
descriptionstring, nullNoA description of what the function does, used by the model to decide when and how to call it.
parametersobjectYesA JSON Schema object that defines the function arguments.
strictboolean, nullNoWhether the model should strictly follow the provided parameter schema when calling the function.

Example JSON Schema for parameters:

{
"type": "object",
"properties": {
"location": {
"type": "string",
"description": "The city and country, for example: Singapore, Singapore"
}
},
"required": ["location"],
"additionalProperties": false
}

Reasoning Configuration

FieldTypeRequiredDescription
effortstringNoThe reasoning effort to use for reasoning-capable models, such as minimal, low, medium, or high.
summarystring, nullNoControls whether reasoning summaries are generated when supported by the selected model.

Text Configuration

The text object configures the text output format and verbosity.

FieldTypeRequiredDescription
formatobjectNoThe response format. The default is { "type": "text" }. Use { "type": "json_schema" } for structured outputs, or { "type": "json_object" } for JSON mode.
verbositystring, nullNoControls output verbosity. Supported values are low, medium, and high.

The format object should have the following structure:

FieldTypeRequiredDescription
typestringYesThe format type. Supported values are text, json_object, and json_schema.
namestringNoThe name of the JSON Schema response format. Required when type is json_schema.
descriptionstringNoA description of the response format, used by the model to determine how to respond.
schemaobjectNoThe JSON Schema object that the model output must follow. Required when type is json_schema.
strictboolean, nullNoWhether to enable strict schema adherence when generating structured output.

Include Configuration

The include array controls optional fields returned in the response. Common values include:

ValueDescription
file_search_call.resultsInclude file search results.
message.output_text.logprobsInclude log probabilities for output text.
web_search_call.action.sourcesInclude sources from web search tool calls.
reasoning.encrypted_contentInclude encrypted reasoning content when supported.

Example Request

{
"model": "minimax/minimax-m2.5",
"input": "Explain the concept of a polymer in simple terms.",
"instructions": "Answer clearly and concisely.",
"stream": false,
"max_output_tokens": 100,
"temperature": 0.7,
"top_p": 0.9,
"text": {
"format": {
"type": "text"
}
},
"parallel_tool_calls": true,
"store": false,
"truncation": "disabled"
}

Response

Success Response

FieldTypeDescription
idstringThe unique identifier for the response
objectstringThe type of object returned, which is response for this endpoint
created_atintegerThe timestamp (in seconds since the Unix epoch) when the response was created
statusstringThe status of the response, such as completed, in_progress, failed, or incomplete
completed_atinteger, nullThe timestamp (in seconds since the Unix epoch) when the response completed, if available.
modelstringThe name of the model used to generate the response
outputarrayAn array of output items generated by the model, such as messages, reasoning items, and tool calls.
output_textstringSDK-only convenience field containing aggregated generated text when available. It is not included in the raw REST response body.
errorobject, nullError details if the response failed.
incomplete_detailsobject, nullDetails explaining why the response is incomplete, if applicable.
instructionsstring, nullThe instructions used for this response.
max_output_tokensinteger, nullThe maximum number of output tokens configured for the response.
max_tool_callsinteger, nullThe maximum number of tool calls configured for the response.
parallel_tool_callsbooleanWhether parallel tool calls were enabled for the response.
previous_response_idstring, nullThe previous response ID used as context, if provided.
reasoningobjectThe reasoning configuration used for the response.
storebooleanWhether the response was stored.
temperaturenumber, nullThe sampling temperature used for generation.
textobjectThe text configuration used for generation.
tool_choicestring, objectThe tool selection strategy used for generation.
toolsarrayThe tool definitions available to the model.
top_pnumber, nullThe nucleus sampling probability used for generation.
truncationstring, nullThe truncation strategy used for the response.
usageobjectToken usage for the request and response.
metadataobjectAdditional metadata associated with the response.