core-sdk

UNBG Rust SDK Workspace

Rust-first, local-only SDK workspace for background removal across CLI, Tauri, and native mobile.

Start Here (Consumer Integrations)

If you are integrating this SDK into an app, use these guides first:

Workspace crates

Commands

cargo build
cargo run -p unbg-cli -- models install --model fast
cargo run -p unbg-cli -- models install --all
cargo run -p unbg-cli -- models list
cargo run -p unbg-cli -- models verify
cargo run -p unbg-cli -- exec -i ./input.jpg
cargo run -p unbg-cli -- exec -i ./input.jpg -o ./out/cutout.png
cargo run -p unbg-cli -- exec -i ./input.jpg -m ./out/mask.png -M quality
cargo run -p smoke-tests
cargo test

exec defaults to model fast and writes <input>_cutout.<ext> in the same directory when no output flags are provided. If required models are missing, exec installs them automatically before inference.

CLI Install One-Liners

Use these commands:

irm https://unbg.io/install.ps1 | iex
curl -fsSL https://unbg.io/install.sh | sh

Installer scripts are included at the workspace root as install.ps1 and install.sh. They auto-detect OS and architecture, then download the matching GitHub Release archive for unbg.

Optional environment overrides:

Model Bundle Prep

Use the helper script to prepare packaged model bundles for consumers:

# Tauri package: rmbg-1.4 + rmbg-2.0 (requires HF token)
HF_TOKEN=... scripts/prepare-model-bundle.sh --profile tauri-full --out ./dist/model-bundles/tauri

# Mobile package: rmbg-1.4 fp16 only
scripts/prepare-model-bundle.sh --profile mobile-lite --out ./dist/model-bundles/mobile

Both profiles run install + verify and write a full model directory that you can ship with your app and pass as modelDir in platform APIs.

Recommended profiles:

rmbg-2.0 is gated and requires HF_TOKEN during install. Model aliases: fast -> rmbg-1.4, quality -> rmbg-2.0.

Licensing

UNBG source code is MIT-licensed; see LICENSE. Model weights have separate upstream terms and are not covered by the software license. Both configured BRIA models require separate authorization for commercial use. Read MODEL_LICENSES.md before downloading or distributing a model bundle.

Runtime safety defaults

Integration Packaging

CI workflows are defined under .github/workflows/ for workspace checks plus Tauri/Android/iOS artifacts.

Compatibility and Security

Telemetry sinks can be configured with: