> ## Documentation Index
> Fetch the complete documentation index at: https://gomodel-feat-audit-operation-filter.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# MiniMax

> Configure MiniMax in GoModel: chat models, temperature handling, and native text-to-speech through the standard audio endpoint.

MiniMax speaks an OpenAI-compatible chat API, so chat models work out of the
box. Text-to-speech, however, uses MiniMax's own `t2a_v2` API — GoModel
translates the standard `/v1/audio/speech` endpoint into that dialect for you.

## Configure

```bash theme={null}
MINIMAX_API_KEY=...
```

Or in `config.yaml`:

```yaml theme={null}
providers:
  minimax:
    type: minimax
    base_url: "https://api.minimax.io/v1"
    api_key: "${MINIMAX_API_KEY}"
```

`MINIMAX_BASE_URL` overrides the endpoint (default
`https://api.minimax.io/v1`); accounts on the China platform should set it to
`https://api.minimaxi.com/v1`.

## Video input

Use `video_url` message content parts with `MiniMax-M3` for video input
on `/v1/chat/completions`, including streaming requests:

```json theme={null}
{"type":"video_url","video_url":{"url":"mm_file://your-file-id","detail":"high","fps":2}}
```

The gateway preserves video URLs and processing settings. A URL, base64 data
URL, or an existing MiniMax file reference can be supplied. Upload large videos
through MiniMax's Files API first; the gateway does not upload videos for you.
See the [MiniMax video input reference](https://platform.minimax.io/docs/api-reference/text-openai-api#multimodal-input)
for supported formats and size limits.

## Temperature

MiniMax requires `temperature` in `(0.0, 1.0]` and rejects zero. GoModel clamps
a zero or negative temperature to `1.0` so OpenAI-style requests that pin
`temperature: 0` keep working.

## Reasoning

`MiniMax-M3`, `MiniMax-M2.7`, `MiniMax-M2.7-highspeed`, `MiniMax-M2.5`,
`MiniMax-M2.5-highspeed` and `MiniMax-M2` write their chain of thought
separately from the answer.
GoModel sets `reasoning_split: true` on these requests — only when the request
does not already carry the flag, so a caller-provided `reasoning_split: false`
stays in charge — and the thinking arrives
natively in `reasoning_content` — not as inline `<think>` tags inside
`content` — and is relayed as is. On streamed responses MiniMax also sends a
`reasoning_details` array that duplicates every `reasoning_content` delta; the
gateway strips that redundant member from `choices[].delta`. Every other
MiniMax model passes through untouched.

## Text-to-speech

`POST /v1/audio/speech` is translated to MiniMax's synchronous
[`t2a_v2`](https://platform.minimax.io/docs/api-reference/speech-t2a-v2)
API and the hex-encoded audio is decoded back to binary:

<CodeGroup>
  ```bash curl theme={null}
  curl https://your-gateway/v1/audio/speech \
    -H "Authorization: Bearer $GOMODEL_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "model": "speech-2.6-hd",
      "input": "Hello from GoModel.",
      "voice": "English_expressive_narrator",
      "response_format": "mp3"
    }' \
    --output speech.mp3
  ```

  ```python Python theme={null}
  import os

  from openai import OpenAI

  client = OpenAI(
      base_url="https://your-gateway/v1",
      api_key=os.environ["GOMODEL_KEY"],
  )

  speech = client.audio.speech.create(
      model="speech-2.6-hd",
      input="Hello from GoModel.",
      voice="English_expressive_narrator",
      response_format="mp3",
  )
  speech.write_to_file("speech.mp3")
  ```

  ```javascript JavaScript theme={null}
  import { writeFile } from "node:fs/promises";
  import OpenAI from "openai";

  const client = new OpenAI({
    baseURL: "https://your-gateway/v1",
    apiKey: process.env.GOMODEL_KEY,
  });

  const speech = await client.audio.speech.create({
    model: "speech-2.6-hd",
    input: "Hello from GoModel.",
    voice: "English_expressive_narrator",
    response_format: "mp3",
  });

  await writeFile("speech.mp3", Buffer.from(await speech.arrayBuffer()));
  ```
</CodeGroup>

* `voice` takes a **MiniMax voice ID** (for example
  `English_expressive_narrator`), not an OpenAI voice name like `alloy`.
* `response_format` supports `mp3` (default), `wav`, `flac`, and `pcm`.
* `speed` supports `0.5`–`2.0` (default `1.0`).

Speech models are usually not returned by MiniMax's `/models` listing, so add
them to the configured model list to make them routable:

```bash theme={null}
MINIMAX_MODELS=speech-2.6-hd,speech-2.6-turbo
```

MiniMax reports failures as HTTP 200 with a native status code; GoModel maps
the common ones to real errors (invalid parameters and blocked content → 400,
authentication → 401, insufficient balance → 402, rate limits → 429) instead of
relaying them as opaque gateway errors.

## Not supported by MiniMax

All of these return `invalid_request_error` rather than silently dropping the
option:

* Speech `instructions` (pick a voice ID that matches the style you want).
* Speech `response_format` values other than `mp3`/`wav`/`flac`/`pcm` and
  `speed` outside `0.5`–`2.0`.
* Speech-to-text — MiniMax has no transcription API, so
  `/v1/audio/transcriptions` is rejected.
* Realtime voice-to-voice — MiniMax's conversational realtime schema is not
  OpenAI-compatible, so it is not exposed at `/v1/realtime`.

## Image-to-image generation

Send a multipart request to `/v1/images/edits` with `model=image-01` or
`model=image-01-live`, a `prompt`, and uploaded `image` files. MiniMax uses the
images as character portrait references; it does not perform masked edits.
Use front-facing portraits in JPEG or PNG format, each smaller than 10 MB.

The adapter sends the portraits as data URLs in `subject_reference` to MiniMax's
`/v1/image_generation` endpoint using the configured regional base URL.
`size=WIDTHxHEIGHT` maps to `width` and `height`. Custom dimensions apply to
`image-01` only: `size`, `width`, and `height` are rejected for `image-01-live`,
which is sized with `aspect_ratio`. Native `aspect_ratio`, `seed`, `n`, and
`prompt_optimizer` fields are also supported.
`response_format=b64_json` maps to MiniMax's `base64` format and returns
`data[].b64_json`; the default returns `data[].url` (links expire after 24 hours).
Masks and unsupported edit fields return a validation error.
Native HTTP-200 failures are mapped to the matching OpenAI error status the same
way as image generation, described below.

See the [MiniMax image-to-image API](https://platform.minimax.io/docs/api-reference/image-generation-i2i)
for model-specific parameter limits.

## Image generation

Use `image-01` or `image-01-live` with `/v1/images/generations`. GoModel translates
requests to MiniMax's native `/v1/image_generation` endpoint using the configured
base URL and returns generated images in `data`.

```json theme={null}
{"model":"image-01","provider":"minimax","prompt":"A lighthouse at sunrise","aspect_ratio":"16:9","n":1}
```

The default response format is `url`; URLs expire after 24 hours. Use
`response_format: "b64_json"` for inline images. Native `base64` is also accepted.
`size: "1024x1024"` maps to `width` and `height`; omit `size` when supplying
native dimensions or `aspect_ratio`. Native options such as `seed` and
`prompt_optimizer` pass through. `quality` and streaming are unsupported.

MiniMax reports image, image-edit, and speech failures as HTTP 200 with a non-zero
`base_resp.status_code`. GoModel maps that code to the matching OpenAI error
status — 429 for rate and usage limits, 401 for auth, 402 for balance, 400 for
invalid or rejected input, 502 otherwise — and appends MiniMax's own
`base_resp.status_msg` to the error message so the upstream diagnostic is not
lost.

See the [MiniMax image API reference](https://platform.minimax.io/docs/api-reference/image-generation-t2i)
for model-specific limits.
