ai-renamer is a Node.js command-line tool designed to automatically rename files based on their content using artificial intelligence technology. It uses local large language models provided by Ollama or LM Studio (such as Llava, Gemma, Llama, etc.) to analyze file content and generate more appropriate filenames.
Main Capabilities
- Intelligent renaming: automatically generates descriptive filenames based on file content (such as images and videos).
- Multi-model support: compatible with multiple LLMs in Ollama and LM Studio, including Llava, Gemma, Llama, etc.
- Multiple providers: uses Ollama by default, and can also be configured for LM Studio or OpenAI.
- Automatic model selection: on first launch, it automatically tries to select the Llava model; for LM Studio, it automatically selects the loaded model; for OpenAI, it automatically selects the gpt-4o model.
- Configuration persistence: parameters set via command-line flags are saved to ~/ai-renamer.json (on Mac, /Users/your-user-name/ai-renamer.json), so they do not need to be set repeatedly later.
- Custom ports: if Ollama or LM Studio uses a non-default port, a base URL can be specified.
- Letter case style: uses the change-case library to handle the letter case style of filenames.
Usage
- Ensure that Ollama or LM Studio is installed on the system, and that at least one LLM is installed (such as Llava, Gemma, Llama, etc.). If videos need to be renamed, ffmpeg must also be installed.
- Run via npx:
npx ai-renamer /images. On first launch, it automatically selects the Llava model; if that fails, a model can be specified manually. - Using LM Studio: set the provider to
lm-studio, and the tool will automatically select the loaded model in LM Studio. - Using OpenAI: set the provider to
openaiand provide an API key; the tool will automatically select the gpt-4o model, and other models can also be specified via the--modelflag. - Custom ports: specify the address of Ollama or LM Studio via the base URL parameter.
- Configuration saving: used flag values are saved to disk and automatically read on subsequent runs.
Applicable Scenarios
- Organizing large numbers of image or video files and needing to generate meaningful filenames based on content.
- Local privacy-sensitive scenarios, using Ollama or LM Studio to run models locally.
- Wanting to use cloud models such as OpenAI for file renaming.
Limitations
- Ollama or LM Studio and at least one LLM must be installed in advance.
- Renaming videos requires additional installation of ffmpeg.
- Using OpenAI requires providing an API key and may incur costs (specific costs not provided).
- The tool is a command-line interface with no graphical interface; the desktop app requires visiting airenamer.app (detailed information not provided).
- Model effectiveness depends on the capabilities of the selected LLM; specific accuracy or performance data is not provided.