Paid, hosted product at menivor.com, now retired as a company project. Fresh squashed history of the cleaned working tree (secret-scanned, no .env, no customer data, no outreach logs). Built on MoneyPrinterTurbo (MIT, harry0703) — see NOTICE.
24 KiB
ReelForge Configuration Reference
ReelForge is configured through two layers, both read by
app/config/config.py:
| Layer | File | Purpose |
|---|---|---|
| TOML | config.toml (copied from config.example.toml on first run) |
Non-secret defaults and, optionally, secrets for local/dev. |
| Environment | .env.reelforge (copied from .env.reelforge.example) |
Secrets. Env always wins over TOML. Loaded into api + worker containers via env_file: in docker-compose.reelforge.yml. |
On startup config.py::load_config() copies config.example.toml → config.toml
if the latter is missing, then toml.loads it. Each section is bound to a
module-level _SynchronizedConfig dict (config.app, config.anthropic,
config.r2, …). Secrets are then overlaid from environment variables.
Never commit
config.tomlor.env.reelforge. Secrets are read from config/env only; nothing is hardcoded in the services.
1. Precedence — the os.getenv overlay pattern
Every secret follows the same three-tier precedence, mirroring the base MPT
redis_host pattern (config.py:576):
# environment wins → then config.toml value → then empty string
anthropic["api_key"] = os.getenv("ANTHROPIC_API_KEY", anthropic.get("api_key", ""))
Order for every secret key: environment variable → config.toml value → "".
config.py (lines ~602–663) applies this overlay for [anthropic],
[elevenlabs], [heygen], [r2], [neon], [runpod], [stripe],
[iyzico], [creem], [polar], and [sentry]. [clerk] is the one
exception — it is read directly from the TOML file at verification time (see
§13) and has no os.getenv overlay.
Non-secret defaults are applied with setdefault() (never clobbering an
explicit value), e.g. app.setdefault("llm_provider", "litellm").
2. [app] — core runtime
Bound at config.py:525 as app (a _SynchronizedConfig). This is the base
MoneyPrinterTurbo section; ReelForge adds LLM + Celery defaults on top.
2.1 Redis / task state
| Key | Env override | Secret | Default | Feature |
|---|---|---|---|---|
redis_host |
MPT_APP_REDIS_HOST, then REDIS_HOST |
No | localhost |
Redis host (Celery broker/backend + MPT task store) |
redis_port |
REDIS_PORT (via .env) |
No | 6379 |
Redis port |
redis_db |
REDIS_DB (via .env) |
No | 0 |
Redis logical DB |
redis_password |
REDIS_PASSWORD (via .env) |
Yes | "" |
Redis auth (empty = no auth) |
enable_redis |
— | No | false |
Toggle Redis-backed MPT task state |
reelforge_oauth_state_ttl_s |
— | No | 600 |
TTL for shared, single-use OAuth CSRF states. OAuth connect requires Redis and fails closed when it is unavailable. |
reelforge_oauth_http_timeout_s |
— | No | 10 |
Timeout for TikTok/Instagram/YouTube OAuth token exchange and refresh HTTP calls. |
reelforge_idempotency_retention_hours |
— | No | 24 |
Retention window for durable POST /jobs idempotency keys; a daily bounded Celery sweep removes older records. |
reelforge_max_job_cost_usd |
— | No | 1.00 |
Reject a job variant before debit/enqueue when its estimated LLM, TTS, and avatar COGS exceeds this USD cap. 0 disables the cap explicitly. |
max_concurrent_tasks |
— | No | 5 |
Concurrent API video-gen tasks |
max_queued_tasks |
— | No | 100 |
Queued API video-gen tasks |
redis_host has special precedence: MPT_APP_REDIS_HOST → REDIS_HOST →
config value → localhost (config.py:576). In docker-compose.reelforge.yml,
REDIS_HOST is pinned to the redis service.
2.2 Celery (broker + result backend)
Per CTO §3.3, ReelForge does not add a separate [redis] section — Celery
reuses the [app] redis keys.
| Key | Env override | Secret | Default | Feature |
|---|---|---|---|---|
celery_broker_url |
CELERY_BROKER_URL (via .env, optional) |
No | composed redis://[:pw@]host:port/db |
Celery broker |
celery_result_backend |
CELERY_RESULT_BACKEND (via .env, optional) |
No | composed Redis URL | Celery result backend |
When unset, both are composed from the [app] redis keys by
config.py::_default_redis_url (setdefault, lines 588–594) and again by
app/workers/celery_app.py::_redis_url() — the explicit override is preferred,
otherwise redis://[:password@]host:port/db is built from the redis keys.
2.3 LLM provider (Claude via litellm)
| Key | Env override | Secret | Default | Feature |
|---|---|---|---|---|
llm_provider |
— | No | litellm (setdefault) |
Selects the LLM backend; litellm routes to Claude |
litellm_model_name |
— | No | anthropic/claude-sonnet-5 (setdefault) |
Model id passed to litellm |
litellm reads ANTHROPIC_API_KEY from the environment directly (see §5). The
base MPT [app] also carries per-provider LLM keys (moonshot_api_key,
openai_api_key, gemini_api_key, etc.) — these are secrets but are inherited
from upstream MoneyPrinterTurbo and are not part of the ReelForge Claude path.
2.4 Whisper selector + misc [app] keys
| Key | Secret | Default | Feature |
|---|---|---|---|
hide_config |
No | false |
Hide WebUI config panel |
tls_verify |
No | true |
Verify TLS for external APIs / downloads |
subtitle_provider |
No | edge |
"edge" or "whisper" caption engine (top-level key, not under [whisper]) |
video_source |
No | pexels |
Stock material source |
endpoint |
No | "" |
Public base URL for download links |
material_directory |
No | "" |
Where downloaded materials are stored |
The Whisper model settings live in their own
[whisper]section (§14);subtitle_providerin[app]selects whether Whisper is loaded at all.
2.5 Upload-Post (cross-platform publishing)
| Key | Secret | Default | Feature |
|---|---|---|---|
upload_post_enabled |
No | false |
Master switch for cross-posting |
upload_post_api_key |
Yes | "" |
Upload-Post API key |
upload_post_username |
No | "" |
Upload-Post account |
upload_post_platforms |
No | ["tiktok", "instagram"] |
Targets: tiktok, instagram, youtube |
upload_post_auto_upload |
No | false |
Auto-publish after successful render |
upload_post_youtube_privacy_status |
No | public |
public / unlisted / private |
upload_post_max_pending_tasks |
No | 10 |
Max concurrent/queued cross-post jobs |
Upload-Post has no os.getenv overlay — upload_post_api_key is read from
config.toml only. Cross-post jobs run in-process and are not resumed after a
restart.
2.6 OAuth direct-publish — SOCIAL_TOKEN_KEY (token encryption)
New this phase for the OAuth account-connect / direct-publish seam
(TikTok / Instagram / YouTube). These are config.app keys (there is no
os.getenv overlay in config.py); each is read directly, at use, by its
service.
| Key | Env override | Secret | Default | Feature |
|---|---|---|---|---|
social_token_key |
SOCIAL_TOKEN_KEY |
Yes | "" |
Fernet secret used to encrypt OAuth access/refresh tokens at rest. Required to connect any social account. |
<p>_client_id |
<P>_CLIENT_ID |
No | "" |
Per-provider OAuth client id, p ∈ {tiktok, instagram, youtube} |
<p>_client_secret |
<P>_CLIENT_SECRET |
Yes | "" |
Per-provider OAuth client secret |
SOCIAL_TOKEN_KEY is resolved by
app/services/crypto_tokens.py::_resolve_secret
env first (SOCIAL_TOKEN_KEY), then config.app["social_token_key"], then
"". It is the single boundary where a plaintext OAuth token becomes the opaque
blob stored in social_accounts.access_token_enc / refresh_token_enc; a
plaintext token is never persisted. The cipher is
cryptography.fernet.Fernet (AES-128-CBC + HMAC-SHA256); any non-empty secret is
accepted, stretched to a 32-byte url-safe key via
urlsafe_b64encode(sha256(secret)). Presence is validated lazily — when no
secret is configured, encrypt/decrypt raise MissingTokenKeyError (a clean
typed error, never a plaintext fallback). Rotating the secret invalidates all
previously-stored blobs (they can no longer be decrypted) — the intended
fail-closed behavior for a compromised key.
The per-provider <p>_client_id / <p>_client_secret pairs are read
env-first-then-config.app by
app/services/oauth_connect.py; a missing
client id raises OAuthConfigError at authorize time.
2.7 Public share pages — reelforge_share_*
New this phase for the public watermarked share pages
(app/controllers/v1/share.py). All are
config.app keys (no os.getenv overlay); set them in config.toml [app].
None are secrets.
| Key | Secret | Default | Feature |
|---|---|---|---|
reelforge_share_base_url |
No | "" |
Absolute base URL for the public share page; trailing / is stripped. Empty ⇒ the built link falls back to a site-relative /r/<token> (frontend resolves it against its own origin). |
reelforge_share_write_rate_limit |
No | 120 |
Max create/revoke writes per caller per window (POST /api/v1/jobs/{job_id}/share, DELETE /api/v1/me/shares/{token}) |
reelforge_share_write_rate_window_s |
No | 3600 |
Write rate-limit window (s) |
reelforge_share_view_rate_limit |
No | 600 |
Max public views per caller-IP per window (GET /api/v1/public/r/{token}) — generous, to survive real social traffic while blunting view-count inflation |
reelforge_share_view_rate_window_s |
No | 3600 |
Public-view rate-limit window (s) |
The public read path is unauthenticated and keyed by caller IP; the
write paths are keyed per-caller. Enforcement runs through
app/services/ratelimit.py, which degrades OPEN if Redis is unreachable (an
outage never hard-blocks sharing).
2.8 Per-API-key quota + rate limit — reelforge_api_key_rate_limit
New this phase for the power-user API-key tier
(app/services/apikey_quota.py). A single
config.app key (no os.getenv overlay). Not a secret.
| Key | Secret | Default | Feature |
|---|---|---|---|
reelforge_api_key_rate_limit |
No | 60 |
Plan/config fallback per-minute request rate for a key whose user_api_keys.rate_limit_per_min column is NULL |
- Nullable columns = plan defaults. A key's
rate_limit_per_minNULL ⇒ this config default; a non-positive effective limit disables the control (unlimited).monthly_quotaNULL ⇒ UNLIMITED — there is deliberately no config default for the monthly quota (it is a per-key column only). - Rate enforcement delegates to
app/services/ratelimit.py(60-second fixed window, bucket-namespaced by the key's non-secretprefix) and degrades OPEN when Redis is down. - Monthly consumption is tracked atomically per calendar month (
YYYY-MM) in theapi_key_usagetable. - A breach of either control raises
RateLimitExceeded/QuotaExceeded, which the API layer maps to a single HTTP429.
3. [anthropic] — Claude script generation
Bound at config.py:535.
| Key | Env override | Secret | Default | Feature |
|---|---|---|---|---|
api_key |
ANTHROPIC_API_KEY |
Yes | "" |
Claude access via litellm — script/idea/social-copy generation |
model |
— | No | claude-sonnet-5 |
Model label (the effective model is [app].litellm_model_name) |
Claude is reached through litellm: set [app] llm_provider = "litellm" and
litellm_model_name = "anthropic/claude-sonnet-5". litellm reads
ANTHROPIC_API_KEY from the environment.
4. [elevenlabs] — TTS + timing authority
Bound at config.py:530.
| Key | Env override | Secret | Default | Feature |
|---|---|---|---|---|
api_key |
ELEVENLABS_API_KEY |
Yes | "" |
ElevenLabs TTS + Video-to-Music |
model_id |
— | No | eleven_multilingual_v2 |
TTS model |
music_model_id |
— | No | music_v2 |
Video-to-Music model (same key) |
music_timeout |
— | No | 600 |
Music request stream timeout (s) |
word_timestamps |
— | No | true (setdefault, config.py:598) |
Route TTS through the /with-timestamps adapter |
word_timestamps is the timing backbone of ReelForge. When true, TTS is
routed through the ElevenLabs /with-timestamps adapter so that karaoke
captions and avatar-duration validation share one timing authority (per CTO
§3.3 / build-plan §3.4). Set false only for plain TTS with no karaoke timing.
5. [heygen] — talking-head avatar (tier 1)
Bound at config.py:534.
| Key | Env override | Secret | Default | Feature |
|---|---|---|---|---|
api_key |
HEYGEN_API_KEY |
Yes | "" |
HeyGen v2 audio-driven avatar (uses the X-Api-Key header) |
Consumed by app/services/avatar/heygen.py. HeyGen and RunPod/LatentSync sit
behind the same TalkingHeadProvider protocol.
6. [r2] — Cloudflare R2 object storage
Bound at config.py:536. Overlaid via r2.update({...}) at config.py:605.
| Key | Env override | Secret | Default | Feature |
|---|---|---|---|---|
account_id |
R2_ACCOUNT_ID |
No¹ | "" |
R2 account id (endpoint host) |
access_key_id |
R2_ACCESS_KEY_ID |
Yes | "" |
S3 access key |
secret_access_key |
R2_SECRET_ACCESS_KEY |
Yes | "" |
S3 secret key |
bucket |
R2_BUCKET |
No | "" |
Bucket name |
public_base_url |
R2_PUBLIC_BASE_URL² |
No | "" |
Public/CDN origin for permanent object URLs |
¹ Not a credential per se, but non-public. ² public_base_url is read from
config in the overlay; the .env example documents R2_PUBLIC_BASE_URL as the
env form. Feature: permanent hosting of rendered videos + presigned upload URLs.
7. [neon] — Postgres persistence
Bound at config.py:537.
| Key | Env override | Secret | Default | Feature |
|---|---|---|---|---|
database_url |
NEON_DATABASE_URL |
Yes | "" |
SQLAlchemy 2.0 + Alembic connection string |
pool_size |
— | No | 2 |
Per-process persistent connections; use Neon’s pooled/PgBouncer endpoint. Bounded to 1..20. |
max_overflow |
— | No | 2 |
Temporary extra connections above pool_size, bounded to 0..20. |
pool_timeout_s |
— | No | 30 |
Seconds to wait for a pool connection before failing, bounded to 1..120. |
pool_recycle_s |
— | No | 1800 |
Recycle pooled DB connections before stale serverless connections accumulate. |
Use the psycopg v3 driver form:
postgresql+psycopg://USER:PASSWORD@HOST/DBNAME?sslmode=require. Read by
app/models/db/base.py::_database_url().
8. [stripe] — global card billing
Bound at config.py:543. Credit packs are locked: Free = 3 (signup grant),
Starter = 30, Pro = 120 (1 credit = 1 rendered video).
| Key | Env override | Secret | Default | Feature |
|---|---|---|---|---|
secret_key |
STRIPE_SECRET_KEY |
Yes | "" |
Server-side API key (sk_live_…) — required for "enabled" |
webhook_secret |
STRIPE_WEBHOOK_SECRET |
Yes | "" |
Webhook signing secret (whsec_…) |
starter_price_id |
STRIPE_PRICE_STARTER |
No | "" |
Stripe Price id for the Starter pack |
pro_price_id |
STRIPE_PRICE_PRO |
No | "" |
Stripe Price id for the Pro pack |
success_url |
— | No | "" |
Hosted-checkout redirect on success |
cancel_url |
— | No | "" |
Hosted-checkout redirect on cancel |
Per-plan price ids are read by app/services/billing/plans.py via the
<key>_price_id convention (starter_price_id, pro_price_id).
9. [iyzico] — Turkey local cards
Bound at config.py:544.
| Key | Env override | Secret | Default | Feature |
|---|---|---|---|---|
api_key |
IYZICO_API_KEY |
Yes | "" |
iyzico API key — required for "enabled" |
secret_key |
IYZICO_SECRET_KEY |
Yes | "" |
iyzico secret — required for "enabled" |
base_url |
IYZICO_BASE_URL |
No | https://api.iyzipay.com |
API base (sandbox: https://sandbox-api.iyzipay.com) |
currency |
— | No | TRY |
Charge currency |
callback_url |
— | No | "" |
Post-payment redirect (server-to-server exchange) |
starter_amount |
— | No | "" |
Starter charge amount (decimal string, e.g. "49.00") |
pro_amount |
— | No | "" |
Pro charge amount (decimal string) |
Per-plan amounts are read by plans.py via <key>_amount. iyzico is
personal-purchase only (no workspace shared-pool metadata channel).
10. [creem] — merchant-of-record checkout
Bound at config.py:548.
| Key | Env override | Secret | Default | Feature |
|---|---|---|---|---|
api_key |
CREEM_API_KEY |
Yes | "" |
Creem API key (creem_…) — required for "enabled" |
webhook_secret |
CREEM_WEBHOOK_SECRET |
Yes | "" |
Webhook signing secret |
starter_product_id |
— | No | "" |
Creem Product id (Starter) |
pro_product_id |
— | No | "" |
Creem Product id (Pro) |
success_url |
— | No | "" |
Hosted-checkout success redirect |
cancel_url |
— | No | "" |
Hosted-checkout cancel redirect |
Per-plan product ids are read by plans.py via <key>_product_id.
11. [polar] — merchant-of-record checkout
Bound at config.py:549.
| Key | Env override | Secret | Default | Feature |
|---|---|---|---|---|
access_token |
POLAR_ACCESS_TOKEN |
Yes | "" |
Polar org access token (polar_oat_…) — required for "enabled" |
webhook_secret |
POLAR_WEBHOOK_SECRET |
Yes | "" |
Webhook signing secret |
starter_price_id |
— | No | "" |
Polar Price id (Starter) |
pro_price_id |
— | No | "" |
Polar Price id (Pro) |
success_url |
— | No | "" |
Hosted-checkout success redirect |
cancel_url |
— | No | "" |
Hosted-checkout cancel redirect |
Per-plan price ids are read by plans.py via <key>_price_id.
12. [runpod] — LatentSync talking-head (tier 2)
Bound at config.py:540. Behind the same TalkingHeadProvider protocol as
HeyGen; consumed by app/services/avatar/latentsync_runpod.py.
| Key | Env override | Secret | Default | Feature |
|---|---|---|---|---|
endpoint_id |
RUNPOD_ENDPOINT_ID |
No | "" |
RunPod Serverless endpoint id — required (fail-fast) |
api_key |
RUNPOD_API_KEY |
Yes | "" |
RunPod API key |
timeout_s |
— | No | 1800 (setdefault) |
Hard cap (s) for a single render poll loop (30 min) |
RunPodClient.__init__ raises RunPodError("runpod endpoint_id is not configured") when endpoint_id is empty.
13. [clerk] — hosted-mode JWT auth
Not initialized in config.py. Read defensively at verification time by
app/core/clerk.py::_clerk_config() via getattr(config, "clerk", {}). Add the
section to config.toml only for the hosted/multi-tenant product; when absent,
auth falls back to the Phase-1 x-api-key path with no behavior change.
| Key | Env override | Secret | Default | Feature |
|---|---|---|---|---|
jwks_url |
— | No | "" |
Clerk JWKS endpoint (else derived from issuer) |
issuer |
— | No | "" |
Clerk issuer; JWKS derived as <issuer>/.well-known/jwks.json |
audience |
— | No | "" |
Expected aud claim (enforced only when set) |
algorithms |
— | No | ("RS256",) |
Allowed signing algorithms |
clerk.is_configured() returns True only when a JWKS URL (or issuer) resolves.
None of these are secrets — they are public verification metadata.
14. [sentry] — error / performance monitoring
Bound at config.py:553. Fully optional (CTO locked decision). When dsn is
empty, app/telemetry/sentry.py::init_sentry() logs "disabled" and returns — a
NO-OP, so no key is required to ship.
| Key | Env override | Secret | Default | Feature |
|---|---|---|---|---|
dsn |
SENTRY_DSN |
Yes | "" |
Sentry project DSN. Empty = monitoring disabled (NO-OP) |
environment |
SENTRY_ENVIRONMENT |
No | "" |
Deployment tag (production, staging, …) |
traces_sample_rate |
— | No | 0.0 (setdefault) |
Perf-tracing sample rate [0.0, 1.0]; 0.0 = errors only |
15. Supporting sections (base MPT)
These are inherited from MoneyPrinterTurbo and bound in config.py:
| Section | Bound as | Notable keys | Secret keys |
|---|---|---|---|
[whisper] |
whisper (config.py:526) |
model_size (large-v3), device (cpu/cuda), compute_type (int8), initial_prompt |
none |
[proxy] |
proxy |
http, https |
none (may embed creds) |
[azure] |
azure |
speech_key, speech_region |
speech_key |
[siliconflow] |
siliconflow |
api_key |
api_key |
[chatterbox] |
chatterbox |
base_url, api_key, model_id, voices |
api_key |
[ui] |
ui |
hide_log, language, fonts/colors |
none |
[whisper] holds the Whisper model config; whether Whisper runs at all is
controlled by [app].subtitle_provider (§2.4).
Note: save_config() re-serializes an explicit list of sections
(config.py:461) that includes [ui] and all ReelForge sections, but not
[whisper] or [proxy] — those are read at load time and edit them in
config.toml directly.
16. Fail-fast validation (build-plan §3.4)
ReelForge validates configuration lazily, at first use of each dependency,
and raises a clear RuntimeError/typed error instead of degrading silently.
This keeps startup import-safe while guaranteeing a broken config surfaces the
moment a feature that needs it is invoked.
| Dependency | Where | Behavior when misconfigured |
|---|---|---|
| Cloudflare R2 | app/platform/storage/r2.py::R2Client.__init__ |
Raises RuntimeError("Cloudflare R2 is not configured. Missing required config.r2 keys: …") — checks _REQUIRED_CONFIG_KEYS (account_id, access_key_id, secret_access_key, bucket). Also raises if boto3 is not installed. |
| Neon / Postgres | app/models/db/base.py::get_engine |
Raises RuntimeError("No database URL configured. Set config.neon.database_url or the NEON_DATABASE_URL environment variable.") |
| RunPod / LatentSync | app/services/avatar/latentsync_runpod.py::RunPodClient.__init__ |
Raises RunPodError("runpod endpoint_id is not configured") |
| Clerk JWT | app/core/clerk.py::verify_clerk_jwt |
Raises ClerkAuthError("Clerk is not configured") if no JWKS URL; ClerkAuthError("PyJWT is not installed") if the optional dep is absent |
Common properties:
- Import-safe. Optional deps (
boto3,PyJWT) are imported behind guards; an absent dependency raises a clean typed error at call time, never anImportErrorat startup. - Actionable messages. Each error names the exact missing config key(s) and the env var that can supply them.
- No silent degradation. A missing required key fails the operation rather than producing a broken artifact.
17. The "enabled only when configured" pattern
Optional capabilities are exposed to clients only when their required config is present, so the UI renders just the rails that will actually work. This is the inverse of fail-fast: instead of erroring, the feature is simply omitted.
Billing providers — GET /api/v1/billing/providers
Implemented in app/controllers/v1/billing.py::list_providers →
app/services/billing/service.py::list_enabled_providers().
A provider is "enabled" when every key in _PROVIDER_REQUIRED_KEYS is
present and non-empty (service.py:63):
_PROVIDER_REQUIRED_KEYS = {
"stripe": ("secret_key",),
"iyzico": ("api_key", "secret_key"),
"creem": ("api_key",),
"polar": ("access_token",),
}
def _provider_configured(provider: str) -> bool:
section = _config_section(provider)
required = _PROVIDER_REQUIRED_KEYS.get(provider, ())
if not required:
return False
return all(str(section.get(key, "") or "").strip() for key in required)
def list_enabled_providers() -> list[str]:
# order follows _SUPPORTED_PROVIDERS = ("stripe","iyzico","creem","polar")
return [p for p in _SUPPORTED_PROVIDERS if _provider_configured(p)]
So GET /api/v1/billing/providers returns, e.g., {"providers": ["stripe", "polar"]} when only Stripe and Polar have their secrets set — an unconfigured
provider is never offered, and checkout can never be attempted against a rail
that would fail. The same pattern drives the AI-BGM / AI-music provider lists in
app/controllers/v1/catalog.py (providers whose credentials are configured are
reported as is_enabled), and Sentry (§14) uses the same idea: empty dsn =
feature off, no key needed to ship.