CivitAI-CLI: Streamlined Access to CivitAI Models
The CivitAI-CLI is a command-line interface tool crafted to enhance user interactions with the CivitAI API. Its primary goal is to simplify the processes of listing, displaying, fetching, and downloading models available on CivitAI.
Key Features of CivitAI-CLI:
-
Efficient Interactions: CivitAI-CLI provides a user-friendly approach, eliminating the complexities of manual API endpoint handling. Easily fetch, list, and download models straight from your terminal.
-
Optimized Visual Experience with
viu
: The tool leveragesviu
for image rendering, offering improved visual feedback in terminals such as iTerm2 and Kitty. For those on alternative terminals, an ANSI display is available to ensure consistent user experience. -
Enhanced Functionality with an API Key: While CivitAI-CLI is versatile without an API key, possessing one grants access to an extended array of features.
The Genesis of CivitAI-CLI:
Developed out of a specific need to download models on remote servers via SSH, especially for servers running stable diffusion systems, the CivitAI-CLI addresses this niche requirement, ensuring efficient access to CivitAI's models regardless of the user's location.
CivitAI may house a myriad of models, ranging from the academically serious to the more leisurely. However, the CivitAI-CLI aims to be a tool of choice for anyone seeking a streamlined interface to this platform.
To utilize CivitAI-CLI and ensure a clean environment without dependency conflicts, it's recommended to install it within a Python virtual environment (venv). Here are the steps to clone the repository, set up a venv, and install the necessary dependencies:
Ensure you have Python 3.6 or later and pip
installed on your system. If not, download and install Python from the official website and pip
will be included.
To quickly set up, you can use the following one-liner:
git clone https://github.com/roadmaus/CivitAI-CLI.git && cd CivitAI-CLI && [[ -x start.sh ]] || chmod +x start.sh && ./start.sh
Or you can manually clone it:
git clone https://github.com/roadmaus/CivitAI-CLI.git
cd CivitAI-CLI
To create and activate a virtual environment:
python -m venv myenv
.\myenv\Scripts\activate
python3 -m venv myenv
source myenv/bin/activate
Note: Ensure your shell is in the directory where myenv
is created. Also windows support is not tested yet and will likely break.
With the virtual environment activated, install the dependencies:
pip install -r requirements.txt
To deactivate the virtual environment when you're done:
deactivate
After setting up and activating your venv, you can use CivitAI-CLI while keeping your Python environment clean and managed.
For the most up-to-date installation instructions for viu
, please refer to the official repository.
To access additional features and to download models that require a login, set the CIVITAI_API_KEY
environment variable with your API key:
export CIVITAI_API_KEY=your_api_key_here
Explore the various functionalities provided by CivitAI-CLI:
> List models
Fetch model by ID
Download model by ID
Scan for missing data
No interrupted downloads
Fetch model version by ID
Fetch model by Hash
Settings
Exit
> Change display mode
Adjust image size
Set default query
Set model version preference
Set root directory
Back to main menu
> Next page
Previous page
Jump to page
Filter this search
Search Model
Select to Download
Initiate Download
Initiate Background Download
Select for more Info
Back to main menu
Model Display Example
Displayed using text mode:
π ID: 157458
π URL: https://civitai.com/models/157458
π Name: The Devil (The Cuphead Show) Cartoon Character LoRA
π€ Creator: PlagSoft
π€ Type: LoCon
π οΈ Base Models: SD 1.5
β Rating: 0
π NSFW: False
π·οΈ Tags: character, cartoon, demon, cuphead, characterοΌ, devil, 1930s
π¦ File Size: 29.67 MB
-- Scans --
π Pickle Scan: Success
π¬ Virus Scan: Success
ποΈ Scanned At: 2023-10-06T03:45:42.181Z
-- Description --
π Description: "βͺ In case you ain't heard, I'm the Devil! I'm a real low-down, not on the level!" These are the results of my first experiments with a Google Colab LoRA maker. Early versions were made with PixAI and l...
Visual Showcase
Here's how CivitAI-CLI displays models in the iTerm2 terminal using viu
:
And here's a display in a standard terminal using the ANSI display:
CivitAI-CLI presently allows users to:
- List and filter models
- Download models
- Fetch model info
- Set a default query and download path (aligns with Automatic1111's webui directory structure)
- Scan for missing metadata (currently it replaces old metadata if not in the same format)
- Switch display mode between Text only or Image
- Adjust image sizes
- Set a content filter for images (options: block, blur, or show)
- Resume interrupted downloads (partially implemented)
- check for updated versions
- install and run it using the one-liner (or install script)
Future updates aim to provide:
- Enhanced model cards for details
- Fetching models by hash
- Improved metadata management