Skip to main content

Documentation Index

Fetch the complete documentation index at: https://mintlify.com/FujiwaraChoki/MoneyPrinter/llms.txt

Use this file to discover all available pages before exploring further.

Configuration

MoneyPrinter reads configuration from a .env file in the project root. Use .env.example as your starting template.

Environment File

Create your configuration file:
cp .env.example .env
Edit .env with your preferred text editor:
.env
# Required API Keys
TIKTOK_SESSION_ID=""
PEXELS_API_KEY=""

# Optional Configuration
IMAGEMAGICK_BINARY=""
OLLAMA_BASE_URL="http://localhost:11434"
OLLAMA_MODEL="llama3.1:8b"
OLLAMA_TIMEOUT="180"
ASSEMBLY_AI_API_KEY=""

# Database (Docker)
POSTGRES_DB="moneyprinter"
POSTGRES_USER="moneyprinter"
POSTGRES_PASSWORD="moneyprinter"
DATABASE_URL=""

Required Variables

TIKTOK_SESSION_ID

Description: TikTok session cookie used for text-to-speech API calls. How to obtain:
1

Log into TikTok

Open tiktok.com in your browser and log in.
2

Open Developer Tools

Press F12 or right-click and select “Inspect Element”.
3

Navigate to Cookies

Go to ApplicationCookieshttps://www.tiktok.com.
4

Copy sessionid

Find the sessionid cookie and copy its value.
.env
TIKTOK_SESSION_ID="abc123def456..."
The session ID may expire periodically. If TTS fails with authentication errors, refresh this value.

PEXELS_API_KEY

Description: API key for fetching stock video clips from Pexels. How to obtain:
1

Create Pexels account

Sign up at pexels.com/api.
2

Generate API key

Navigate to your API dashboard and generate a new key.
.env
PEXELS_API_KEY="your_pexels_api_key_here"
Pexels offers a generous free tier (200 requests/hour). No credit card required.

Optional Variables

IMAGEMAGICK_BINARY

Description: Absolute path to the ImageMagick executable. Default: Auto-detect from PATH The backend auto-detects ImageMagick on startup:
Backend/utils.py
def resolve_imagemagick_binary() -> Optional[str]:
    configured_binary = os.getenv("IMAGEMAGICK_BINARY", "").strip().strip('"')
    if configured_binary:
        expanded = Path(configured_binary).expanduser()
        if expanded.exists():
            return str(expanded.resolve())

    candidate_names = [
        "magick",
        "magick.exe",
        "convert",
        "convert.exe",
    ]

    for candidate in candidate_names:
        found = shutil.which(candidate)
        if found:
            return found

    return None
If auto-detection fails, set the path explicitly:
IMAGEMAGICK_BINARY="/usr/local/bin/magick"
Windows paths must use double backslashes (\\) or forward slashes (/).

OLLAMA_BASE_URL

Description: Base URL of the Ollama server for model listing and chat generation. Default: http://localhost:11434 Used by the Ollama client:
Backend/gpt.py
OLLAMA_BASE_URL = os.getenv("OLLAMA_BASE_URL", "http://localhost:11434").rstrip("/")

def _ollama_client() -> Client:
    return Client(host=OLLAMA_BASE_URL, timeout=OLLAMA_TIMEOUT)
Examples:
.env
# Local Ollama
OLLAMA_BASE_URL="http://localhost:11434"

# Docker backend connecting to host Ollama
OLLAMA_BASE_URL="http://host.docker.internal:11434"

# Remote Ollama server
OLLAMA_BASE_URL="http://192.168.1.100:11434"

OLLAMA_MODEL

Description: Fallback model name if the frontend doesn’t specify one. Default: llama3.1:8b
Backend/gpt.py
OLLAMA_MODEL = os.getenv("OLLAMA_MODEL", "llama3.1:8b")

def generate_response(prompt: str, ai_model: str) -> str:
    model_name = (ai_model or "").strip() or OLLAMA_MODEL
    # ...
