Skip to main content
POST
Use this API to send text, images, and/or videos and receive generated text back. All supported API capabilities, such as function calling, are documented here. The input and output modality support depends on the model you’re using for inference.

Authorizations

Authorization
string
header
required

Modular Cloud API key. Obtain from the API keys page.

Body

application/json
model
string
required

Model identifier. See the supported models page.

Example:

"minimax/minimax-m3"

messages
object[]
required

The conversation history.

max_tokens
integer

Maximum number of tokens to generate.

temperature
number

Sampling temperature (0–2). Higher values produce more varied output.

Required range: 0 <= x <= 2
top_p
number
default:1

Nucleus sampling threshold (0–1). Limits token selection to the smallest set whose cumulative probability reaches this value. Lower values narrow the output distribution.

Required range: 0 <= x <= 1
frequency_penalty
number
default:0

Adjusts likelihood of tokens based on their frequency in the output so far (-2 to 2). Positive values decrease repetition.

Required range: -2 <= x <= 2
presence_penalty
number
default:0

Adjusts likelihood of tokens based on whether they've already appeared in the output (-2 to 2). Positive values increase topic diversity.

Required range: -2 <= x <= 2
stop

Up to 4 sequences that signal the model to stop generating. The returned text doesn't include the stop sequence.

seed
integer

Seed for deterministic sampling. Requests with the same seed and parameters return similar results, but determinism isn't guaranteed.

stream
boolean

If true, stream partial tokens as server-sent events. Support for tools while streaming is model-dependent; set this to false if you see incomplete or malformed tool-call output.

tools
object[]

List of functions the model may call. See the supported models page for a list of models that support tool use (function calling).

tool_choice

Controls when and how the model calls a tool.

  • none: Disables tool calls.
  • auto (default): Lets the model decide whether to call a tool.
  • required: Forces the model to call at least one tool.
  • A function object: Forces the model to call the named function.

The following example requires the model to call the get_weather function:

Available options:
none,
auto,
required
reasoning
object

Controls whether the model generates chain-of-thought reasoning before responding. See the supported models page for a list of models that support reasoning.

We also support an equivalent thinking parameter. Use whichever format your client or model expects.

reasoning_effort
enum<string>

Controls how much reasoning the model performs. Shorthand for reasoning.effort. If both are set, reasoning.effort takes precedence.

See the supported models page for a list of models that support reasoning.

Available options:
low,
medium,
high

Response

200 - application/json

Chat completion response.

id
string
required

The unique identifier for the chat completion.

object
string
required

The object type, which is always chat.completion.

model
string
required

The model that generated the completion.

choices
object[]
required

The generated chat completion choices.

usage
object

Token usage for the request.