Kiloport

API DOCS

MiniMax M4 API documentation

The API follows the OpenAI Chat Completions format. Point an OpenAI client at the base URL below, use your key as the bearer token, and choose minimax-m4 or minimax-m4-pro.

Quickstart

  1. Create a key on the homepage and copy it. It starts with sk_minimaxm4-io_.
  2. Add balance with a one-time payment from $5.
  3. Send a request with the base URL and your key.
Base URL
https://minimaxm4.io/v1
cURL
curl https://minimaxm4.io/v1/chat/completions \
  -H "Authorization: Bearer $KILOPORT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "model": "minimax-m4",
    "messages": [{"role": "user", "content": "Write a Python function that merges overlapping intervals."}]
  }'

Models and reasoning

MiniMax M4 always thinks before it answers. Both model IDs run the same MiniMax M4 model at the same price per token; they differ only in how much it thinks.

minimax-m4Medium reasoning by default. Send reasoning_effort low, medium, high, xhigh or max to change it per request.
minimax-m4-proAlways maximum reasoning. Any reasoning_effort you send is ignored. MiniMax publishes no separate Pro model; this is MiniMax M4 at max effort.

Reasoning arrives in a separate reasoning field (delta.reasoning when streaming) and its tokens are counted in completion_tokens. When you continue a tool-calling conversation, send the assistant message back as you received it.

Use MiniMax M4 in editors and agents

Any tool that lets you add an OpenAI-compatible provider works. Set the base URL, paste your key, and type the model ID.

Cline / Roo Code / Kilo Code
API Provider:  OpenAI Compatible
Base URL:      https://minimaxm4.io/v1
API Key:       sk_minimaxm4-io_your_key
Model ID:      minimax-m4

Open the extension settings in VS Code and choose the OpenAI Compatible provider.

Reference

POST /v1/chat/completions

Creates a reply. Supported fields: model, messages, max_tokens or max_completion_tokens, reasoning_effort, stream, stream_options, tools, tool_choice, parallel_tool_calls, response_format, stop and seed. temperature and top_p are accepted but MiniMax M4 uses fixed values. n must be 1.

With stream: true the reply arrives as server-sent events and ends with data: [DONE]. Set stream_options.include_usage to receive a final chunk with token counts.

Tool calling request body
{
  "model": "minimax-m4",
  "messages": [{"role": "user", "content": "What is in src/app.ts?"}],
  "tools": [{
    "type": "function",
    "function": {
      "name": "read_file",
      "description": "Read a file from the repository",
      "parameters": {"type": "object", "properties": {"path": {"type": "string"}}, "required": ["path"]}
    }
  }]
}
Image input request body
{
  "model": "minimax-m4",
  "messages": [{
    "role": "user",
    "content": [
      {"type": "text", "text": "What is wrong with this chart?"},
      {"type": "image_url", "image_url": {"url": "https://example.com/chart.png"}}
    ]
  }]
}

GET /v1/models

Lists the models that are available right now.

cURL
curl https://minimaxm4.io/v1/models -H "Authorization: Bearer $KILOPORT_API_KEY"

GET /v1/balance

Returns the remaining USD balance of the account that owns the key.

cURL
curl https://minimaxm4.io/v1/balance -H "Authorization: Bearer $KILOPORT_API_KEY"

Billing

Every request is billed from your USD balance by the tokens it uses, with a minimum of $0.001. Before a request starts, the cost of its input estimate plus max_tokens is held; when it finishes, you pay for the actual usage and the rest returns at once. If the balance cannot cover max_tokens, the request runs with a smaller max_tokens; below 256 tokens it is refused with 402. Failed requests are not charged.

Each response carries an X-Request-Id header. Non-streaming responses also carry X-Balance-Charged-Usd with the final charge.

See prices and top-ups →

Errors and limits

Errors use the OpenAI error format, so SDKs raise their usual exceptions.

400Invalid request: unknown model, malformed messages, unsupported reasoning_effort or over the input limit.
401Missing, malformed, unknown or revoked API key.
402Insufficient balance for this request. Add balance and retry.
429Rate or concurrency limit reached. Wait for the Retry-After header.
502The model provider returned an error. The hold is returned.
503The model is temporarily unavailable. Nothing is charged.
Error body
{
  "error": {
    "message": "Insufficient balance: this request needs at least $0.002. Add balance at https://minimaxm4.io/pricing.",
    "type": "insufficient_quota",
    "param": null,
    "code": "insufficient_quota"
  }
}
Input per request512,000 tokens
Default max_tokens16,384 tokens
Maximum max_tokens65,536 tokens
Images per request16
Requests per minute per key120
Concurrent requests per account8

Requests and replies are not stored. We keep metering data only: model, reasoning setting, token counts, cost, status and time.