rust-civit-comfy-bindings

raw JSON →
0.2.12 verified Fri May 01 auth: no python

Rust bindings for a Civitai + ComfyUI integration. Currently at version 0.2.12, with monthly releases. Provides high-performance model and file operations for ComfyUI workflows, leveraging Rust via PyO3. Requires Python >=3.8.

pip install rust-civit-comfy-bindings
error ModuleNotFoundError: No module named 'rust_civit_comfy_bindings'
cause Incorrect import path. Package uses underscores, not hyphens.
fix
Use from rust_civit_comfy_bindings import CivitComfyBindings.
error FileNotFoundError: [Errno 2] No such file or directory: 'target/release/librust_civit_comfy_bindings.so'
cause Missing native library. Possibly built from source incorrectly or missing Rust toolchain.
fix
Install precompiled wheel: pip install rust-civit-comfy-bindings on supported platform, or ensure Rust is installed and run pip install --no-binary :all: rust-civit-comfy-bindings.
breaking In version 0.2.0, the function `download_model` changed its parameter order (old: (output_dir, model_id); new: (model_id, output_dir)).
fix Update calls to use new parameter order: `bindings.download_model(model_id=..., output_dir=...)`.
deprecated Method `get_model` is deprecated since 0.2.5; use `fetch_model_info` instead.
fix Replace `get_model(id)` with `fetch_model_info(model_id=id)`.
gotcha The library requires a Rust toolchain to build from source (pip install might compile). Prebuilt wheels are available only for x86_64 Linux and Windows.
fix Install from PyPI; if no wheel, install Rust via rustup first.

Initializes bindings and downloads a model. Token is optional; without it, rate limits apply.

from rust_civit_comfy_bindings import CivitComfyBindings

# Initialize with API token (optional)
token = os.environ.get('CIVIT_API_TOKEN', '')
bindings = CivitComfyBindings(api_token=token)

# Example: download a model by ID
result = bindings.download_model(model_id=12345, output_dir='/tmp/models')
print(result)