MiniMax M2.7
Text Generation • MiniMaxMiniMax's M2.7 language model with multilingual capabilities.
| Model Info | |
|---|---|
| Context Window ↗ | 128,000 tokens |
| Terms and License | link ↗ |
| More information | link ↗ |
| Pricing | View pricing in the Cloudflare dashboard ↗ |
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
With System Prompt — Using a system prompt to guide behavior
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" }}Multi-turn Conversation — Continuing a conversation with context
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" }}Creative Writing — Higher temperature for creative output
const response = await env.AI.run( 'minimax/m2.7', { max_tokens: 2048, messages: [{ content: 'Write a haiku about programming.', role: 'user' }], temperature: 0.9, },)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": "Write a haiku about programming.", "role": "user" } ], "temperature": 0.9}'Code flows like water Logic weaves in silent streams Bugs fade in sunrise
{ "id": "066cf8eba419a621e81c91dd2899b9e6", "choices": [ { "index": 0, "message": { "role": "assistant", "content": "Code flows like water \nLogic weaves in silent streams \nBugs fade in sunrise", "name": "MiniMax AI", "audio_content": "", "reasoning_content": "The user asks: \"Write a haiku about programming.\" We need to respond with a haiku (5-7-5 syllable structure) about programming. No disallowed content. So simply produce a haiku. Perhaps a nice one. Let's think.\n\nDefinition: Haiku is a short poem with three lines: first line five syllables, second line seven syllables, third line five syllables. Must convey something about programming. Let's craft a haiku.\n\nPossible lines:\n\nLine1: \"Code flows like water\" (Count syllables: Code(1) flows(1) like(1) wa(1) ter(1) -> \"water\" is two syllables: wa-ter = 2, so total = 1+1+1+2 =5) Actually: \"Code flows like water\": Co-de (2) flows (1) like (1) wa-ter (2) = total 6? Let's count: \"Code\" is one syllable? Actually \"code\" is one syllable. So \"Code flows like water\": Code (1) flows (1) like (1) water (2) = total 5. Wait: Code = 1, flows = 1, like = 1, water = 2 => total = 5. Yes. So line1 is 5.\n\nLine2: \"Logic weaves in silent streams\" Count: Logic (2) weaves (1) in (1) si-lent (2) streams (1) = total = 2+1+1+2+1=7. Yes, 7.\n\nLine3: \"Bugs fade in sunrise\" Count: Bugs (1) fade (1) in (1) sun-rise (2) = total =5? Actually \"sunrise\" is two syllables: sun-rise. So Bugs (1) fade (1) in (1) sun-rise (2) = 5. Yes.\n\nAlternatively something about \"silicon dreams\" etc.\n\nMake sure we follow haiku structure: 5-7-5 syllables. Let's double-check.\n\nHaiku about programming:\n\nLine1: \"Code flows like water\" (5)\nLine2: \"Logic weaves in silent streams\" (7)\nLine3: \"Bugs fade in sunrise\" (5)\n\nAll good.\n\nAlternatively: \"Silent code compiles\" (5? Count: Si-lent (2) code (1) com-piles (2) =5) But it's okay.\n\nOk let's produce a haiku: maybe:\n\n\"Silicon sighs at night,\nfunctions dance in bright loops,\nbugs dissolve in dawn.\" Let's count.\n\nLine1: \"Silicon sighs at night\" Count: Si-li-con (3) sighs (1) at (1) night (1) =6? Actually \"silicon\" is three syllables: Si-li-con. sighs=1, at=1, night=1 => total = 3+1+1+1=6. Too many.\n\nMaybe \"Silicon sighs at dusk\" Count: Si-li-con (3) sighs (1) at (1) dusk (1) =6.\n\nOk not that.\n\nBetter to go with first attempt.\n\nMaybe \"Infinite loops at night\" Count: In-fi-nite (3) loops (1) at (1) night (1) =6.\n\nThus keep original.\n\nCheck:\n\nLine1: Code flows like water (5)\nLine2: Logic weaves in silent streams (7)\nLine3: Bugs fade in sunrise (5)\n\nBetter ensure second line count: Logic (2) weaves (1) in (1) silent (2) streams (1) =2+1+1+2+1=7.\n\nThird line: Bugs (1) fade (1) in (1) sunrise (2) =5.\n\nThus ok.\n\nOne could also add a title? The user only asked to write a haiku. So just output the haiku.\n\nThus final answer: the haiku.\n\nMake sure not to have any extra commentary beyond the haiku? The user just asked for a haiku. Typically we can output just the poem. Might add a short line like \"Here's a haiku:\" but that's extra. Safer to just output the poem.\n\nThus final.", "reasoning_details": [ { "type": "reasoning.text", "id": "reasoning-text-1", "format": "MiniMax-response-v1", "index": 0, "text": "The user asks: \"Write a haiku about programming.\" We need to respond with a haiku (5-7-5 syllable structure) about programming. No disallowed content. So simply produce a haiku. Perhaps a nice one. Let's think.\n\nDefinition: Haiku is a short poem with three lines: first line five syllables, second line seven syllables, third line five syllables. Must convey something about programming. Let's craft a haiku.\n\nPossible lines:\n\nLine1: \"Code flows like water\" (Count syllables: Code(1) flows(1) like(1) wa(1) ter(1) -> \"water\" is two syllables: wa-ter = 2, so total = 1+1+1+2 =5) Actually: \"Code flows like water\": Co-de (2) flows (1) like (1) wa-ter (2) = total 6? Let's count: \"Code\" is one syllable? Actually \"code\" is one syllable. So \"Code flows like water\": Code (1) flows (1) like (1) water (2) = total 5. Wait: Code = 1, flows = 1, like = 1, water = 2 => total = 5. Yes. So line1 is 5.\n\nLine2: \"Logic weaves in silent streams\" Count: Logic (2) weaves (1) in (1) si-lent (2) streams (1) = total = 2+1+1+2+1=7. Yes, 7.\n\nLine3: \"Bugs fade in sunrise\" Count: Bugs (1) fade (1) in (1) sun-rise (2) = total =5? Actually \"sunrise\" is two syllables: sun-rise. So Bugs (1) fade (1) in (1) sun-rise (2) = 5. Yes.\n\nAlternatively something about \"silicon dreams\" etc.\n\nMake sure we follow haiku structure: 5-7-5 syllables. Let's double-check.\n\nHaiku about programming:\n\nLine1: \"Code flows like water\" (5)\nLine2: \"Logic weaves in silent streams\" (7)\nLine3: \"Bugs fade in sunrise\" (5)\n\nAll good.\n\nAlternatively: \"Silent code compiles\" (5? Count: Si-lent (2) code (1) com-piles (2) =5) But it's okay.\n\nOk let's produce a haiku: maybe:\n\n\"Silicon sighs at night,\nfunctions dance in bright loops,\nbugs dissolve in dawn.\" Let's count.\n\nLine1: \"Silicon sighs at night\" Count: Si-li-con (3) sighs (1) at (1) night (1) =6? Actually \"silicon\" is three syllables: Si-li-con. sighs=1, at=1, night=1 => total = 3+1+1+1=6. Too many.\n\nMaybe \"Silicon sighs at dusk\" Count: Si-li-con (3) sighs (1) at (1) dusk (1) =6.\n\nOk not that.\n\nBetter to go with first attempt.\n\nMaybe \"Infinite loops at night\" Count: In-fi-nite (3) loops (1) at (1) night (1) =6.\n\nThus keep original.\n\nCheck:\n\nLine1: Code flows like water (5)\nLine2: Logic weaves in silent streams (7)\nLine3: Bugs fade in sunrise (5)\n\nBetter ensure second line count: Logic (2) weaves (1) in (1) silent (2) streams (1) =2+1+1+2+1=7.\n\nThird line: Bugs (1) fade (1) in (1) sunrise (2) =5.\n\nThus ok.\n\nOne could also add a title? The user only asked to write a haiku. So just output the haiku.\n\nThus final answer: the haiku.\n\nMake sure not to have any extra commentary beyond the haiku? The user just asked for a haiku. Typically we can output just the poem. Might add a short line like \"Here's a haiku:\" but that's extra. Safer to just output the poem.\n\nThus final." } ] }, "finish_reason": "stop" } ], "created": 1780336107, "model": "MiniMax-M2.7", "object": "chat.completion", "usage": { "total_tokens": 936, "prompt_tokens": 48, "completion_tokens": 888, "total_characters": 0, "completion_tokens_details": { "reasoning_tokens": 872 } }, "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" }}Parameters
mask_sensitive_info
booleanmax_completion_tokens
numberexclusiveMinimum: 0max_tokens
numberexclusiveMinimum: 0▶messages[]
arrayrequired▶response_format{}
objectstream
boolean▶stream_options{}
objecttemperature
numbermaximum: 1minimum: 0tool_choice
stringenum: none, auto▶tools[]
arraytop_p
numbermaximum: 1minimum: 0▶base_resp{}
object▶choices[]
arraycreated
numberid
stringinput_sensitive
booleanmodel
stringobject
stringenum: chat.completion, chat.completion.chunkoutput_sensitive
boolean▶usage{}
object