MiniMax M2.7

Text Generation • MiniMax

minimax/m2.7

  • Third-party
  • Zero data retention

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

Model Info
Context Window ↗ 128,000 tokens
Terms and License link ↗
More information link ↗
Zero data retention Yes
Request formats Chat Completions, Anthropic Messages
Pricing <ul><li>Input (per 1M tokens)$0.30</li><li>Output (per 1M tokens)$1.20</li><li>Cached input (per 1M tokens)$0.06</li><li>Cache creation (per 1M tokens)$0.375</li></ul>

Usage

const response = await env.AI.run(
  'minimax/m2.7',
  { max_tokens: 2048, messages: [{ content: 'What is the capital of France?', role: 'user' }] },
)
console.log(response)
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/m2.7",
  "max_tokens": 2048,
  "messages": [
    {
      "content": "What is the capital of France?",
      "role": "user"
    }
  ]
}'
The capital of France is **Paris**.
{
  "id": "066cf8dd69cbfedefa3ee5b16006f2bd",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "The capital of France is **Paris**.",
        "name": "MiniMax AI",
        "audio_content": "",
        "reasoning_content": "The user asks: \"What is the capital of France?\" This is a straightforward factual question. The answer: Paris. The user likely wants the answer. No policy issues. There's no disallowed content. Just answer with \"Paris\". Should be simple. Possibly also elaborate slightly. But answer is \"Paris\". Provide answer concisely.",
        "reasoning_details": [
          {
            "type": "reasoning.text",
            "id": "reasoning-text-1",
            "format": "MiniMax-response-v1",
            "index": 0,
            "text": "The user asks: \"What is the capital of France?\" This is a straightforward factual question. The answer: Paris. The user likely wants the answer. No policy issues. There's no disallowed content. Just answer with \"Paris\". Should be simple. Possibly also elaborate slightly. But answer is \"Paris\". Provide answer concisely."
          }
        ]
      },
      "finish_reason": "stop"
    }
  ],
  "created": 1780336093,
  "model": "MiniMax-M2.7",
  "object": "chat.completion",
  "usage": {
    "total_tokens": 126,
    "prompt_tokens": 48,
    "completion_tokens": 78,
    "total_characters": 0,
    "completion_tokens_details": {
      "reasoning_tokens": 70
    }
  },
  "input_sensitive": false,
  "output_sensitive": false,
  "base_resp": {
    "status_code": 0,
    "status_msg": ""
  },
  "input_sensitive_type": 0,
  "output_sensitive_type": 0,
  "output_sensitive_int": 0,
  "gatewayMetadata": {
    "keySource": "Unified"
  }
}

Examples

<details>

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

const response = await env.AI.run(
  'minimax/m2.7',
  {
    max_tokens: 2048,
    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' },
    ],
    temperature: 0.7,
  },
)
console.log(response)
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/m2.7",
  "max_tokens": 2048,
  "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"
    }
  ],
  "temperature": 0.7
}'
# Pasta Aglio e Olio

**Serves 2 | Prep: 5 min | Cook: 15 min**

## Ingredients
- 200g spaghetti
- 60ml extra virgin olive oil
- 4 garlic cloves, thinly sliced
- 1/2 tsp dried chili flakes
- Fresh parsley, chopped
- Salt to taste

## Method

1. **Cook pasta** in well-salted boiling water until al dente. Reserve 120ml pasta water before draining.

2. **Heat olive oil** in a large pan over medium-low heat. Add garlic slices.

3. **Gently cook** garlic for 2-3 minutes until golden (not brown). Add chili flakes.

4. **Add pasta** to the pan with 60ml pasta water. Toss vigorously for 2 minutes, adding more water if needed.

5. **Finish** with parsley and serve immediately.

## Tips
- Low heat is key—garlic burns quickly
- Use good quality olive oil
- The starchy water creates the silky sauce
{
  "id": "066cf8e09497cc6c53d2b14969cbe3d8",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "# Pasta Aglio e Olio\n\n**Serves 2 | Prep: 5 min | Cook: 15 min**\n\n## Ingredients\n- 200g spaghetti\n- 60ml extra virgin olive oil\n- 4 garlic cloves, thinly sliced\n- 1/2 tsp dried chili flakes\n- Fresh parsley, chopped\n- Salt to taste\n\n## Method\n\n1. **Cook pasta** in well-salted boiling water until al dente. Reserve 120ml pasta water before draining.\n\n2. **Heat olive oil** in a large pan over medium-low heat. Add garlic slices.\n\n3. **Gently cook** garlic for 2-3 minutes until golden (not brown). Add chili flakes.\n\n4. **Add pasta** to the pan with 60ml pasta water. Toss vigorously for 2 minutes, adding more water if needed.\n\n5. **Finish** with parsley and serve immediately.\n\n## Tips\n- Low heat is key—garlic burns quickly\n- Use good quality olive oil\n- The starchy water creates the silky sauce",
        "name": "MiniMax AI",
        "audio_content": "",
        "reasoning_content": "The user wants a simple pasta aglio e olio recipe. This is a classic Italian dish that's quick and uses few ingredients. I should provide concise instructions with metric measurements as requested.",
        "reasoning_details": [
          {
            "type": "reasoning.text",
            "id": "reasoning-text-1",
            "format": "MiniMax-response-v1",
            "index": 0,
            "text": "The user wants a simple pasta aglio e olio recipe. This is a classic Italian dish that's quick and uses few ingredients. I should provide concise instructions with metric measurements as requested."
          }
        ]
      },
      "finish_reason": "stop"
    }
  ],
  "created": 1780336096,
  "model": "MiniMax-M2.7",
  "object": "chat.completion",
  "usage": {
    "total_tokens": 297,
    "prompt_tokens": 41,
    "completion_tokens": 256,
    "total_characters": 0,
    "completion_tokens_details": {
      "reasoning_tokens": 41
    }
  },
  "input_sensitive": false,
  "output_sensitive": false,
  "base_resp": {
    "status_code": 0,
    "status_msg": ""
  },
  "input_sensitive_type": 0,
  "output_sensitive_type": 0,
  "output_sensitive_int": 0,
  "gatewayMetadata": {
    "keySource": "Unified"
  }
}

