civitai-models-manager


Namecivitai-models-manager JSON
Version 0.8.5 PyPI version JSON
download
home_pageNone
SummaryCLI tool for managing AI models from the CivitAI platform.
upload_time2024-09-08 14:41:56
maintainerNone
docs_urlNone
authorNone
requires_python<=3.13,>=3.9
licenseCopyright 2024 Regi E Ellis Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords ai artificial intelligence civitai cli machine learning manager ml model
VCS
bugtrack_url
requirements typer rich httpx shellingham html2text python-dotenv questionary ollama openai groq asyncio tenacity civitai
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Civitai Models CLI

> [!NOTE]
Release 0.7.0 was another big refactor for the project. if you had a version before 0.7.0, it is recommended that you re-clone the repo and install the project
with `pipx install .` or `pip install .` Since the module sturcture has changesd, so has the naming, you will need to do a `pipx uninstall civitai-cli-manager` 
or `pip uninstall civitai-cli-manager` to remove the old version. You can not run the tool using the new name `civitai-models` or `civitai-models --help` 
to see the new commands.

> [!WARNING]
> This tool is provided "as-is". It has primarily been used/tested on Ubuntu systems; YMMV on Windows/Subsystems but should work fine. I will be adding more features and testing on other platforms in the future as I move towards 1.0.0 release.

## Overview

**Civitai Models CLI** is an unofficial Command Line Interface (CLI) tool I created to streamline the process of retrieving and managing AI models from the **Civitai platform**. This came about as a solution to quickly working with and manage models out
side the main site.

I initially intended for this to be just a module in a larger **Comfy CLI** toolset, but I found it so useful in its standalone format that I decided to share it with anyone who might feel the same way.

