---
description: MiniMax M3.1 Flash is a fast, cost-efficient multimodal model for agentic tasks, coding, and computer use. It accepts text, image, and video input, always reasons before answering with adjustable effort, and has a 1M-token context window.
title: MiniMax M3.1 Flash
image: https://developers.cloudflare.com/og-docs.png
---

[Skip to content](#main-content)

> Documentation Index  
> Fetch the complete documentation index at: https://developers.cloudflare.com/llms.txt  
> Use this file to discover all available pages before exploring further.

![MiniMax logo](https://developers.cloudflare.com/_astro/minimax.B0Y99aoe.svg)

# MiniMax M3.1 Flash

Text Generation • MiniMax

Copy as Markdown| [View as Markdown](https://developers.cloudflare.com/ai/models/minimax/m3.1-flash/index.md)| [Agent setup](https://developers.cloudflare.com/agent-setup/)

Model ID

`minimax/m3.1-flash` Copy

Use with the [Workers AI binding](https://developers.cloudflare.com/ai-gateway/usage/worker-binding-methods/), the AI Gateway [REST API](https://developers.cloudflare.com/ai-gateway/usage/rest-api/), or the [Unified API](https://developers.cloudflare.com/ai-gateway/usage/chat-completion/).

Calling the provider directly? Use the provider's model name instead, including with [provider-native endpoints](https://developers.cloudflare.com/ai-gateway/usage/providers/) or the provider's own SDK. For example, Anthropic's name for `anthropic/claude-opus-4.8` is `claude-opus-4-8`.

- Third-party

MiniMax M3.1 Flash is a fast, cost-efficient multimodal model for agentic tasks, coding, and computer use. It accepts text, image, and video input, always reasons before answering with adjustable effort, and has a 1M-token context window.

| Model Info | |
| --- | --- |
| Context Window [ ↗](https://developers.cloudflare.com/workers-ai/platform/glossary/) | 1,000,000 tokens |
| Terms and License | [link ↗](https://www.minimaxi.com/terms) |
| More information | [link ↗](https://www.minimax.io/blog/minimax-m31f) |
| Request formats | Chat Completions, Anthropic Messages |
| Pricing | <ul><li>Input (per 1M tokens)$0.15</li><li>Output (per 1M tokens)$0.60</li><li>Cached input (per 1M tokens)$0.015</li><li>Cache creation (per 1M tokens)$0.15</li></ul> |

## Usage

```ts
const response = await env.AI.run(
  'minimax/m3.1-flash',
  {
    max_completion_tokens: 4096,
    messages: [{ content: 'What is the capital of France?', role: 'user' }],
  },
)
console.log(response)
```

```bash
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/v1/chat/completions \
  --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
  "model": "minimax/m3.1-flash",
  "max_completion_tokens": 4096,
  "messages": [
    {
      "content": "What is the capital of France?",
      "role": "user"
    }
  ]
}'
```

```
The capital of France is **Paris**.
```

```json
{
  "id": "07281c95c43270e94164f5cfb0dea2db",
  "choices": [
    {
      "finish_reason": "stop",
      "index": 0,
      "message": {
        "content": "The capital of France is **Paris**.",
        "role": "assistant",
        "name": "MiniMax AI",
        "audio_content": ""
      }
    }
  ],
  "created": 1792600469,
  "model": "MiniMax-M3.1-Flash",
  "object": "chat.completion",
  "usage": {
    "total_tokens": 218,
    "total_characters": 0,
    "prompt_tokens": 209,
    "completion_tokens": 9,
    "prompt_tokens_details": {
      "cached_tokens": 195
    }
  },
  "input_sensitive": false,
  "output_sensitive": false,
  "input_sensitive_type": 0,
  "output_sensitive_type": 0,
  "output_sensitive_int": 0,
  "base_resp": {
    "status_code": 0,
    "status_msg": ""
  }
}
```

## Examples

<details>

<summary>**With System Prompt** — Using a system prompt to guide behavior</summary>



```ts
const response = await env.AI.run(
  'minimax/m3.1-flash',
  {
    max_completion_tokens: 4096,
    messages: [
      {
        content:
          'You are a helpful cooking assistant. Give concise recipes with metric measurements.',
        role: 'system',
      },
      { content: 'How do I make a simple pasta aglio e olio?', role: 'user' },
    ],
  },
)
console.log(response)
```

```bash
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/v1/chat/completions \
  --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
  "model": "minimax/m3.1-flash",
  "max_completion_tokens": 4096,
  "messages": [
    {
      "content": "You are a helpful cooking assistant. Give concise recipes with metric measurements.",
      "role": "system"
    },
    {
      "content": "How do I make a simple pasta aglio e olio?",
      "role": "user"
    }
  ]
}'
```

```
## Simple Pasta Aglio e Olio  
**Serves 2**

### Ingredients
- 200 g spaghetti or linguine
- 4 garlic cloves, thinly sliced
- 60 ml extra-virgin olive oil
- ½ tsp red chili flakes
- 10 g chopped fresh parsley
- Salt, to taste
- 60–120 ml reserved pasta water
- Parmesan, optional

### Method
1. Bring a large pot of well-salted water to the boil. Cook the pasta until just al dente. Before draining, reserve about 120 ml of pasta water.
2. Heat the olive oil in a wide pan over medium-low heat. Add the garlic and chili flakes; cook gently for 1–2 minutes until fragrant, but **do not let the garlic brown**.
3. Add the drained pasta and about 60 ml pasta water to the pan.
4. Toss vigorously over medium heat for 1–2 minutes, adding more pasta water as needed, until the sauce is glossy and coats the pasta.
5. Remove from the heat and stir in the parsley. Season with salt and serve with Parmesan if desired.
```

```json
{
  "id": "07281c96a53f7c86ab516eff17649567",
  "choices": [
    {
      "finish_reason": "stop",
      "index": 0,
      "message": {
        "content": "## Simple Pasta Aglio e Olio  \n**Serves 2**\n\n### Ingredients\n- 200 g spaghetti or linguine\n- 4 garlic cloves, thinly sliced\n- 60 ml extra-virgin olive oil\n- ½ tsp red chili flakes\n- 10 g chopped fresh parsley\n- Salt, to taste\n- 60–120 ml reserved pasta water\n- Parmesan, optional\n\n### Method\n1. Bring a large pot of well-salted water to the boil. Cook the pasta until just al dente. Before draining, reserve about 120 ml of pasta water.\n2. Heat the olive oil in a wide pan over medium-low heat. Add the garlic and chili flakes; cook gently for 1–2 minutes until fragrant, but **do not let the garlic brown**.\n3. Add the drained pasta and about 60 ml pasta water to the pan.\n4. Toss vigorously over medium heat for 1–2 minutes, adding more pasta water as needed, until the sauce is glossy and coats the pasta.\n5. Remove from the heat and stir in the parsley. Season with salt and serve with Parmesan if desired.",
        "role": "assistant",
        "name": "MiniMax AI",
        "audio_content": "",
        "reasoning_content": "We need answer concise recipe metric measurements. Need perhaps servings, ingredients, steps. Simple pasta aglio e olio. We should not overcomplicate. Include spaghetti, garlic, olive oil, chili flakes, parsley, pasta water, salt, parmesan optional maybe classic doesn't include parmesan. Need technique emulsification. Metric. User asks how. We can give 2 servings.\n\nNeed be careful measurements. 200 g spaghetti, 4 garlic cloves thinly sliced, 4 tbsp EVOO maybe 60 mL, 1/2 tsp red pepper flakes, 8-10 g parsley, 60-120 mL reserved pasta water, salt. Procedure: boil salted water, reserve water. Warm oil and garlic gently 1-2 min, don't brown, chili. Add pasta and some water, toss vigorously over low-medium until glossy, add parsley and more water as needed. Avoid adding parmesan if wanting classic, but optional.\n\nCould mention don't fry garlic brown. Timing. Let's formulate concise."
      }
    }
  ],
  "created": 1792600470,
  "model": "MiniMax-M3.1-Flash",
  "object": "chat.completion",
  "usage": {
    "total_tokens": 658,
    "total_characters": 0,
    "prompt_tokens": 223,
    "completion_tokens": 435,
    "completion_tokens_details": {
      "reasoning_tokens": 203
    },
    "prompt_tokens_details": {
      "cached_tokens": 188
    }
  },
  "input_sensitive": false,
  "output_sensitive": false,
  "input_sensitive_type": 0,
  "output_sensitive_type": 0,
  "output_sensitive_int": 0,
  "base_resp": {
    "status_code": 0,
    "status_msg": ""
  }
}
```

</details>

<details>

<summary>**Low Thinking Effort** — Lowering thinking depth for faster, cheaper answers</summary>



```ts
const response = await env.AI.run(
  'minimax/m3.1-flash',
  {
    max_completion_tokens: 4096,
    messages: [
      { content: 'Explain the difference between TCP and UDP in two sentences.', role: 'user' },
    ],
    reasoning_effort: 'low',
  },
)
console.log(response)
```

```bash
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/v1/chat/completions \
  --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
  "model": "minimax/m3.1-flash",
  "max_completion_tokens": 4096,
  "messages": [
    {
      "content": "Explain the difference between TCP and UDP in two sentences.",
      "role": "user"
    }
  ],
  "reasoning_effort": "low"
}'
```

```
TCP is a connection-oriented protocol that provides reliable, ordered delivery through error checking, acknowledgments, and retransmission. UDP is connectionless and offers faster, lower-overhead communication without guaranteed delivery or ordering, making it suitable for real-time applications.
```

```json
{
  "id": "07281c9dfd1064ef56da8e879bf07450",
  "choices": [
    {
      "finish_reason": "stop",
      "index": 0,
      "message": {
        "content": "TCP is a connection-oriented protocol that provides reliable, ordered delivery through error checking, acknowledgments, and retransmission. UDP is connectionless and offers faster, lower-overhead communication without guaranteed delivery or ordering, making it suitable for real-time applications.",
        "role": "assistant",
        "name": "MiniMax AI",
        "audio_content": ""
      }
    }
  ],
  "created": 1792600477,
  "model": "MiniMax-M3.1-Flash",
  "object": "chat.completion",
  "usage": {
    "total_tokens": 263,
    "total_characters": 0,
    "prompt_tokens": 213,
    "completion_tokens": 50,
    "prompt_tokens_details": {
      "cached_tokens": 195
    }
  },
  "input_sensitive": false,
  "output_sensitive": false,
  "input_sensitive_type": 0,
  "output_sensitive_type": 0,
  "output_sensitive_int": 0,
  "base_resp": {
    "status_code": 0,
    "status_msg": ""
  }
}
```

</details>

<details>

<summary>**Image Understanding** — Describing an image from a URL</summary>



```ts
const response = await env.AI.run(
  'minimax/m3.1-flash',
  {
    max_completion_tokens: 4096,
    messages: [
      {
        content: [
          { text: 'What does this image show?', type: 'text' },
          {
            image_url: {
              url: 'https://filecdn.minimax.chat/public/fe9d04da-f60e-444d-a2e0-18ae743add33.jpeg',
            },
            type: 'image_url',
          },
        ],
        role: 'user',
      },
    ],
    reasoning_effort: 'low',
  },
)
console.log(response)
```

```bash
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/v1/chat/completions \
  --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
  "model": "minimax/m3.1-flash",
  "max_completion_tokens": 4096,
  "messages": [
    {
      "content": [
        {
          "text": "What does this image show?",
          "type": "text"
        },
        {
          "image_url": {
            "url": "https://filecdn.minimax.chat/public/fe9d04da-f60e-444d-a2e0-18ae743add33.jpeg"
          },
          "type": "image_url"
        }
      ],
      "role": "user"
    }
  ],
  "reasoning_effort": "low"
}'
```

```
A warm, softly lit close-up portrait of a smiling young girl with brown hair and bangs, wearing a cream-colored lace-trimmed top against a blurred neutral background.
```

```json
{
  "id": "07281c9f9fc9055f25fb002db64cc7c3",
  "choices": [
    {
      "finish_reason": "stop",
      "index": 0,
      "message": {
        "content": "A warm, softly lit close-up portrait of a smiling young girl with brown hair and bangs, wearing a cream-colored lace-trimmed top against a blurred neutral background.",
        "role": "assistant",
        "name": "MiniMax AI",
        "audio_content": "",
        "reasoning_content": "We need answer image description. Child portrait. Need perhaps mention close-up, girl, brown hair bangs, white lace top, warm lighting, smile. Don't identify."
      }
    }
  ],
  "created": 1792600479,
  "model": "MiniMax-M3.1-Flash",
  "object": "chat.completion",
  "usage": {
    "total_tokens": 1475,
    "total_characters": 0,
    "prompt_tokens": 1406,
    "completion_tokens": 69,
    "completion_tokens_details": {
      "reasoning_tokens": 35
    },
    "prompt_tokens_details": {
      "cached_tokens": 195
    }
  },
  "input_sensitive": false,
  "output_sensitive": false,
  "input_sensitive_type": 0,
  "output_sensitive_type": 0,
  "output_sensitive_int": 0,
  "base_resp": {
    "status_code": 0,
    "status_msg": ""
  }
}
```

</details>

<details>

<summary>**Video Understanding** — Summarizing a video from a URL, sampled at one frame every two seconds</summary>



```ts
const response = await env.AI.run(
  'minimax/m3.1-flash',
  {
    max_completion_tokens: 4096,
    messages: [
      {
        content: [
          { text: 'What is happening in this video?', type: 'text' },
          {
            type: 'video_url',
            video_url: {
              fps: 0.5,
              url: 'https://filecdn.minimax.chat/public/ee8c1648-21f1-41b7-8397-65022d22ffe5.mp4',
            },
          },
        ],
        role: 'user',
      },
    ],
    reasoning_effort: 'low',
  },
)
console.log(response)
```

```bash
curl https://api.cloudflare.com/client/v4/accounts/$CLOUDFLARE_ACCOUNT_ID/ai/v1/chat/completions \
  --header "Authorization: Bearer $CLOUDFLARE_API_TOKEN" \
  --header "Content-Type: application/json" \
  --data '{
  "model": "minimax/m3.1-flash",
  "max_completion_tokens": 4096,
  "messages": [
    {
      "content": [
        {
          "text": "What is happening in this video?",
          "type": "text"
        },
        {
          "type": "video_url",
          "video_url": {
            "fps": 0.5,
            "url": "https://filecdn.minimax.chat/public/ee8c1648-21f1-41b7-8397-65022d22ffe5.mp4"
          }
        }
      ],
      "role": "user"
    }
  ],
  "reasoning_effort": "low"
}'
```

```
The video shows a tiger walking along a narrow elevated platform in an Olympic-themed stadium, with spectators in the stands. It then moves off the platform and splashes into the swimming pool below.
```

```json
{
  "id": "07281ca2d4bbbcb96da3e6cd298d41c5",
  "choices": [
    {
      "finish_reason": "stop",
      "index": 0,
      "message": {
        "content": "The video shows a tiger walking along a narrow elevated platform in an Olympic-themed stadium, with spectators in the stands. It then moves off the platform and splashes into the swimming pool below.",
        "role": "assistant",
        "name": "MiniMax AI",
        "audio_content": "",
        "reasoning_content": "We need answer describe video based on frames. Need infer sequence: tiger walking on raised platform at Olympics venue, then perhaps releases into pool? Need inspect frames. At 0 tiger on beam/platform, Olympics branding, spectators. 4 sec shows pool, splash at right maybe tiger jumped/swimming? Need articulate. Image has tiger walking across narrow platform, likely opening ceremony? Need not overclaim. Let's formulate: A tiger is led/walks along elevated runway over swimming pool in Olympic-branded stadium; then appears to leap/splash into pool? The second frame shows a dark animal shape entering water at far right, large splash. Could be tiger swimming. Let's answer cautiously."
      }
    }
  ],
  "created": 1792600485,
  "model": "MiniMax-M3.1-Flash",
  "object": "chat.completion",
  "usage": {
    "total_tokens": 732,
    "total_characters": 0,
    "prompt_tokens": 555,
    "completion_tokens": 177,
    "completion_tokens_details": {
      "reasoning_tokens": 139
    },
    "prompt_tokens_details": {
      "cached_tokens": 195
    }
  },
  "input_sensitive": false,
  "output_sensitive": false,
  "input_sensitive_type": 0,
  "output_sensitive_type": 0,
  "output_sensitive_int": 0,
  "base_resp": {
    "status_code": 0,
    "status_msg": ""
  }
}
```

</details>

## Parameters

Schema variant

Chat CompletionsMessages

▶messages\[]

`array`required

temperature

`number`minimum: 0maximum: 1

max\_tokens

`number`exclusiveMinimum: 0

max\_completion\_tokens

`number`exclusiveMinimum: 0

top\_p

`number`minimum: 0maximum: 1

stream

`boolean`

▶stream\_options{}

`object`

▶tools\[]

`array`

tool\_choice

`string`enum: none, auto

▶response\_format{}

`object`

mask\_sensitive\_info

`boolean`

▶thinking{}

`object`

reasoning\_effort

`string`enum: low, medium, high, xhigh, max

▶messages\[]

`array`required

max\_tokens

`number`requiredexclusiveMinimum: 0

▶system

`one of`

temperature

`number`minimum: 0maximum: 1

top\_p

`number`minimum: 0maximum: 1

top\_k

`number`exclusiveMinimum: 0

stream

`boolean`

▶metadata{}

`object`

id

`string`

▶choices\[]

`array`

created

`number`

model

`string`

object

`string`enum: chat.completion, chat.completion.chunk

▶usage{}

`object`

input\_sensitive

`boolean`

output\_sensitive

`boolean`

▶base\_resp{}

`object`

id

`string`

type

`string`const: message

role

`string`const: assistant

▶content\[]

`array`

model

`string`

stop\_reason

`string`

▶usage{}

`object`

## API Schemas (Raw)

Input [Open](https://developers.cloudflare.com/ai/models/minimax/m3.1-flash/schema-input.json) [Download](https://developers.cloudflare.com/ai/models/minimax/m3.1-flash/schema-input.json)

Output [Open](https://developers.cloudflare.com/ai/models/minimax/m3.1-flash/schema-output.json) [Download](https://developers.cloudflare.com/ai/models/minimax/m3.1-flash/schema-output.json)

Was this helpful?

YesNo

## On this page

[![](https://developers.cloudflare.com/_astro/logo.te5VL_aD.svg)Docs](https://developers.cloudflare.com/)

```json
{"@context":"https://schema.org","@type":"TechArticle","@id":"https://developers.cloudflare.com/ai/models/minimax/m3.1-flash/#page","headline":"MiniMax M3.1 Flash","description":"MiniMax M3.1 Flash is a fast, cost-efficient multimodal model for agentic tasks, coding, and computer use. It accepts text, image, and video input, always reasons before answering with adjustable effort, and has a 1M-token context window.","url":"https://developers.cloudflare.com/ai/models/minimax/m3.1-flash/","inLanguage":"en","image":"https://developers.cloudflare.com/og-docs.png","publisher":{"@type":"Organization","name":"Cloudflare","description":"One platform for your apps, agents, and workforce. Build, secure, and scale without managing infrastructure","url":"https://www.cloudflare.com/","sameAs":["https://github.com/cloudflare","https://www.linkedin.com/company/cloudflare","https://x.com/cloudflare"],"logo":{"@type":"ImageObject","url":"https://developers.cloudflare.com/logo.svg"},"address":{"@type":"PostalAddress","streetAddress":"101 Townsend St","addressLocality":"San Francisco","addressRegion":"CA","postalCode":"94107","addressCountry":"US"},"contactPoint":[{"@type":"ContactPoint","contactType":"Customer Support","url":"https://support.cloudflare.com/","availableLanguage":["English"]},{"@type":"ContactPoint","contactType":"Sales","url":"https://www.cloudflare.com/contact/","availableLanguage":["English"]}]},"isPartOf":{"@type":"WebSite","@id":"https://developers.cloudflare.com/#website","name":"Cloudflare Docs","url":"https://developers.cloudflare.com/"}}
```
