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
| Field | Type | Required | Description |
|---|---|---|---|
background | boolean, null | No | Whether to run the model response in the background. |
include | string[] | No | An 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. |
model | string | Yes | The name of the model to use for generating responses |
input | string, string[] | Yes | The input to use for generating responses, it can be a single string or an array of strings |
instructions | string | No | Optional instructions to guide the model's response generation, providing specific directives or constraints for the output. |
stream | boolean, null | No | Whether to stream the response back as it's generated (default: false) |
max_output_tokens | integer, null | No | The maximum number of tokens to generate in the response |
max_tool_calls | integer, null | No | The maximum number of tool calls allowed during response generation, helping to control the extent of external tool usage. |
temperature | number, null | No | The sampling temperature to use when generating response |
top_p | number, null | No | The nucleus sampling probability to use when generating response, helping balance randomness and coherence in the generated response. |
text | object | No | Configuration options for text output, including plain text and structured JSON output through text.format. |
parallel_tool_calls | boolean, null | No | Whether to allow parallel tool calls during response generation, enabling multiple tools to be called simultaneously for more efficient processing. |
previous_response_id | string, null | No | The 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. |
metadata | object | No | An 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. |
reasoning | object | No | An object containing configuration for the reasoning model, which can be used to enable or customize the reasoning capabilities of the model during response generation. |
store | boolean, null | No | Whether to store the generated response in the system for future reference or analysis (default: false) |
tool_choice | string, null | No | The strategy to use when the model needs to choose between multiple tools during response generation, such as auto, none, or required. |
tools | array, null | No | An 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. |
truncation | string, null | No | The 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:
| Field | Type | Required | Description |
|---|---|---|---|
type | string | Yes | The type of the tool. Currently, function is supported. |
name | string | Yes | The function name that the model can call. |
description | string, null | No | A description of what the function does, used by the model to decide when and how to call it. |
parameters | object | Yes | A JSON Schema object that defines the function arguments. |
strict | boolean, null | No | Whether 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
| Field | Type | Required | Description |
|---|---|---|---|
effort | string | No | The reasoning effort to use for reasoning-capable models, such as minimal, low, medium, or high. |
summary | string, null | No | Controls whether reasoning summaries are generated when supported by the selected model. |
Text Configuration
The text object configures the text output format and verbosity.
| Field | Type | Required | Description |
|---|---|---|---|
format | object | No | The response format. The default is { "type": "text" }. Use { "type": "json_schema" } for structured outputs, or { "type": "json_object" } for JSON mode. |
verbosity | string, null | No | Controls output verbosity. Supported values are low, medium, and high. |
The format object should have the following structure:
| Field | Type | Required | Description |
|---|---|---|---|
type | string | Yes | The format type. Supported values are text, json_object, and json_schema. |
name | string | No | The name of the JSON Schema response format. Required when type is json_schema. |
description | string | No | A description of the response format, used by the model to determine how to respond. |
schema | object | No | The JSON Schema object that the model output must follow. Required when type is json_schema. |
strict | boolean, null | No | Whether to enable strict schema adherence when generating structured output. |
Include Configuration
The include array controls optional fields returned in the response. Common values include:
| Value | Description |
|---|---|
file_search_call.results | Include file search results. |
message.output_text.logprobs | Include log probabilities for output text. |
web_search_call.action.sources | Include sources from web search tool calls. |
reasoning.encrypted_content | Include 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
| Field | Type | Description |
|---|---|---|
id | string | The unique identifier for the response |
object | string | The type of object returned, which is response for this endpoint |
created_at | integer | The timestamp (in seconds since the Unix epoch) when the response was created |
status | string | The status of the response, such as completed, in_progress, failed, or incomplete |
completed_at | integer, null | The timestamp (in seconds since the Unix epoch) when the response completed, if available. |
model | string | The name of the model used to generate the response |
output | array | An array of output items generated by the model, such as messages, reasoning items, and tool calls. |
output_text | string | SDK-only convenience field containing aggregated generated text when available. It is not included in the raw REST response body. |
error | object, null | Error details if the response failed. |
incomplete_details | object, null | Details explaining why the response is incomplete, if applicable. |
instructions | string, null | The instructions used for this response. |
max_output_tokens | integer, null | The maximum number of output tokens configured for the response. |
max_tool_calls | integer, null | The maximum number of tool calls configured for the response. |
parallel_tool_calls | boolean | Whether parallel tool calls were enabled for the response. |
previous_response_id | string, null | The previous response ID used as context, if provided. |
reasoning | object | The reasoning configuration used for the response. |
store | boolean | Whether the response was stored. |
temperature | number, null | The sampling temperature used for generation. |
text | object | The text configuration used for generation. |
tool_choice | string, object | The tool selection strategy used for generation. |
tools | array | The tool definitions available to the model. |
top_p | number, null | The nucleus sampling probability used for generation. |
truncation | string, null | The truncation strategy used for the response. |
usage | object | Token usage for the request and response. |
metadata | object | Additional metadata associated with the response. |