Skip to content

Latest commit

 

History

History
130 lines (98 loc) · 3.36 KB

File metadata and controls

130 lines (98 loc) · 3.36 KB
name minimax-use
version 0.2.0
description MiniMax AI tools for Node.js - chat, image understanding, translation, web search. Use when you need LLM capabilities with MiniMax models.
metadata
openclaw
requires primaryEnv os
env
MINIMAX_API_KEY
MINIMAX_API_KEY
linux
darwin
win32

MiniMax Use - Node.js AI Tools

MiniMax AI 工具集,提供对话、图像理解、翻译、搜索等功能。Node.js 实现。

统一接口(与其他 provider 接口一致)

import { chat, translate, understandImage, webSearch } from 'minimax-use/scripts/index.js';

// 对话
await chat('你好');                              // 简单对话
await chat('写代码', { model: 'MiniMax-M2.7' });  // 指定模型
await chat('继续', { history: [{role:'user',content:'你好'}] }); // 带历史

// 图像理解
await understandImage('图片里有什么?', '/path/to/image.jpg');
await understandImage('描述这张图', 'https://example.com/image.jpg');

// 翻译
await translate('hello', { to: 'Chinese' });
await translate('你好', { to: 'English', from: 'zh' });

// 搜索
await webSearch('今日新闻');

返回格式

// 成功
{ success: true, result: { content: '...' } }

// 失败
{ success: false, error: 'error message' }

CLI 用法

# 对话
node scripts/index.js chat "你好"

# 图像理解
node scripts/index.js image "描述图片" /path/to/image.jpg

# 翻译
node scripts/index.js translate "hello" --to Chinese

# 搜索
node scripts/index.js search "news"

环境变量

变量 默认值 说明
MINIMAX_API_KEY - 必填,API Key
MINIMAX_API_HOST https://api.minimaxi.com/anthropic API 端点
MINIMAX_MODEL MiniMax-M2.7 对话模型
MINIMAX_VISION_MODEL MiniMax-M2.7 视觉模型

获取 API Key: https://platform.minimaxi.com

函数签名

chat(message, opts)

参数 类型 默认值 说明
message string - 用户消息
opts.system string null 系统提示
opts.model string MiniMax-M2.7 模型名
opts.temperature number 1.0 温度 0-1
opts.max_tokens number 4096 最大 token
opts.stream boolean false 流式输出
opts.history array null 历史记录

understandImage(prompt, imagePath, opts)

参数 类型 默认值 说明
prompt string - 关于图片的问题
imagePath string - 图片路径或 URL
opts.model string MiniMax-M2.7 视觉模型
opts.temperature number 0.3 温度
opts.max_tokens number 300 最大 token

translate(text, opts)

参数 类型 默认值 说明
text string - 待翻译文本
opts.to string English 目标语言
opts.from string auto 源语言
opts.model string MiniMax-M2.7 模型名

webSearch(query, opts)

参数 类型 默认值 说明
query string - 搜索查询
opts.count number 10 结果数量

安装依赖

cd ~/workspace/skills/minimax-use
npm install

注意

  • MiniMax 视觉 API 可能不稳定(曾遇到 413 Request Entity Too Large)
  • 建议上传图片前先压缩