Skip to content
MiniMax logo

MiniMax M2.7

Text GenerationMiniMaxProxied

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

Model Info
Context Window128,000 tokens
Terms and Licenselink
More informationlink
PricingView pricing in the Cloudflare dashboard

Usage

TypeScript
const response = await env.AI.run(
'minimax/m2.7',
{
messages: [
{
role: 'user',
content: 'What is the capital of France?',
},
],
max_tokens: 2048,
},
{
gateway: { id: 'default' },
}
)
console.log(response)
The capital of France is Paris.

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?',
},
],
temperature: 0.7,
max_tokens: 2048,
},
{
gateway: { id: 'default' },
}
)
console.log(response)
# Pasta Aglio e Olio

**Ingredients (2 servings):**

- 200g spaghetti
- 80ml extra virgin olive oil
- 6 garlic cloves, thinly sliced
- 1 tsp chili flakes (optional)
- Fresh parsley, chopped
- Salt to taste

**Method:**

1. Cook spaghetti in well-salted boiling water until al dente. Reserve 120ml pasta water.
2. Heat olive oil in a pan over low-medium heat. Add garlic and chili flakes.
3. Cook gently 2-3 minutes until garlic is golden (don't brown it).
4. Add drained pasta to the pan. Toss with pasta water to create a light sauce.
5. Finish with parsley and serve immediately.

**Tips:**

- Low heat is key—garlic burns easily
- Pasta water starches help the sauce cling to the noodles
- Best served immediately
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?',
},
],
temperature: 0.5,
max_tokens: 2048,
},
{
gateway: { id: 'default' },
}
)
console.log(response)
Choose UDP over TCP when:

1. **Real-time performance matters more than reliability**
   - Video/audio streaming
   - VoIP calls
   - Online gaming

2. **Broadcasting or multicasting is needed**
   - UDP supports these natively; TCP doesn't

3. **Low latency is critical**
   - Live sports streams
   - Financial market data feeds

4. **The application handles its own reliability**
   - QUIC protocol (used by HTTP/3)
   - Custom protocols with built-in error handling

5. **Simple request/response where loss is tolerable**
   - DNS queries (most use UDP)

6. **Message sizes are small and frequent**
   - Connection overhead would outweigh benefits

**Bottom line:** If a dropped packet is preferable to a delayed packet, UDP is likely the better choice.
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.',
},
],
temperature: 0.9,
max_tokens: 2048,
},
{
gateway: { id: 'default' },
}
)
console.log(response)
Code streams like soft rain  
loops and functions cascade on  
bugs fade into light

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

Input
Output