Loading...
Loading...
MiniMax API via curl. Use this skill for Chinese LLM chat, text-to-speech, and AI video generation.
npx skill4agent add vm0-ai/vm0-skills minimaxcurlOfficial docs:https://platform.minimax.io/docs
api.minimaxi.chatexport MINIMAX_API_KEY="your-api-key"| Region | Base URL |
|---|---|
| China | |
| Global | |
Important: When usingin a command that pipes to another command, wrap the command containing$VARin$VAR. Due to a Claude Code bug, environment variables are silently cleared when pipes are used directly.bash -c '...'bashbash -c 'curl -s "https://api.example.com" -H "Authorization: Bearer $API_KEY"'
MINIMAX_API_KEYAuthorization/tmp/minimax_request.json{
"model": "MiniMax-Text-01",
"messages": [
{"role": "system", "content": "You are a helpful assistant."},
{"role": "user", "content": "Hello, who are you?"}
]
}bash -c 'curl -s "https://api.minimax.io/v1/text/chatcompletion_v2" -X POST -H "Authorization: Bearer ${MINIMAX_API_KEY}" -H "Content-Type: application/json" -d @/tmp/minimax_request.json' | jq '.choices[0].message.content'MiniMax-M2MiniMax-M1MiniMax-Text-01/tmp/minimax_request.json{
"model": "MiniMax-Text-01",
"messages": [
{"role": "user", "content": "Write a short poem about AI."}
],
"temperature": 0.7,
"max_tokens": 200
}bash -c 'curl -s "https://api.minimax.io/v1/text/chatcompletion_v2" -X POST -H "Authorization: Bearer ${MINIMAX_API_KEY}" -H "Content-Type: application/json" -d @/tmp/minimax_request.json' | jq '.choices[0].message.content'temperaturetop_pmax_tokens/tmp/minimax_request.json{
"model": "MiniMax-M1",
"messages": [
{"role": "user", "content": "Explain quantum computing."}
],
"stream": true
}curl -s "https://api.minimax.io/v1/text/chatcompletion_v2" -X POST -H "Authorization: Bearer ${MINIMAX_API_KEY}" -H "Content-Type: application/json" -d @/tmp/minimax_request.json/tmp/minimax_request.json{
"model": "MiniMax-M1",
"messages": [
{"role": "user", "content": "Solve step by step: A train travels 120km in 2 hours. What is its average speed in m/s?"}
],
"stream": true
}curl -s "https://api.minimax.io/v1/text/chatcompletion_v2" -X POST -H "Authorization: Bearer ${MINIMAX_API_KEY}" -H "Content-Type: application/json" -d @/tmp/minimax_request.jsonreasoning_content/tmp/minimax_request.json{
"model": "speech-02-hd",
"text": "Hello, this is a test of MiniMax text to speech.",
"voice_id": "male-qn-qingse",
"speed": 1.0,
"format": "mp3"
}curl -s "https://api.minimax.io/v1/t2a_v2" -X POST -H "Authorization: Bearer ${MINIMAX_API_KEY}" -H "Content-Type: application/json" -d @/tmp/minimax_request.json --output speech.mp3/tmp/minimax_request.json{
"model": "speech-02-hd",
"text": "I am so happy to meet you today!",
"voice_id": "female-shaonv",
"emotion": "happy",
"speed": 1.0,
"format": "mp3"
}curl -s "https://api.minimax.io/v1/t2a_v2" -X POST -H "Authorization: Bearer ${MINIMAX_API_KEY}" -H "Content-Type: application/json" -d @/tmp/minimax_request.json --output happy_speech.mp3happysadangryfearfuldisgustedsurprisedneutral/tmp/minimax_request.json{
"model": "speech-02-hd",
"text": "High quality audio test.",
"voice_id": "male-qn-qingse",
"speed": 1.0,
"vol": 1.0,
"pitch": 0,
"audio_sample_rate": 32000,
"bitrate": 128000,
"format": "mp3"
}curl -s "https://api.minimax.io/v1/t2a_v2" -X POST -H "Authorization: Bearer ${MINIMAX_API_KEY}" -H "Content-Type: application/json" -d @/tmp/minimax_request.json --output hq_speech.mp3speech-02-hdspeech-02-turbospeech-01-hdspeech-01-turbo/tmp/minimax_request.json{
"model": "T2V-01-Director",
"prompt": "A cat playing with a ball of yarn [Static shot].",
"duration": 6,
"resolution": "1080P"
}bash -c 'curl -s "https://api.minimax.io/v1/video_generation" -X POST -H "Authorization: Bearer ${MINIMAX_API_KEY}" -H "Content-Type: application/json" -d @/tmp/minimax_request.json' | jq '.task_id'/tmp/minimax_request.json{
"model": "MiniMax-Hailuo-2.3",
"prompt": "A person walking through a forest [Tracking shot], then stops to look at a bird [Push in].",
"duration": 6,
"resolution": "1080P"
}bash -c 'curl -s "https://api.minimax.io/v1/video_generation" -X POST -H "Authorization: Bearer ${MINIMAX_API_KEY}" -H "Content-Type: application/json" -d @/tmp/minimax_request.json' | jq '.task_id'Truck left/rightPan left/rightPush in/Pull outPedestal up/downTilt up/downZoom in/outShakeTracking shotStatic shot[Pan left, Pedestal up]Note: For I2V, useorMiniMax-Hailuo-2.3model which supportsS2V-01. Thefirst_frame_imagemodel is text-to-video only.T2V-01-Director
/tmp/minimax_request.json{
"model": "MiniMax-Hailuo-2.3",
"prompt": "The scene comes to life with gentle movement [Static shot].",
"first_frame_image": "https://example.com/image.jpg",
"duration": 6,
"resolution": "1080P"
}bash -c 'curl -s "https://api.minimax.io/v1/video_generation" -X POST -H "Authorization: Bearer ${MINIMAX_API_KEY}" -H "Content-Type: application/json" -d @/tmp/minimax_request.json' | jq '.task_id'first_frame_image/tmp/minimax_request.json{
"model": "MiniMax-Text-01",
"messages": [
{"role": "user", "content": "What is the weather in Beijing?"}
],
"tools": [
{
"type": "function",
"function": {
"name": "get_weather",
"description": "Get weather for a location",
"parameters": {
"type": "object",
"properties": {
"location": {"type": "string", "description": "City name"}
},
"required": ["location"]
}
}
}
],
"tool_choice": "auto"
}bash -c 'curl -s "https://api.minimax.io/v1/text/chatcompletion_v2" -X POST -H "Authorization: Bearer ${MINIMAX_API_KEY}" -H "Content-Type: application/json" -d @/tmp/minimax_request.json' | jq '.choices[0]'{
"id": "string",
"choices": [{
"message": {
"role": "assistant",
"content": "Response text",
"reasoning_content": "Thought process (M1/M2 only)"
},
"finish_reason": "stop"
}],
"usage": {
"prompt_tokens": 10,
"completion_tokens": 50,
"total_tokens": 60
}
}api.minimax.ioapi.minimaxi.chatstream: true[brackets]speech-02-*speech-01-*