Python SDK for the BGBlur API.
Project description
bgblur-ai
bgblur-ai is a Python SDK and CLI for the BGBlur public API on https://www.bgblur.com. It does not run AI processing locally. Files are uploaded through BGBlur's presigned upload API, processing is delegated to the existing backend stack, and results are downloaded automatically.
Installation
pip install bgblur-ai
Quick start
from bgblur_ai import PrivacyBlur
client = PrivacyBlur(api_key="YOUR_API_KEY")
client.face_blur(
input="image.jpg",
output="result.jpg",
blur_type="gaussian",
)
client.face_anonymize(
input="video.mp4",
output="result.mp4",
)
client.license_plate_blur(
input="car.jpg",
output="result.jpg",
)
client.blur_anything(
input="image.jpg",
prompt="person",
output="result.jpg",
)
from bgblur_ai import DatasetProcessor
processor = DatasetProcessor(api_key="YOUR_API_KEY")
report = processor.process_dataset(
dataset_path="dataset",
output_path="dataset_private",
face_blur=True,
plate_blur=True,
blur_type="pixelated",
)
print(report.to_json())
CLI
bgblur-ai face-blur input.jpg output.jpg --blur-type gaussian
bgblur-ai face-anonymize input.mp4 output.mp4
bgblur-ai license-plate-blur car.jpg result.jpg
bgblur-ai blur-anything image.jpg result.jpg --prompt "person"
bgblur-ai dataset-process --input dataset --output dataset_private --face-blur --plate-blur --blur-type pixelated
API key resolution order:
--api-keyBGBLUR_AI_API_KEY
Base URL resolution order:
--base-urlBGBLUR_AI_BASE_URLhttps://www.bgblur.com
API contract
The SDK follows the current BGBlur public API flow:
POST /api/v1/uploads/imageorPOST /api/v1/uploads/videoto obtain a presignedupload_urlplusimage_urlorvideo_urlPUTthe original file bytes to the returned presigned upload URLPOST /api/v1/images/...for synchronous image operationsPOST /api/v1/videos/...for async video operationsGET /api/v1/jobs/{job_id}to inspect queued video jobs
The current implementation uses these BGBlur public endpoints:
POST /api/v1/images/face-blurPOST /api/v1/images/license-plate-blurPOST /api/v1/images/blur-anythingPOST /api/v1/videos/face-blurPOST /api/v1/videos/license-plate-blurPOST /api/v1/videos/blur-anythingPOST /api/v1/videos/face-anonymization
DatasetProcessor uses those same public routes. plate_mode="replace" is not currently exposed by the BGBlur public API, so the SDK raises a clear error for that mode instead of silently falling back to local processing.
Errors
The SDK raises:
PrivacyBlurErrorAuthenticationErrorRateLimitErrorServerError
Development
python -m venv .venv
source .venv/bin/activate
pip install -e .[dev]
pytest
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file bgblur_ai-0.1.0.tar.gz.
File metadata
- Download URL: bgblur_ai-0.1.0.tar.gz
- Upload date:
- Size: 14.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5e0485f4ea5ff0969cce39b21102927d324703506562ec9f12e4013e41f0d7be
|
|
| MD5 |
e57eb9c095bc26b24fd8a6758cf963b2
|
|
| BLAKE2b-256 |
552e79041389ce88eaed2ad2cabe10d6f0e58b212bfa6d974454e719dad2a10c
|
File details
Details for the file bgblur_ai-0.1.0-py3-none-any.whl.
File metadata
- Download URL: bgblur_ai-0.1.0-py3-none-any.whl
- Upload date:
- Size: 16.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
64948d74b0c39780b77d81c20ce772647fe87a6a845854f4c51569f26fd72437
|
|
| MD5 |
e515f39c0bc6fef5b868ba76fcf9b504
|
|
| BLAKE2b-256 |
860f795b63f5acc67c92120a728f8fbf400aeac1859a37b5c858337b57e34410
|