为小米MiMo-V2.5 AI模型打造的轻量级命令行工具
MiMo CLI Toolkit是一个专为开发者设计的命令行工具,让您能够在终端中轻松调用强大的小米MiMo-V2.5 AI模型。无论是代码生成、文档翻译还是智能问答,只需一行命令即可完成。
🚀 开箱即用 - 5分钟完成安装配置,立即开始使用 🔧 配置灵活 - 支持命令行参数、环境变量、配置文件多种方式 💻 跨平台 - Windows、Linux、macOS全面支持 🛡️ 安全可靠 - API密钥从环境变量读取,避免泄露风险 📁 文件支持 - 支持从文件读取输入,方便批量处理 🎭 演示模式 - 内置Mock响应,无需API密钥即可测试 📊 完整日志 - 详细的日志输出,便于调试和问题排查
- 填补空白 - MiMo生态首个命令行工具,降低使用门槛
- 效率提升 - 无需打开浏览器或编写复杂代码,终端直接调用
- 学习友好 - 内置Mock模式,零成本学习MiMo API使用
- 扩展性强 - 模块化设计,轻松添加新功能
专为以下场景设计:
- 🔍 快速测试MiMo模型的各项能力
- 💻 自动化脚本集成AI功能
- 📚 教育和演示用途
- 🛠️ 开发者工具链集成
- Java 11 或更高版本
- Maven 3.6 或更高版本(用于构建)
- MiMo API密钥(可选,用于实际API调用)
-
克隆项目到本地
git clone https://github.com/liaozhe789/mimo-cli-toolkit.git cd mimo-cli-toolkit -
构建项目
mvn clean package
-
运行应用
# 使用生成的JAR文件 java -jar target/mimo-cli-1.0.0.jar "你好,MiMo!"
Try the simplified version immediately:
# 1. Clone the repository
git clone https://github.com/liaozhe789/mimo-cli-toolkit.git
cd mimo-cli-toolkit
# 2. Compile the simplified version
javac -d target SimplifiedMain.java
# 3. Run a quick demo
java -cp target SimplifiedMain --version
java -cp target SimplifiedMain "Explain MiMo CLI"
java -cp target SimplifiedMain "Write a Java program"For the complete version with all features:
# Using Maven (recommended)
mvn clean package
java -jar target/mimo-cli-1.0.0.jar --help
# Or use the provided scripts
./run.bat "Your prompt here" # Windows
./run.sh "Your prompt here" # Linux/macOS# Simple text generation
mimo-cli "Write a Java Hello World program"
# With parameters
mimo-cli --model v2.5 --max-tokens 1000 "Explain quantum computing"
# Adjust temperature
mimo-cli --temperature 0.3 "Translate 'Hello world' to Chinese"
# Read from file
mimo-cli --file input.txt# 显示帮助信息
mimo-cli --help
# 显示版本信息
mimo-cli --version
# 指定模型版本
mimo-cli --model v2.5 "你的提示词"
# 限制生成token数量
mimo-cli --max-tokens 500 "你的提示词"
# 调整生成温度(0.0-1.0)
mimo-cli --temperature 0.8 "你的提示词"
# 从文件读取提示词
mimo-cli --file prompt.txtUsage: mimo-cli [OPTIONS] PROMPT
-h, --help Show this help message
-v, --version Show version information
-m, --model MODEL MiMo model version (default: v2.5)
-t, --max-tokens TOKENS Maximum tokens to generate (default: 500)
-e, --temperature VALUE Temperature for generation (default: 0.7)
-
Get your MiMo API key from the MiMo developer portal.
-
Set as environment variable:
# On Linux/macOS export MIMO_API_KEY=your_api_key_here # On Windows set MIMO_API_KEY=your_api_key_here
-
Or create a configuration file (
mimo-cli.properties):api.key=your_api_key_here api.url=https://api.mimo.ai/v1/chat/completions model.default=v2.5 max.tokens.default=500 temperature.default=0.7
The CLI looks for configuration in this order:
- Environment variables
mimo-cli.propertiesin current directory~/.config/mimo-cli/mimo-cli.properties- Default values
mimo-cli/
├── src/main/java/com/mimo/cli/
│ ├── Main.java # Entry point
│ ├── MiMoClient.java # API client
│ └── Config.java # Configuration manager
├── pom.xml # Maven configuration
└── README.md # This file
# Compile
mvn compile
# Run tests
mvn test
# Create executable JAR
mvn clean package
# Run with Maven
mvn exec:java -Dexec.mainClass="com.mimo.cli.Main" -Dexec.args="Your prompt here"The project includes mock mode for testing without an API key:
# The CLI will use mock responses when no API key is set
java -jar target/mimo-cli-1.0.0.jar "Test prompt"# 生成Java代码
mimo-cli "写一个Java函数,计算两个数字的和"
# 生成Python代码
mimo-cli "写一个Python函数,计算斐波那契数列"
# 生成SQL查询
mimo-cli "写一个SQL查询,获取用户表中最近7天注册的用户"# 中文翻译
mimo-cli "将'Hello, how are you?'翻译成中文"
# 文本摘要
mimo-cli --max-tokens 200 "总结这篇关于人工智能的文章"
# 文本改写
mimo-cli "将这段文字改写得更加正式:'这个产品很好用,推荐购买'"# 解释技术概念
mimo-cli "解释什么是RESTful API"
# 解决编程问题
mimo-cli "Java中如何优雅地处理空指针异常?"
# 学习建议
mimo-cli "给Java初学者推荐学习路线"# 从文件读取提示词
mimo-cli --file requirements.txt "根据这个需求文档生成测试用例"
# 批量处理(结合shell)
for file in prompts/*.txt; do
mimo-cli --file "$file" > "outputs/$(basename $file)"
done-
"MIMO_API_KEY environment variable is not set"
- Solution: Set the API key as shown in the setup section
-
Connection timeout
- Solution: Check your internet connection and firewall settings
- You can increase timeout in configuration
-
API returns error
- Solution: Verify your API key is valid and has sufficient credits
Enable debug logging to see detailed information:
# Set environment variable
export MIMO_DEBUG=true
# Or add to configuration file
debug.mode=trueContributions are welcome! Here's how you can help:
- Fork the repository
- Create a feature branch
- Make your changes
- Submit a pull request
- Follow Java coding conventions
- Add unit tests for new features
- Update documentation accordingly
- Ensure backward compatibility
This project is licensed under the MIT License - see the LICENSE file for details.
- Thanks to the MiMo team for creating the amazing MiMo-V2.5 model
- Built with Apache Commons CLI, HttpClient, and Jackson
- Inspired by the need for simple AI command-line tools
- Add support for file input/output
- Implement batch processing mode
- Add streaming response support
- Create installation script for package managers
- Add more configuration options
- Support for different API endpoints
- Report bugs: GitHub Issues
- Ask questions: Discussions
- Request features: Feature Requests
Happy coding with MiMo! 🚀