</details>

<details>

<summary>Multi-turn Conversation — Continuing a conversation with context</summary>

const response = await env.AI.run(
  'minimax/m2.7',
  {
    max_tokens: 2048,
    messages: [
      { content: 'What are the main differences between TCP and UDP?', role: 'user' },
      {
        content:
          'TCP is connection-oriented and guarantees delivery, while UDP is connectionless and faster but without delivery guarantees.',
        role: 'assistant',
      },
      { content: 'When would I choose UDP over TCP?', role: 'user' },
    ],
    temperature: 0.5,
  },
)
console.log(response)
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/m2.7",
  "max_tokens": 2048,
  "messages": [
    {
      "content": "What are the main differences between TCP and UDP?",
      "role": "user"
    },
    {
      "content": "TCP is connection-oriented and guarantees delivery, while UDP is connectionless and faster but without delivery guarantees.",
      "role": "assistant"
    },
    {
      "content": "When would I choose UDP over TCP?",
      "role": "user"
    }
  ],
  "temperature": 0.5
}'
UDP is preferred in situations where speed matters more than reliability. Here are common scenarios:

**Real-time applications**

- Video/audio streaming (Zoom, Skype, gaming)
- VoIP calls where slight packet loss is tolerable
- Live broadcasts

**Low-latency requirements**

- Online gaming
- Real-time financial trading
- Time-sensitive sensor data

**Simple query-response**

- DNS lookups (quick, fire-and-forget)
- DHCP
- NTP time synchronization

**Broadcast/Multicast**

- Service discovery (mDNS)
- IPTV streaming to multiple recipients

**Why not TCP in these cases?**

- TCP's retransmission and ordering can cause latency spikes
- Connection overhead adds delay
- Unnecessary for data that becomes stale quickly (old video frames)

**Trade-offs to consider**

- Application-level error handling may be needed
- You must handle packet loss, reordering, and duplicates yourself
- Some protocols layer reliability on top of UDP (QUIC, DNS over QUIC)

If you need guaranteed delivery and ordered data with no gaps, TCP remains the safer choice.
{
  "id": "066cf8e412153a383389e1601d684033",
  "choices": [
    {
      "index": 0,
      "message": {
        "role": "assistant",
        "content": "UDP is preferred in situations where speed matters more than reliability. Here are common scenarios:\n\n**Real-time applications**\n\n- Video/audio streaming (Zoom, Skype, gaming)\n- VoIP calls where slight packet loss is tolerable\n- Live broadcasts\n\n**Low-latency requirements**\n\n- Online gaming\n- Real-time financial trading\n- Time-sensitive sensor data\n\n**Simple query-response**\n\n- DNS lookups (quick, fire-and-forget)\n- DHCP\n- NTP time synchronization\n\n**Broadcast/Multicast**\n\n- Service discovery (mDNS)\n- IPTV streaming to multiple recipients\n\n**Why not TCP in these cases?**\n\n- TCP's retransmission and ordering can cause latency spikes\n- Connection overhead adds delay\n- Unnecessary for data that becomes stale quickly (old video frames)\n\n**Trade-offs to consider**\n\n- Application-level error handling may be needed\n- You must handle packet loss, reordering, and duplicates yourself\n- Some protocols layer reliability on top of UDP (QUIC, DNS over QUIC)\n\nIf you need guaranteed delivery and ordered data with no gaps, TCP remains the safer choice.",
        "name": "MiniMax AI",
        "audio_content": "",
        "reasoning_content": "The user is asking about when to choose UDP over TCP. This is a follow-up question about networking concepts. I should explain the use cases where UDP is preferable, such as real-time applications where slight data loss is acceptable, broadcasting, DNS queries, etc.\n\nLet me provide a clear, helpful answer about scenarios where UDP is the better choice.",
        "reasoning_details": [
          {
            "type": "reasoning.text",
            "id": "reasoning-text-1",
            "format": "MiniMax-response-v1",
            "index": 0,
            "text": "The user is asking about when to choose UDP over TCP. This is a follow-up question about networking concepts. I should explain the use cases where UDP is preferable, such as real-time applications where slight data loss is acceptable, broadcasting, DNS queries, etc.\n\nLet me provide a clear, helpful answer about scenarios where UDP is the better choice."
          }
        ]
      },
      "finish_reason": "stop"
    }
  ],
  "created": 1780336100,
  "model": "MiniMax-M2.7",
  "object": "chat.completion",
  "usage": {
    "total_tokens": 384,
    "prompt_tokens": 89,
    "completion_tokens": 295,
    "total_characters": 0,
    "completion_tokens_details": {
      "reasoning_tokens": 73
    }
  },
  "input_sensitive": false,
  "output_sensitive": false,
  "base_resp": {
    "status_code": 0,
    "status_msg": ""
  },
  "input_sensitive_type": 0,
  "output_sensitive_type": 0,
  "output_sensitive_int": 0,
  "gatewayMetadata": {
    "keySource": "Unified"
  }
}