# withoutBG Documentation

Remove image backgrounds with professional quality in seconds. Run fully locally or call our managed cloud API—same API either way.

## Quick Start

All endpoints require `X-API-Key` header. Rate limit: 30 requests/minute.

## Why withoutBG?

* **Open & premium options** — Apache-2.0 models + a managed API
* **Flexible deployment** — CPU/GPU local or cloud at scale
* **Simple integration** — Python API and CLI
* **Production-ready** — Powers apps processing 100k+ images

## Models

* **API** — Managed cloud API. Fastest + best quality (highest accuracy).
* **OSS** — Open-source (Apache-2.0). Local or self-hosted for maximum privacy.

*All models share the same API.*

## API Endpoints

### 1. Background Removal (Binary)
**Endpoint:** `POST /v1.0/image-without-background`

Returns binary PNG with transparency. Best for servers, CLIs, batch workflows, and direct file I/O without JSON overhead.

### 2. Background Removal (Base64)
**Endpoint:** `POST /v1.0/image-without-background-base64`

Returns base64 PNG in JSON. Best for browsers, JSON APIs, serverless functions, and embedded workflows.

### 3. Alpha Matte (Binary)
**Endpoint:** `POST /v1.0/alpha-channel`

Returns grayscale PNG mask for compositing and advanced pipelines. Enables non-destructive editing and multiple background variants.

### 4. Alpha Matte (Base64)
**Endpoint:** `POST /v1.0/alpha-channel-base64`

Returns base64 PNG mask in JSON. Best for browser compositing, Canvas/WebGL workflows, and embedded applications.

### 5. API Credits Info
**Endpoint:** `GET /available-credit`

Returns credit balance and expiration date. Use for gating features, monitoring usage, and setting up alerts.

## API Endpoints Summary Table

| Method | Path | Returns | Best for |
|--------|------|---------|----------|
| `POST` | `/v1.0/image-without-background` | Binary PNG | Servers, CLIs, batch |
| `POST` | `/v1.0/image-without-background-base64` | Base64 JSON | Browsers, JSON APIs |
| `POST` | `/v1.0/alpha-channel` | Binary mask | Compositing pipelines |
| `POST` | `/v1.0/alpha-channel-base64` | Base64 mask | Browser compositing |
| `GET` | `/available-credit` | Credit balance | Monitoring, gating |

## SDKs

### Python SDK
Local OSS model (free) and cloud API modes. Includes CLI, batch processing, and comprehensive examples. Handles authentication, retries, and error handling automatically.

**Documentation:** `/docs/open-model/python`

## Additional Resources

* **API Documentation Pages:**
  - Background Removal (Binary): `/docs/pro-model/background-removal-binary`
  - Background Removal (Base64): `/docs/pro-model/background-removal-base64`
  - Alpha Matte (Binary): `/docs/pro-model/alpha-matte-binary`
  - Alpha Matte (Base64): `/docs/pro-model/alpha-matte-base64`
  - API Credits Info: `/docs/pro-model/credits`
