Firecrawl load balancer and proxy with usage dashboard
Project description
firecrawl-lb
Load balancer for Firecrawl API accounts. Pool multiple teams, track credit usage, manage API keys, view everything in a dashboard.
More screenshots
| Settings | Jobs | Logs |
|---|---|---|
| Overview (dark) | Accounts (dark) | Settings (dark) |
|---|---|---|
Features
| Account Pooling Load balance across multiple Firecrawl teams |
Credit Tracking Per-account credits, budget, live reconciliation |
Budget-aware Routing Route by remaining credits, RPM, concurrency, health |
| Dashboard Overview, accounts, jobs, logs, settings |
Firecrawl v2 Proxy Scrape, map, search, crawl, batch scrape |
Job Ownership Crawl/batch jobs tracked to originating account |
Quick Start
# Docker (recommended)
docker volume create firecrawl-lb-data
docker run -d --name firecrawl-lb \
-p 2465:2465 \
-v firecrawl-lb-data:/var/lib/firecrawl-lb \
ghcr.io/soju06/firecrawl-lb:latest
# or local
uv sync
uv run uvicorn app.main:app --host 127.0.0.1 --port 2465
Open localhost:2465 → Add account → Done.
Remote Setup
When accessing the dashboard remotely for the first time, a bootstrap token is required to set the initial password.
Auto-generated (default): On first startup (no password configured), the server generates a one-time token and prints it to logs:
docker logs firecrawl-lb
# ============================================
# Dashboard bootstrap token (first-run):
# <token>
# ============================================
Open the dashboard → enter the token + new password → done. The token is shared across replicas and remains valid until a password is set.
Manual token: To use a fixed token instead, set the env var before starting:
docker run -d --name firecrawl-lb \
-e FIRECRAWL_LB_DASHBOARD_BOOTSTRAP_TOKEN=your-secret-token \
-p 2465:2465 \
-v firecrawl-lb-data:/var/lib/firecrawl-lb \
ghcr.io/soju06/firecrawl-lb:latest
Local access (localhost) bypasses bootstrap entirely.
Configure Accounts
Create an account (one per Firecrawl team):
curl -X POST http://127.0.0.1:2465/v2/admin/firecrawl/accounts \
-H 'content-type: application/json' \
-d '{
"id": "team-a",
"team_label": "Team A",
"plan_type": "standard",
"monthly_budget_credits": 100000,
"remaining_credits_live": 100000,
"plan_credits_live": 100000,
"rpm_limit": 500,
"max_concurrency": 50
}'
Add a credential:
curl -X POST http://127.0.0.1:2465/v2/admin/firecrawl/accounts/team-a/credentials \
-H 'content-type: application/json' \
-d '{
"id": "team-a-primary",
"name": "primary",
"api_key": "fc-your-firecrawl-key"
}'
Admin responses redact API keys and encrypted key material. Credentials are stored encrypted with the configured encryption key file.
How It Works
Proxy Endpoints
firecrawl-lb fronts selected Firecrawl v2 APIs:
| Endpoint | Method | Type |
|---|---|---|
/v2/scrape |
POST | Sync |
/v2/map |
POST | Sync |
/v2/search |
POST | Sync |
/v2/crawl |
POST | Job submit |
/v2/crawl/{job_id} |
GET | Job status |
/v2/crawl/{job_id} |
DELETE | Job cancel |
/v2/batch/scrape |
POST | Job submit |
/v2/batch/scrape/{job_id} |
GET | Job status |
/v2/batch/scrape/{job_id} |
DELETE | Job cancel |
Clients hit firecrawl-lb with a Firecrawl-compatible request. The proxy selects an active account/credential, forwards to upstream Firecrawl, returns the upstream status/body, and writes a local request log.
Routing Algorithm
Account selection uses a weighted score:
| Factor | Weight | Description |
|---|---|---|
| Remaining budget ratio | 45% | remaining_credits / monthly_budget |
| Endpoint rate available | 25% | RPM headroom for the request endpoint |
| Concurrency available | 20% | In-flight request headroom |
| Health score | 10% | Recent error/cooldown penalty |
Accounts with status != active, zero remaining credits, or active cooldowns are excluded from selection.
Credit Tracking
Usage is measured in three layers:
- Admission estimate — before forwarding, the proxy estimates credit cost (scrape=1, map=1, search=2×⌈limit/10⌉×sources, crawl=limit-based reservation)
- Response confirmation — when the upstream response includes
creditsUsed, the local balance is updated with the exact value - Refresh reconciliation — periodic calls to
GET /v2/team/credit-usagereconcile the local balance with the upstream source of truth
Job Ownership
Job submit endpoints (/v2/crawl, /v2/batch/scrape) persist a firecrawl_jobs row with the selected account_id, credential_id, endpoint, upstream job ID, and reserved-credit estimate. Status and cancel calls always use the original credential for that job; they do not re-run account selection.
When a status response is terminal and includes creditsUsed, firecrawl-lb settles the job once and decrements the owning account once. Repeated status polls do not double-charge.
Refresh Service
The refresh service calls each account's active credential against:
GET /v2/team/credit-usageGET /v2/team/queue-status
It reconciles local balances with upstream values and updates queue status. The scheduler is configurable via FIRECRAWL_LB_USAGE_REFRESH_ENABLED and FIRECRAWL_LB_USAGE_REFRESH_INTERVAL_SECONDS.
Client Setup
Point any HTTP client at firecrawl-lb. Replace your Firecrawl base URL with http://127.0.0.1:2465 and remove the Authorization header (firecrawl-lb manages credentials internally).
import requests
response = requests.post(
"http://127.0.0.1:2465/v2/scrape",
json={"url": "https://example.com"},
)
print(response.json())
curl -X POST http://127.0.0.1:2465/v2/scrape \
-H 'content-type: application/json' \
-d '{"url": "https://example.com"}'
With Firecrawl Python SDK
from firecrawl import FirecrawlApp
app = FirecrawlApp(
api_url="http://127.0.0.1:2465",
api_key="unused", # firecrawl-lb manages keys internally
)
result = app.scrape_url("https://example.com")
print(result)
Configuration
Environment variables with FIRECRAWL_LB_ prefix or .env.local. See .env.example.
SQLite is the default database backend; PostgreSQL is optional via FIRECRAWL_LB_DATABASE_URL (for example postgresql+asyncpg://...).
Dashboard authentication modes
firecrawl-lb supports three dashboard auth modes via environment variables:
FIRECRAWL_LB_DASHBOARD_AUTH_MODE=standard— built-in dashboard password with optional TOTP from the Settings page.FIRECRAWL_LB_DASHBOARD_AUTH_MODE=trusted_header— trust a reverse-proxy auth header such as Authelia'sRemote-User, but only fromFIRECRAWL_LB_FIREWALL_TRUSTED_PROXY_CIDRS. Built-in password/TOTP remain available as an optional fallback.FIRECRAWL_LB_DASHBOARD_AUTH_MODE=disabled— fully bypass dashboard auth. Use only behind network restrictions or external auth.
Docker examples
Authelia / trusted header
docker run -d --name firecrawl-lb \
-p 2465:2465 \
-e FIRECRAWL_LB_DASHBOARD_AUTH_MODE=trusted_header \
-e FIRECRAWL_LB_DASHBOARD_AUTH_PROXY_HEADER=Remote-User \
-e FIRECRAWL_LB_FIREWALL_TRUST_PROXY_HEADERS=true \
-e FIRECRAWL_LB_FIREWALL_TRUSTED_PROXY_CIDRS=172.18.0.0/16 \
-v firecrawl-lb-data:/var/lib/firecrawl-lb \
ghcr.io/soju06/firecrawl-lb:latest
Hard override / no app-level dashboard auth
docker run -d --name firecrawl-lb \
-p 2465:2465 \
-e FIRECRAWL_LB_DASHBOARD_AUTH_MODE=disabled \
-v firecrawl-lb-data:/var/lib/firecrawl-lb \
ghcr.io/soju06/firecrawl-lb:latest
For Helm, pass the same values through extraEnv.
Data
| Environment | Path |
|---|---|
| Local | ~/.firecrawl-lb/ |
| Docker | /var/lib/firecrawl-lb/ |
Backup this directory to preserve your data.
Kubernetes
helm install firecrawl-lb oci://ghcr.io/soju06/charts/firecrawl-lb \
--set postgresql.auth.password=changeme \
--set config.databaseMigrateOnStartup=true \
--set migration.schemaGate.enabled=false
kubectl port-forward svc/firecrawl-lb 2465:2465
Open localhost:2465 → Add account → Done.
For external database, production config, ingress, observability, and more see the Helm chart README.
Development
# Docker
docker compose watch
# Local
uv sync && cd frontend && bun install && cd ..
uv run fastapi run app/main.py --reload # backend :2465
cd frontend && bun run dev # frontend :5173
Contributors ✨
Soju06 💻 ⚠️ 🚧 🚇 |
This project follows the all-contributors specification. Contributions of any kind welcome!
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 firecrawl_lb-0.1.0b2.tar.gz.
File metadata
- Download URL: firecrawl_lb-0.1.0b2.tar.gz
- Upload date:
- Size: 1.3 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c121650d7587e292b3a23b222e35fc48f1eeb35feccfcffe3c681238ca2a2809
|
|
| MD5 |
0ee00e06104f30458941070fec1e7247
|
|
| BLAKE2b-256 |
a01744f282b69f56ebd4764461f59019abfa52132a25a814125b495d3b4863f6
|
Provenance
The following attestation bundles were made for firecrawl_lb-0.1.0b2.tar.gz:
Publisher:
release.yml on Soju06/firecrawl-lb
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
firecrawl_lb-0.1.0b2.tar.gz -
Subject digest:
c121650d7587e292b3a23b222e35fc48f1eeb35feccfcffe3c681238ca2a2809 - Sigstore transparency entry: 2046500068
- Sigstore integration time:
-
Permalink:
Soju06/firecrawl-lb@5be0785176063a9ef36ea3ac1b109755c8170134 -
Branch / Tag:
refs/tags/v0.1.0-beta.2 - Owner: https://github.com/Soju06
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5be0785176063a9ef36ea3ac1b109755c8170134 -
Trigger Event:
release
-
Statement type:
File details
Details for the file firecrawl_lb-0.1.0b2-py3-none-any.whl.
File metadata
- Download URL: firecrawl_lb-0.1.0b2-py3-none-any.whl
- Upload date:
- Size: 384.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
17752c48b9c60a6974c33a76ea90f7cf2fddd1144e9487a0042757e1cab68699
|
|
| MD5 |
15079bbd2629576f177fcf80f3d8f75a
|
|
| BLAKE2b-256 |
b614f9dc5c6211ff1d121ce83a1e9608074dadfbaa532dfd45e1177af9de19aa
|
Provenance
The following attestation bundles were made for firecrawl_lb-0.1.0b2-py3-none-any.whl:
Publisher:
release.yml on Soju06/firecrawl-lb
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
firecrawl_lb-0.1.0b2-py3-none-any.whl -
Subject digest:
17752c48b9c60a6974c33a76ea90f7cf2fddd1144e9487a0042757e1cab68699 - Sigstore transparency entry: 2046500691
- Sigstore integration time:
-
Permalink:
Soju06/firecrawl-lb@5be0785176063a9ef36ea3ac1b109755c8170134 -
Branch / Tag:
refs/tags/v0.1.0-beta.2 - Owner: https://github.com/Soju06
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@5be0785176063a9ef36ea3ac1b109755c8170134 -
Trigger Event:
release
-
Statement type: