Skip to content
MiniMax logo

M2.7

Text GenerationMiniMaxProxied

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

Model Info
Context Window128,000 tokens
Terms and Licenselink
More informationlink

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)

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)
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)
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)

Parameters

temperature
numberminimum: 0maximum: 1
max_tokens
numberexclusiveMinimum: 0
max_completion_tokens
numberexclusiveMinimum: 0
top_p
numberminimum: 0maximum: 1
stream
boolean
tool_choice
stringenum: none, auto
mask_sensitive_info
boolean

API Schemas

{
"$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": {}
}