MiniMax Tools
This skill provides access to MiniMax's AI capabilities, including web search, image analysis, LLM conversations, and text translation.
Setup
First, set up your API key:
CODEBLOCK0
To get an API key, sign up at https://platform.minimaxi.com/subscribe/coding-plan
Optionally, you can customize the API endpoint:
CODEBLOCK1
CLI Commands
CODEBLOCK2
Commands Overview
| Command | What it does |
|---|
| INLINECODE0 | Search the web using MiniMax's search API |
| INLINECODE1 |
Analyze images using MiniMax's vision model |
|
chat | Have a conversation with MiniMax LLMs |
|
stream_chat | Stream chat with real-time response chunks |
|
translate | Translate text between languages |
|
models | Show all available MiniMax models |
CLI Examples
CODEBLOCK3
Using in Python
Web Search
CODEBLOCK4
Image Analysis
CODEBLOCK5
LLM Chat
CODEBLOCK6
Parameters:
- -
message (str): User message - INLINECODE7 (str, optional): System prompt
- INLINECODE8 (str, default: "MiniMax-M2.7"): Model name
- INLINECODE9 (float, default: 1.0): Temperature parameter, range (0.0, 1.0]
- INLINECODE10 (int, default: 4096): Max tokens to generate
- INLINECODE11 (bool, default: False): Enable streaming response
- INLINECODE12 (list, optional): History list for multi-turn conversation, each message INLINECODE13
Streaming Chat
CODEBLOCK7
Translation
CODEBLOCK8
Parameters:
- -
text (str): Text to translate - INLINECODE15 (str, default: "English"): Target language, e.g., "English", "Chinese", "Japanese"
- INLINECODE16 (str, default: "auto"): Source language, "auto" for auto-detect
- INLINECODE17 (str, default: "MiniMax-M2.7"): Model name
- INLINECODE18 (float, default: 1.0): Temperature parameter, range (0.0, 1.0]
- INLINECODE19 (int, default: 4096): Max tokens to generate
Response Format
All functions return a consistent response format:
Success:
CODEBLOCK9
Error:
CODEBLOCK10
Learn More
MiniMax 工具
本技能提供对 MiniMax AI 功能的访问,包括网络搜索、图像分析、大语言模型对话和文本翻译。
设置
首先,设置您的 API 密钥:
bash
export MINIMAXAPIKEY=your-api-key
要获取 API 密钥,请访问 https://platform.minimaxi.com/subscribe/coding-plan 注册
您也可以自定义 API 端点:
bash
export MINIMAXAPIHOST=https://api.minimaxi.com/anthropic
CLI 命令
bash
搜索网络
python -m scripts web_search 您的搜索查询
分析图像
python -m scripts understand_image 您看到了什么? /path/to/image.jpg
与大语言模型对话
python -m scripts chat 你好,最近怎么样?
流式对话(分块接收响应)
python -m scripts stream_chat 给我讲个故事
翻译文本
python -m scripts translate hello world --to Chinese
列出可用模型
python -m scripts models
命令概览
| 命令 | 功能说明 |
|---|
| websearch | 使用 MiniMax 的搜索 API 搜索网络 |
| understandimage |
使用 MiniMax 的视觉模型分析图像 |
| chat | 与 MiniMax 大语言模型进行对话 |
| stream_chat | 流式对话,实时分块接收响应 |
| translate | 在不同语言之间翻译文本 |
| models | 显示所有可用的 MiniMax 模型 |
CLI 示例
bash
搜索网络
python -m scripts web_search 您的搜索查询
分析图像
python -m scripts understand_image 您看到了什么? /path/to/image.jpg
与大语言模型对话
python -m scripts chat 你好,最近怎么样?
流式对话(分块接收响应)
python -m scripts stream_chat 给我讲个故事
翻译文本
python -m scripts translate hello world --to Chinese
列出可用模型
python -m scripts models
在 Python 中使用
网络搜索
python
from scripts import web_search
result = web_search(Python 最佳实践, count=10)
print(result)
图像分析
python
from scripts import understand_image
从本地文件
result = understand_image(这张图片里有什么?, /path/to/image.png)
从 URL
result = understand_image(描述这张图片, https://example.com/image.jpg)
大语言模型对话
python
from scripts import chat
result = chat(
message=你好,请介绍一下你自己,
system=你是一个乐于助人的 AI 助手,
model=MiniMax-M2.7,
temperature=1.0,
max_tokens=4096,
stream=False,
history=[
{role: user, content: 你好},
{role: assistant, content: 你好!有什么可以帮助你的吗?}
]
)
参数说明:
- - message (str):用户消息
- system (str, 可选):系统提示词
- model (str, 默认:MiniMax-M2.7):模型名称
- temperature (float, 默认:1.0):温度参数,范围 (0.0, 1.0]
- max_tokens (int, 默认:4096):最大生成令牌数
- stream (bool, 默认:False):启用流式响应
- history (list, 可选):多轮对话的历史记录列表,每条消息格式为 {role: user/assistant, content: ...}
流式对话
python
from scripts import stream_chat
result = stream_chat(
message=给我讲一个短故事,
system=你是一个讲故事的人,
model=MiniMax-M2.7,
temperature=1.0,
max_tokens=500
)
访问流式分块
if result[success]:
chunks = result[result][chunks]
full_content = result[result][content]
print(f总分块数:{len(chunks)})
print(f完整内容:{full_content})
翻译
python
from scripts import translate
result = translate(
text=Hello World,
target_lang=Chinese,
source_lang=auto,
model=MiniMax-M2.7,
temperature=1.0,
max_tokens=4096
)
参数说明:
- - text (str):要翻译的文本
- targetlang (str, 默认:English):目标语言,例如 English、Chinese、Japanese
- sourcelang (str, 默认:auto):源语言,auto 表示自动检测
- model (str, 默认:MiniMax-M2.7):模型名称
- temperature (float, 默认:1.0):温度参数,范围 (0.0, 1.0]
- max_tokens (int, 默认:4096):最大生成令牌数
响应格式
所有函数返回一致的响应格式:
成功:
json
{
success: true,
result: {...}
}
错误:
json
{
success: false,
error: 错误信息
}
了解更多