![screenshot](https://raw.githubusercontent.com/regiellis/civitai-models-cli/main/image.png)

## Why

I needed a more efficient way to download, organize and manage my AI models from the site and the result is this CLI tool that allows me (and you) to store and manage models in a centralized directory. The tool also allows for a quick model summary
via the Ollama(OpenAI), OpenAI or Groq if you choose. It is a great way to get a quick overview of a model's capabilities without having to download it first or read a lengthy description that may not be in your native language.

## Key Features

- **Quick Model Listing**: This tool will quickly list all available models alongside their types and storage paths.

- **Searchable Models**: You can search for specific models via the api using plain text or tags.

- **Categorical Stats**: Stats are available for each model type, including the number of models and their sizes.

- **Detailed Insights**: It retrieves comprehensive information about specific models using their IDs.

- **Effortless Downloads**: You can download selected model variants with ease, avoiding the tedious web interface. Just put any model ID or version ID you want to download in and the tool will handle the rest.

- **Simplified Removals**: Easily remove unnecessary models from local storage to keep things tidy.

- **Summarized Descriptions**: Get summaries of specific models by using 3 different LLMs for enhanced understanding.

## Installation (Recommended)

You have a couple of options for installing/running the tool:

### Install [pipx](https://pipxproject.github.io/pipx/installation/), then run the tool with the following command


```bash
pipx install .
```

### Alternatively, you can install using `pip`

```bash
pip install .
```


Run tests with:

> [!NOTE]
You will need to have the `pytest` package installed to run the tests.
Also, testing is not yet complete, so expect some failures...cause I have a 1 year old so time is limited. I will get to it...eventually. I know python....tests are important.

```bash
`pytest` in the root directory of the project.
```

## Configuration

> [!IMPORTANT]
> Before using the tool, It's required to set up a `.env` file in the parent directory of the script or your home user dir [windows] or `$HOME/.config/civitai-cli-manager/.env` with the following environment variables:

```env
CIVITAI_TOKEN=#https://developer.civitai.com/docs/getting-started/setup-profile#create-an-api-key
MODELS_DIR= #/location/of/your/models/

OLLAMA_API_BASE= # http://localhost:11434 or http://host.docker.internal:11434
OLLAMA_MODEL=tinydolphin # Tuned to tinydolphin..as best I could
HTML_OUT=False # Some models require HTML conversion, some don't
TEMP=0
TOP_P=0

OPENAI_MODEL=gpt-4o-mini # some frontier models are censored and may not explain the desired model
OPENAI_API_KEY= # sk-proj

GROQ_MODEL=llama-3.1-70b-versatile
GROQ_API_KEY=#//
```

The application intelligently locates your `.env` file, accommodating various platforms like Windows and Linux, or defaulting to the current directory.

## Usage

> [!NOTE]
  You no longer need to grab the id from the URL. You can now search for models by name or tag and get the ID. You can use the `search` command to search for models by query and filter by tag to get the model ID.


~~You can also grab the ID from the Civitai... The model ID is the number in the URL after `/models/`, like so: https://civitai.com/models/`277058`/epicrealism-xl or https://civitai.com/models/`277058`/epicrealism-xl/versions/`453435`. Each model has a unique ID that can be used to download the model and a version ID that can be used to download a specific version of the model.~~

### Available Commands

Once installed via pipx or pip:

```bash
# List all available models
civitai-models list

# Statistically summarize all models
civitai-models stats

# Get detailed information about a specific model [display images or description]
civitai-models details 12345 [--images | --desc]

# Download a specific model variant [select flag will prompt you to select a model]
civitai-models download 54321 [--select]

# Remove models from local storage
civitai-models remove

# Get a summary of a specific model with a options to select a LLM [--service ollama | openai | groq]
civitai-models explain 12345 [--service ollama | openai | groq]
```

## Dependencies

This tool requires Python 3.11 or higher and has the following dependencies:

```plaintext
- typer
- rich
- httpx
- shellingham
- tqdm
- civitai
- python-dotenv
- questionary
- ollama
- openai
```

These dependencies enhance usability, including user interactions, downloadable progress visuals, and environment variable management.

## To-Do List

- [X] Add search locations for `.env`
- [X] Add groqCloud integration
- [X] Add sanity checks for permissions, folder locations, feedback
- [X] Add feature to download a update to a model if it already exists
- [X] Add feature to download a specific version of a model
- [ ] Add feature to have Ollama agents suggest a 5 models based on a prompt

### Contact

For any inquiries, feedback, or suggestions, please feel free to open an issue on this repository.

### License

This project is licensed under the [MIT License](LICENSE).

---

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "civitai-models-manager",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<=3.13,>=3.9",
    "maintainer_email": null,
    "keywords": "ai, artificial intelligence, civitai, cli, machine learning, manager, ml, model",
    "author": null,
    "author_email": "Regi E <regi@bynine.io>",
    "download_url": "https://files.pythonhosted.org/packages/a7/12/f63ef9b67eb29f68a0ed7eca48db0b94f54cb2d651c6d4d6039911d511f4/civitai_models_manager-0.8.5.tar.gz",
    "platform": null,
    "description": "# Civitai Models CLI\n\n> [!NOTE]\nRelease 0.7.0 was another big refactor for the project. if you had a version before 0.7.0, it is recommended that you re-clone the repo and install the project\nwith `pipx install .` or `pip install .` Since the module sturcture has changesd, so has the naming, you will need to do a `pipx uninstall civitai-cli-manager` \nor `pip uninstall civitai-cli-manager` to remove the old version. You can not run the tool using the new name `civitai-models` or `civitai-models --help` \nto see the new commands.\n\n> [!WARNING]\n> This tool is provided \"as-is\". It has primarily been used/tested on Ubuntu systems; YMMV on Windows/Subsystems but should work fine. I will be adding more features and testing on other platforms in the future as I move towards 1.0.0 release.\n\n## Overview\n\n**Civitai Models CLI** is an unofficial Command Line Interface (CLI) tool I created to streamline the process of retrieving and managing AI models from the **Civitai platform**. This came about as a solution to quickly working with and manage models out\nside the main site.\n\nI initially intended for this to be just a module in a larger **Comfy CLI** toolset, but I found it so useful in its standalone format that I decided to share it with anyone who might feel the same way.\n\n![screenshot](https://raw.githubusercontent.com/regiellis/civitai-models-cli/main/image.png)\n\n## Why\n\nI needed a more efficient way to download, organize and manage my AI models from the site and the result is this CLI tool that allows me (and you) to store and manage models in a centralized directory. The tool also allows for a quick model summary\nvia the Ollama(OpenAI), OpenAI or Groq if you choose. It is a great way to get a quick overview of a model's capabilities without having to download it first or read a lengthy description that may not be in your native language.\n\n## Key Features\n\n- **Quick Model Listing**: This tool will quickly list all available models alongside their types and storage paths.\n\n- **Searchable Models**: You can search for specific models via the api using plain text or tags.\n\n- **Categorical Stats**: Stats are available for each model type, including the number of models and their sizes.\n\n- **Detailed Insights**: It retrieves comprehensive information about specific models using their IDs.\n\n- **Effortless Downloads**: You can download selected model variants with ease, avoiding the tedious web interface. Just put any model ID or version ID you want to download in and the tool will handle the rest.\n\n- **Simplified Removals**: Easily remove unnecessary models from local storage to keep things tidy.\n\n- **Summarized Descriptions**: Get summaries of specific models by using 3 different LLMs for enhanced understanding.\n\n## Installation (Recommended)\n\nYou have a couple of options for installing/running the tool:\n\n### Install [pipx](https://pipxproject.github.io/pipx/installation/), then run the tool with the following command\n\n\n```bash\npipx install .\n```\n\n### Alternatively, you can install using `pip`\n\n```bash\npip install .\n```\n\n\nRun tests with:\n\n> [!NOTE]\nYou will need to have the `pytest` package installed to run the tests.\nAlso, testing is not yet complete, so expect some failures...cause I have a 1 year old so time is limited. I will get to it...eventually. I know python....tests are important.\n\n```bash\n`pytest` in the root directory of the project.\n```\n\n## Configuration\n\n> [!IMPORTANT]\n> Before using the tool, It's required to set up a `.env` file in the parent directory of the script or your home user dir [windows] or `$HOME/.config/civitai-cli-manager/.env` with the following environment variables:\n\n```env\nCIVITAI_TOKEN=#https://developer.civitai.com/docs/getting-started/setup-profile#create-an-api-key\nMODELS_DIR= #/location/of/your/models/\n\nOLLAMA_API_BASE= # http://localhost:11434 or http://host.docker.internal:11434\nOLLAMA_MODEL=tinydolphin # Tuned to tinydolphin..as best I could\nHTML_OUT=False # Some models require HTML conversion, some don't\nTEMP=0\nTOP_P=0\n\nOPENAI_MODEL=gpt-4o-mini # some frontier models are censored and may not explain the desired model\nOPENAI_API_KEY= # sk-proj\n\nGROQ_MODEL=llama-3.1-70b-versatile\nGROQ_API_KEY=#//\n```\n\nThe application intelligently locates your `.env` file, accommodating various platforms like Windows and Linux, or defaulting to the current directory.\n\n## Usage\n\n> [!NOTE]\n  You no longer need to grab the id from the URL. You can now search for models by name or tag and get the ID. You can use the `search` command to search for models by query and filter by tag to get the model ID.\n\n\n~~You can also grab the ID from the Civitai... The model ID is the number in the URL after `/models/`, like so: https://civitai.com/models/`277058`/epicrealism-xl or https://civitai.com/models/`277058`/epicrealism-xl/versions/`453435`. Each model has a unique ID that can be used to download the model and a version ID that can be used to download a specific version of the model.~~\n\n### Available Commands\n\nOnce installed via pipx or pip:\n\n```bash\n# List all available models\ncivitai-models list\n\n# Statistically summarize all models\ncivitai-models stats\n\n# Get detailed information about a specific model [display images or description]\ncivitai-models details 12345 [--images | --desc]\n\n# Download a specific model variant [select flag will prompt you to select a model]\ncivitai-models download 54321 [--select]\n\n# Remove models from local storage\ncivitai-models remove\n\n# Get a summary of a specific model with a options to select a LLM [--service ollama | openai | groq]\ncivitai-models explain 12345 [--service ollama | openai | groq]\n```\n\n## Dependencies\n\nThis tool requires Python 3.11 or higher and has the following dependencies:\n\n```plaintext\n- typer\n- rich\n- httpx\n- shellingham\n- tqdm\n- civitai\n- python-dotenv\n- questionary\n- ollama\n- openai\n```\n\nThese dependencies enhance usability, including user interactions, downloadable progress visuals, and environment variable management.\n\n## To-Do List\n\n- [X] Add search locations for `.env`\n- [X] Add groqCloud integration\n- [X] Add sanity checks for permissions, folder locations, feedback\n- [X] Add feature to download a update to a model if it already exists\n- [X] Add feature to download a specific version of a model\n- [ ] Add feature to have Ollama agents suggest a 5 models based on a prompt\n\n### Contact\n\nFor any inquiries, feedback, or suggestions, please feel free to open an issue on this repository.\n\n### License\n\nThis project is licensed under the [MIT License](LICENSE).\n\n---\n",
    "bugtrack_url": null,
    "license": "Copyright 2024 Regi E Ellis  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \u201cSoftware\u201d), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \u201cAS IS\u201d, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "CLI tool for managing AI models from the CivitAI platform.",
    "version": "0.8.5",
    "project_urls": {
        "Bug Tracker": "https://github.com/regiellis/civitai-cli-manager/issues",
        "Documentation": "https://github.com/regiellis/civitai-cli-manager/blob/main/README.md",
        "Repository": "https://github.com/regiellis/civitai-cli-manager"
    },
    "split_keywords": [
        "ai",
        " artificial intelligence",
        " civitai",
        " cli",
        " machine learning",
        " manager",
        " ml",
        " model"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "0a28486e5118d1ebf3ec267b318d7fc1a91b570a7490d68eac50c434a40805d5",
                "md5": "54120b5a19813fe1ab09f2c0e523e80d",
                "sha256": "566149e6c9bd87644898952906251b08dbe5a71d72a8be89f17d8d7673ad4642"
            },
            "downloads": -1,
            "filename": "civitai_models_manager-0.8.5-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "54120b5a19813fe1ab09f2c0e523e80d",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<=3.13,>=3.9",
            "size": 34216,
            "upload_time": "2024-09-08T14:41:55",
            "upload_time_iso_8601": "2024-09-08T14:41:55.273329Z",
            "url": "https://files.pythonhosted.org/packages/0a/28/486e5118d1ebf3ec267b318d7fc1a91b570a7490d68eac50c434a40805d5/civitai_models_manager-0.8.5-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a712f63ef9b67eb29f68a0ed7eca48db0b94f54cb2d651c6d4d6039911d511f4",
                "md5": "942273995349f2baf81f604c7bf62710",
                "sha256": "43eb9dd55509602fd83d514b5cdec1a5f5727d88a149186ef5f3d228ee7a86a2"
            },
            "downloads": -1,
            "filename": "civitai_models_manager-0.8.5.tar.gz",
            "has_sig": false,
            "md5_digest": "942273995349f2baf81f604c7bf62710",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<=3.13,>=3.9",
            "size": 1921994,
            "upload_time": "2024-09-08T14:41:56",
            "upload_time_iso_8601": "2024-09-08T14:41:56.851693Z",
            "url": "https://files.pythonhosted.org/packages/a7/12/f63ef9b67eb29f68a0ed7eca48db0b94f54cb2d651c6d4d6039911d511f4/civitai_models_manager-0.8.5.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-09-08 14:41:56",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "regiellis",
    "github_project": "civitai-cli-manager",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "typer",
            "specs": []
        },
        {
            "name": "rich",
            "specs": []
        },
        {
            "name": "httpx",
            "specs": []
        },
        {
            "name": "shellingham",
            "specs": []
        },
        {
            "name": "html2text",
            "specs": []
        },
        {
            "name": "python-dotenv",
            "specs": []
        },
        {
            "name": "questionary",
            "specs": []
        },
        {
            "name": "ollama",
            "specs": []
        },
        {
            "name": "openai",
            "specs": []
        },
        {
            "name": "groq",
            "specs": []
        },
        {
            "name": "asyncio",
            "specs": []
        },
        {
            "name": "tenacity",
            "specs": []
        },
        {
            "name": "civitai",
            "specs": []
        }
    ],
    "lcname": "civitai-models-manager"
}
        
Elapsed time: 0.32867s