Automatically toggles qBittorrent's alternate speed limits based on active Plex stream bitrate. When a high-bitrate stream starts, bandwidth is throttled. When the last such stream ends, full speed resumes.
Important
Webhooks are a Plex Pass feature. This app will not receive any playback events without an active Plex Pass subscription.
Plex sends a webhook on every playback event (play, resume, pause, stop). On play/resume, the app queries the Plex sessions API to get the actual stream bitrate and compares it against a configurable threshold. If the stream is heavy, qBittorrent's alt speed mode is enabled via its Web API. On stop/pause, the session is removed from tracking, and alt speed is disabled once no heavy streams remain.
Multiple simultaneous heavy streams are handled correctly — throttling stays on until all of them end.
- Python 3.13 with uv for dependency management
- FastAPI — webhook receiver and status endpoint
- httpx — HTTP client for Plex and qBittorrent API calls
- Docker / Compose — recommended deployment
All configuration is via environment variables.
| Variable | Default | Description |
|---|---|---|
THRESHOLD_MBPS |
40 |
Streams at or above this bitrate trigger throttling |
QBIT_URL |
http://localhost:8080 |
qBittorrent Web UI address |
QBIT_USER |
admin |
qBittorrent username |
QBIT_PASS |
adminadmin |
qBittorrent password |
PLEX_URL |
http://localhost:32400 |
Plex Media Server address |
PLEX_TOKEN |
(required) | Plex authentication token (how to find it) |
LOG_LEVEL |
INFO |
Python log level (DEBUG, INFO, WARNING, ERROR) |
In Plex Web → Settings → Webhooks, add:
http://<your-host>:9090/webhook
Enable the Web UI in qBittorrent (Tools → Preferences → Web UI) and set your desired alternate speed limits (Tools → Preferences → Speed → Alternative Rate Limits).
With Docker Compose:
services:
plex-limiter:
image: ghcr.io/tasztalos69/plex-limiter:latest
container_name: plex-limiter
hostname: plex-limiter
restart: unless-stopped
ports:
- "9090:9090"
environment:
LOG_LEVEL: "INFO"
THRESHOLD_MBPS: "40"
QBIT_URL: "http://qbittorrent:8080"
QBIT_USER: "admin"
QBIT_PASS: "adminadmin"
PLEX_URL: "http://plex:32400"
PLEX_TOKEN: "your-token-here"If qBittorrent and/or Plex are on the same Compose stack, attach this service to their network instead of using host addresses:
networks:
- your_existing_network
networks:
your_existing_network:
external: trueStandalone with uv:
uv sync
PLEX_TOKEN=your-token QBIT_URL=http://localhost:8080 uv run uvicorn src.app:app --host 0.0.0.0 --port 9090GET http://<host>:9090/status
Returns current configuration and active heavy sessions:
{
"threshold_mbps": 40,
"heavy_sessions": {},
"qbit_url": "http://qbittorrent:8080",
"plex_url": "http://plex:32400",
"plex_token_set": true
}