Pull the model before use:
ollama pull llama3.1:8b
Recommended models:
ModelSizeSpeedQualityUse Case
llama3.1:8b4.7GBFastGoodGeneral purpose
mistral:7b4.1GBVery FastGoodQuick iterations
llama3.1:70b40GBSlowExcellentBest quality (GPU required)
qwen2.5:7b4.7GBFastGoodMultilingual

OLLAMA_TIMEOUT

Description: Timeout in seconds for Ollama API requests. Default: 180 (3 minutes)
Backend/gpt.py
OLLAMA_TIMEOUT = float(os.getenv("OLLAMA_TIMEOUT", "180"))

def _ollama_client() -> Client:
    return Client(host=OLLAMA_BASE_URL, timeout=OLLAMA_TIMEOUT)
Increase this value if you’re using large models that take longer to respond:
.env
# For slower models or resource-constrained systems
OLLAMA_TIMEOUT=300
Large models (70B+) may require longer timeouts, especially on CPU-only systems.

ASSEMBLY_AI_API_KEY

Description: API key for AssemblyAI subtitle generation. If empty, local subtitle generation is used. Default: Empty (use local processing)
.env
ASSEMBLY_AI_API_KEY="your_assemblyai_key_here"
Local vs AssemblyAI subtitles:
FeatureLocalAssemblyAI
CostFreePaid ($0.00025/sec)
QualityBasicHigh accuracy
SpeedFastNetwork latency
PrivacyFully localCloud upload
For most use cases, local subtitle generation is sufficient. AssemblyAI provides better accuracy for complex audio.

Database Configuration

DATABASE_URL

Description: SQLAlchemy connection string for the job queue database. Default: sqlite:///moneyprinter.db (local file) The database is initialized on startup:
Backend/db.py
import os
from sqlalchemy import create_engine
from sqlalchemy.orm import declarative_base, sessionmaker

DATABASE_URL = os.getenv(
    "DATABASE_URL",
    "sqlite:///moneyprinter.db"
)

engine = create_engine(DATABASE_URL)
SessionLocal = sessionmaker(bind=engine)
Base = declarative_base()
Examples:
.env
# Local SQLite (default)
DATABASE_URL="sqlite:///moneyprinter.db"

# Docker Postgres
DATABASE_URL="postgresql+psycopg://moneyprinter:moneyprinter@postgres:5432/moneyprinter"

# External Postgres
DATABASE_URL="postgresql+psycopg://user:pass@host:5432/dbname"

POSTGRES_DB, POSTGRES_USER, POSTGRES_PASSWORD

Description: Docker Compose Postgres service configuration. Defaults:
  • POSTGRES_DB=moneyprinter
  • POSTGRES_USER=moneyprinter
  • POSTGRES_PASSWORD=moneyprinter
Used by docker-compose.yml:
docker-compose.yml
services:
  postgres:
    image: postgres:16-alpine
    environment:
      - POSTGRES_DB=${POSTGRES_DB:-moneyprinter}
      - POSTGRES_USER=${POSTGRES_USER:-moneyprinter}
      - POSTGRES_PASSWORD=${POSTGRES_PASSWORD:-moneyprinter}
Production: Change POSTGRES_PASSWORD to a strong, unique password.

Validation

The backend validates required variables on startup:
Backend/utils.py
def check_env_vars() -> None:
    required_vars = ["PEXELS_API_KEY", "TIKTOK_SESSION_ID"]
    missing_vars = []
    
    for var in required_vars:
        value = os.getenv(var)
        if value is None or len(value) == 0:
            missing_vars.append(var)

    if missing_vars:
        logger.error(
            f"Missing environment variables: {', '.join(missing_vars)}"
        )
        sys.exit(1)

    # Verify ImageMagick
    imagemagick_binary = resolve_imagemagick_binary()
    if not imagemagick_binary:
        logger.error("ImageMagick not found")
        sys.exit(1)
If variables are missing, the backend exits with an error:
ERROR: The following environment variables are missing: PEXELS_API_KEY, TIKTOK_SESSION_ID
Please consult 'docs/configuration.md' for setup instructions.

Next Steps

Quickstart

Generate your first video

Docker Setup

Deploy with Docker Compose

Ollama Models

Install and select Ollama models

Troubleshooting

Common configuration issues