Skip to main content
POST
/
v1
/
responses
/
input_tokens
Estimate Input Tokens
curl --request POST \
  --url https://api.minimax.io/v1/responses/input_tokens \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: <content-type>' \
  --data '
{
  "model": "MiniMax-M3",
  "input": [
    {
      "type": "message",
      "role": "user",
      "content": "Please implement a generic quicksort algorithm in Python with these requirements: 1) in-place sorting to save memory; 2) three-way partitioning to handle duplicate elements; 3) switch to insertion sort for small subarrays; 4) include complete unit tests. Finally, explain the advantage of three-way partitioning over the classic Lomuto scheme when keys repeat."
    }
  ],
  "tools": [
    {
      "type": "function",
      "name": "search_docs",
      "description": "Search the official documentation of the Python standard library or a third-party package",
      "parameters": {
        "type": "object",
        "properties": {
          "library": {
            "type": "string",
            "description": "Library name, e.g. `typing`, `itertools`"
          },
          "query": {
            "type": "string",
            "description": "Search keywords"
          }
        },
        "required": [
          "library",
          "query"
        ]
      }
    },
    {
      "type": "function",
      "name": "run_python",
      "description": "Execute Python code in a sandbox and return stdout / error",
      "parameters": {
        "type": "object",
        "properties": {
          "code": {
            "type": "string",
            "description": "Python code to execute"
          },
          "timeout_seconds": {
            "type": "integer",
            "description": "Execution timeout in seconds",
            "default": 10
          }
        },
        "required": [
          "code"
        ]
      }
    }
  ]
}
'
{
  "object": "response.input_tokens",
  "input_tokens": 588
}

Authorizations

Authorization
string
header
required

HTTP: Bearer Auth

  • Security Scheme Type: http
  • HTTP Authorization Scheme: Bearer API_key, used to authenticate your account. View it in Account Management > API Keys

Headers

Content-Type
enum<string>
default:application/json
required

Media type of the request body. Must be set to application/json

Available options:
application/json

Body

application/json
model
string
required

Model name to invoke, e.g. MiniMax-M3

Example:

"MiniMax-M3"

input
required

Conversation content. Supports either a simple text or a full conversation history array

instructions
string

System instructions

tools
object[]

Tool list

tool_choice
enum<string>

Tool selection strategy: none means no tool will be called; auto lets the model decide whether to call tools

Available options:
none,
auto
text
object

Output format control

reasoning
object

Reasoning control. For MiniMax-M3, reasoning is on by default and responses include a reasoning output item. Set effort to none to disable MiniMax-M3 reasoning output. The minimal, low, medium, and high values are accepted for compatibility and keep reasoning enabled; they do not tune MiniMax-M3's reasoning depth. For M2.x models, reasoning cannot be disabled.

Response

200 - application/json

Successful response

object
enum<string>
required

Object type, always response.input_tokens

Available options:
response.input_tokens
input_tokens
integer
required

Estimated input token count