civitai-api
Unofficial Python client for the CivitAI API — sync and async.
Install
pip install py-civitai-api
# with CLI
pip install "py-civitai-api[cli]"
Quick start
from civitai_api import CivitAI
# api key or CIVITAI_API_KEY env var
with CivitAI(api_key="...") as client:
for model in client.models.list(query="dreamshaper", limit=5).auto_paging_iter():
print(model.name, model.id)
Async
import asyncio
from civitai_api import AsyncCivitAI
async def main():
async with AsyncCivitAI() as client:
version = await client.model_versions.retrieve(12345)
print(version.name)
asyncio.run(main())
CLI
civitai auth login
civitai models list --query dreamshaper --limit 5
civitai models get 12345
civitai images list --model-id 12345
Development
git clone https://github.com/mcriley821/civitai-api
cd civitai-api
uv sync --extra dev
uv run poe install-hooks # install pre-commit hook (runs lint + typecheck + test)
uv run poe check # lint + typecheck + test
Note
Built with AI assistance (Claude, Anthropic). All code is reviewed by the author. Not affiliated with or endorsed by CivitAI.
Metadata
Release files for py-civitai-api 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| py_civitai_api-0.1.0.tar.gz | 22.6 kB | Without provenance | Details for py_civitai_api-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| py_civitai_api-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for py_civitai_api-0.1.0-py3-none-any.whl |
Total release size: 57.6 kB
Release files / py_civitai_api-0.1.0.tar.gz
| Download URL | py_civitai_api-0.1.0.tar.gz |
|---|---|
| Size | 22.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d362c7f11b851ab278014e807c71a7f87eaf3c89f0b74d4234fb31d1de7b4d6b
|
|
BLAKE2b-256 checksum How to use checksums |
f18a6b291aab36483062bb13831a21514cf651e5588c2aa254f83ab67708a825
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / py_civitai_api-0.1.0-py3-none-any.whl
| Download URL | py_civitai_api-0.1.0-py3-none-any.whl |
|---|---|
| Size | 35.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4fa0d25d3ac3ba9fd62c2b7f0b9569d7be283c174bd629931a905fdcb1554a9d
|
|
BLAKE2b-256 checksum How to use checksums |
7151e1b4735746b4b42e534bd79ab47ab1ac45c1d434bd3934e3746db4572d44
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Security for py-civitai-api 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.