---
title: M2.7
description: MiniMax's M2.7 language model with multilingual capabilities.
image: https://developers.cloudflare.com/dev-products-preview.png
---

[Skip to content](#%5Ftop) 

Was this helpful?

YesNo

[ Report issue ](https://github.com/cloudflare/cloudflare-docs/issues/new/choose) 

Copy page

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

#  M2.7 

Text Generation • MiniMax • Proxied 

`minimax/m2.7` 

MiniMax's M2.7 language model with multilingual capabilities.

| Model Info                                                                 |                                          |
| -------------------------------------------------------------------------- | ---------------------------------------- |
| Context Window[ ↗](https://developers.cloudflare.com/workers-ai/glossary/) | 128,000 tokens                           |
| Terms and License                                                          | [link ↗](https://www.minimaxi.com/terms) |
| More information                                                           | [link ↗](https://www.minimaxi.com/)      |

## Usage

TypeScript

```

const response = await env.AI.run(

  'minimax/m2.7',

  {

    messages: [

      {

        role: 'user',

        content: 'What is the capital of France?',

      },

    ],

    max_tokens: 100,

  },

  {

    gateway: { id: 'default' },

  }

)

console.log(response)


```

Explain Code

## Examples

**With System Prompt**  — Using a system prompt to guide behavior 

TypeScript

```

const response = await env.AI.run(

  'minimax/m2.7',

  {

    messages: [

      {

        role: 'system',

        content:

          'You are a helpful cooking assistant. Give concise recipes with metric measurements.',

      },

      {

        role: 'user',

        content: 'How do I make a simple pasta aglio e olio?',

      },

    ],

    max_tokens: 500,

    temperature: 0.7,

  },

  {

    gateway: { id: 'default' },

  }

)

console.log(response)


```

Explain Code

**Multi-turn Conversation**  — Continuing a conversation with context 

TypeScript

```

const response = await env.AI.run(

  'minimax/m2.7',

  {

    messages: [

      {

        role: 'user',

        content: 'What are the main differences between TCP and UDP?',

      },

      {

        role: 'assistant',

        content:

          'TCP is connection-oriented and guarantees delivery, while UDP is connectionless and faster but without delivery guarantees.',

      },

      {

        role: 'user',

        content: 'When would I choose UDP over TCP?',

      },

    ],

    max_tokens: 500,

    temperature: 0.5,

  },

  {

    gateway: { id: 'default' },

  }

)

console.log(response)


```

Explain Code

**Creative Writing**  — Higher temperature for creative output 

TypeScript

```

const response = await env.AI.run(

  'minimax/m2.7',

  {

    messages: [

      {

        role: 'user',

        content: 'Write a haiku about programming.',

      },

    ],

    max_tokens: 100,

    temperature: 0.9,

  },

  {

    gateway: { id: 'default' },

  }

)

console.log(response)


```

Explain Code

## Parameters

* [ Input ](#tab-panel-146)
* [ Output ](#tab-panel-147)

▶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`

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`

## API Schemas

* [ Input ](#tab-panel-144)
* [ Output ](#tab-panel-145)

```

{

  "$schema": "https://json-schema.org/draft/2020-12/schema",

  "type": "object",

  "properties": {

    "messages": {

      "type": "array",

      "items": {

        "type": "object",

        "properties": {

          "role": {

            "type": "string",

            "enum": [

              "system",

              "user",

              "assistant",

              "tool"

            ]

          },

          "name": {

            "type": "string"

          },

          "content": {

            "anyOf": [

              {

                "type": "string"

              },

              {

                "type": "array",

                "items": {

                  "anyOf": [

                    {

                      "type": "object",

                      "properties": {

                        "type": {

                          "type": "string",

                          "const": "text"

                        },

                        "text": {

                          "type": "string"

                        }

                      },

                      "required": [

                        "type",

                        "text"

                      ],

                      "additionalProperties": false

                    },

                    {

                      "type": "object",

                      "properties": {

                        "type": {

                          "type": "string",

                          "const": "image_url"

                        },

                        "image_url": {

                          "type": "object",

                          "properties": {

                            "url": {

                              "type": "string"

                            }

                          },

                          "required": [

                            "url"

                          ],

                          "additionalProperties": false

                        }

                      },

                      "required": [

                        "type",

                        "image_url"

                      ],

                      "additionalProperties": false

                    }

                  ]

                }

              }

            ]

          },

          "tool_calls": {

            "type": "array",

            "items": {

              "type": "object",

              "properties": {

                "id": {

                  "type": "string"

                },

                "type": {

                  "type": "string",

                  "const": "function"

                },

                "function": {

                  "type": "object",

                  "properties": {

                    "name": {

                      "type": "string"

                    },

                    "arguments": {

                      "type": "string"

                    }

                  },

                  "required": [

                    "name",

                    "arguments"

                  ],

                  "additionalProperties": false

                }

              },

              "required": [

                "id",

                "type",

                "function"

              ],

              "additionalProperties": false

            }

          }

        },

        "required": [

          "role",

          "content"

        ],

        "additionalProperties": {}

      }

    },

    "temperature": {

      "type": "number",

      "minimum": 0,

      "maximum": 1

    },

    "max_tokens": {

      "type": "number",

      "exclusiveMinimum": 0

    },

    "max_completion_tokens": {

      "type": "number",

      "exclusiveMinimum": 0

    },

    "top_p": {

      "type": "number",

      "minimum": 0,

      "maximum": 1

    },

    "stream": {

      "type": "boolean"

    },

    "stream_options": {

      "type": "object",

      "properties": {

        "include_usage": {

          "type": "boolean"

        }

      },

      "additionalProperties": false

    },

    "tools": {

      "type": "array",

      "items": {

        "type": "object",

        "properties": {

          "type": {

            "type": "string",

            "const": "function"

          },

          "function": {

            "type": "object",

            "properties": {

              "name": {

                "type": "string"

              },

              "description": {

                "type": "string"

              },

              "parameters": {}

            },

            "required": [

              "name",

              "description",

              "parameters"

            ],

            "additionalProperties": false

          }

        },

        "required": [

          "type",

          "function"

        ],

        "additionalProperties": false

      }

    },

    "tool_choice": {

      "type": "string",

      "enum": [

        "none",

        "auto"

      ]

    },

    "response_format": {

      "type": "object",

      "properties": {

        "type": {

          "type": "string",

          "const": "json_schema"

        },

        "json_schema": {

          "type": "object",

          "properties": {

            "name": {

              "type": "string",

              "maxLength": 64

            },

            "description": {

              "type": "string"

            },

            "schema": {

              "type": "object",

              "properties": {

                "type": {

                  "type": "string",

                  "const": "object"

                },

                "properties": {}

              },

              "required": [

                "type",

                "properties"

              ],

              "additionalProperties": false

            }

          },

          "required": [

            "name",

            "schema"

          ],

          "additionalProperties": false

        }

      },

      "required": [

        "type",

        "json_schema"

      ],

      "additionalProperties": false

    },

    "mask_sensitive_info": {

      "type": "boolean"

    }

  },

  "required": [

    "messages"

  ],

  "additionalProperties": {}

}


```

Explain Code

```

{

  "$schema": "https://json-schema.org/draft/2020-12/schema",

  "type": "object",

  "properties": {

    "id": {

      "type": "string"

    },

    "choices": {

      "type": "array",

      "items": {

        "type": "object",

        "properties": {

          "index": {

            "type": "number"

          },

          "message": {

            "type": "object",

            "properties": {

              "role": {

                "type": "string",

                "const": "assistant"

              },

              "content": {

                "type": "string"

              },

              "tool_calls": {

                "type": "array",

                "items": {

                  "type": "object",

                  "properties": {

                    "id": {

                      "type": "string"

                    },

                    "type": {

                      "type": "string",

                      "const": "function"

                    },

                    "function": {

                      "type": "object",

                      "properties": {

                        "name": {

                          "type": "string"

                        },

                        "arguments": {

                          "type": "string"

                        }

                      },

                      "required": [

                        "name",

                        "arguments"

                      ],

                      "additionalProperties": false

                    }

                  },

                  "required": [

                    "id",

                    "type",

                    "function"

                  ],

                  "additionalProperties": false

                }

              }

            },

            "required": [

              "role",

              "content"

            ],

            "additionalProperties": {}

          },

          "finish_reason": {

            "type": "string",

            "enum": [

              "stop",

              "length",

              "tool_calls"

            ]

          }

        },

        "required": [

          "index",

          "message",

          "finish_reason"

        ],

        "additionalProperties": {}

      }

    },

    "created": {

      "type": "number"

    },

    "model": {

      "type": "string"

    },

    "object": {

      "type": "string",

      "enum": [

        "chat.completion",

        "chat.completion.chunk"

      ]

    },

    "usage": {

      "type": "object",

      "properties": {

        "total_tokens": {

          "type": "number"

        },

        "prompt_tokens": {

          "type": "number"

        },

        "completion_tokens": {

          "type": "number"

        }

      },

      "required": [

        "total_tokens",

        "prompt_tokens",

        "completion_tokens"

      ],

      "additionalProperties": {}

    },

    "input_sensitive": {

      "type": "boolean"

    },

    "output_sensitive": {

      "type": "boolean"

    },

    "base_resp": {

      "type": "object",

      "properties": {

        "status_code": {

          "type": "number"

        },

        "status_msg": {

          "type": "string"

        }

      },

      "required": [

        "status_code",

        "status_msg"

      ],

      "additionalProperties": false

    }

  },

  "required": [

    "id",

    "choices",

    "created",

    "model",

    "object"

  ],

  "additionalProperties": {}

}


```

Explain Code

```json
{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"item":{"@id":"/directory/","name":"Directory"}},{"@type":"ListItem","position":2,"item":{"@id":"/ai/","name":"AI"}},{"@type":"ListItem","position":3,"item":{"@id":"/ai/models/","name":"Models"}}]}
```
