Skip to content
Docs
MiniMax logo

MiniMax M2.7

Text GenerationMiniMax

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',
{ max_tokens: 2048, messages: [{ content: 'What is the capital of France?', role: 'user' }] },
)
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',
{
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)
# 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
Multi-turn Conversation — Continuing a conversation with context
TypeScript
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)
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.
Creative Writing — Higher temperature for creative output
TypeScript
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)
Code flows like water  
Logic weaves in silent streams  
Bugs fade in sunrise

Parameters

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

API Schemas (Raw)

Input
Output