Awesome
Python script to download models from CivitAI using an API key
Getting Started
This script requires a CivitAI API key. You can create the API key as follows:
- Log into CivitAI.
- Go to the Manage Account page.
- Scroll down to the
API Keys
section, close to the bottom of the page. - Click the
+ Add API key
button to create a new API key. - Give the API key a name and click the
Save
button. - You will then use your newly created API key with this script.
Installation
wget https://raw.githubusercontent.com/ashleykleynhans/civitai-downloader/main/download.py
mv download.py /usr/local/bin/download-model
chmod +x /usr/local/bin/download-model
[!NOTE] This assumes you are using RunPod and logged in as
root
user. If not, the installation commands should be prefixed withsudo
.
[!IMPORTANT] It is important to ensure that you use the DOWNLOAD link and not the link to the model page in CivitAI.
Usage
download-model [URL] [DESTINATION]
To download to the current directory:
download-model https://civitai.com/api/download/models/46846 .
To download to a different directory:
download-model https://civitai.com/api/download/models/46846 /workspace/stable-diffusion-webui/models/Stable-diffusion
Community and Contributing
Pull requests and issues on GitHub are welcome. Bug fixes and new features are encouraged.
Appreciate my work?
<a href="https://www.buymeacoffee.com/ashleyk" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-yellow.png" alt="Buy Me A Coffee" style="height: 60px !important;width: 217px !important;" ></a>