# How to Configure MoneyPrinterTurbo Using config.toml

> Learn how to configure MoneyPrinterTurbo using its config.toml file. This guide explains the essential settings and how to customize your MoneyPrinterTurbo setup for optimal performance.

- Repository: [Harry/MoneyPrinterTurbo](https://github.com/harry0703/MoneyPrinterTurbo)
- Tags: how-to-guide
- Published: 2026-03-23

---

**MoneyPrinterTurbo reads all runtime settings from a [`config.toml`](https://github.com/harry0703/MoneyPrinterTurbo/blob/main/config.toml) file in the repository root, automatically copying from [`config.example.toml`](https://github.com/harry0703/MoneyPrinterTurbo/blob/main/config.example.toml) on first launch, and exposes configuration sections as Python globals through [`app/config/config.py`](https://github.com/harry0703/MoneyPrinterTurbo/blob/main/app/config/config.py).**

MoneyPrinterTurbo is an open-source AI video generation tool that automates content creation from text prompts. All operational parameters—from API keys to UI preferences—are controlled through a single **TOML configuration file**. This guide explains exactly how the configuration system works, where the [`config.toml`](https://github.com/harry0703/MoneyPrinterTurbo/blob/main/config.toml) file lives, and how to modify settings both manually and programmatically.

## Where MoneyPrinterTurbo Stores Configuration

The application resolves the configuration file path dynamically in [`app/config/config.py`](https://github.com/harry0703/MoneyPrinterTurbo/blob/main/app/config/config.py). The loader calculates the repository root and expects [`config.toml`](https://github.com/harry0703/MoneyPrinterTurbo/blob/main/config.toml) to exist at the top level:

```python
root_dir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.realpath(__file__))))
config_file = f"{root_dir}/config.toml"

```

If [`config.toml`](https://github.com/harry0703/MoneyPrinterTurbo/blob/main/config.toml) is missing when the application starts, the `load_config()` function (lines 12‑33) automatically creates it by copying [`config.example.toml`](https://github.com/harry0703/MoneyPrinterTurbo/blob/main/config.example.toml), ensuring users always begin with a documented template.

## How the Configuration Loader Works

The `load_config()` function handles three critical tasks:

1. **Template fallback** — If [`config.toml`](https://github.com/harry0703/MoneyPrinterTurbo/blob/main/config.toml) does not exist, it copies [`config.example.toml`](https://github.com/harry0703/MoneyPrinterTurbo/blob/main/config.example.toml) to the expected location (lines 17‑21).
2. **TOML parsing with BOM support** — It parses the file using the `toml` library, with a UTF‑8‑SIG fallback to handle Windows-style byte-order marks (lines 25‑32).
3. **Global exposure** — The parsed dictionary is stored in module-level variable `_cfg`, and top-level sections (`app`, `azure`, `siliconflow`, `ui`, `proxy`) are exposed as convenient globals (lines 44‑55).

The complementary `save_config()` function (lines 35‑42) serializes the in-memory configuration back to disk. This allows runtime changes—such as adding API keys through the Web UI—to persist across restarts.

## Key Configuration Sections in config.toml

The [`config.example.toml`](https://github.com/harry0703/MoneyPrinterTurbo/blob/main/config.example.toml) template defines several functional groups. Below are the essential sections you must configure to run MoneyPrinterTurbo.

### App Settings

The `[app]` section controls video sources, LLM providers, and API credentials:

```toml
[app]

# Choose video source: "pexels" or "pixabay"

video_source = "pexels"

# API keys for stock footage (comma-separated lists work in the UI)

pexels_api_keys = ["YOUR_PEXELS_KEY"]
pixabay_api_keys = ["YOUR_PIXABAY_KEY"]

# LLM configuration

llm_provider = "openai"
openai_api_key = "sk-..."
openai_model_name = "gpt-4o-mini"

# Optional: Hide the basic settings panel in the Web UI

hide_config = false

```

### UI Customization

The `[ui]` section defines appearance parameters for the generated video overlays:

```toml
[ui]
font_name = "MicrosoftYaHeiBold.ttc"
font_size = 60
text_fore_color = "#FFFFFF"
hide_log = false

```

### Proxy Configuration

For users behind corporate firewalls, the `[proxy]` section routes external API calls:

```toml
[proxy]
http = "http://user:pass@proxy:3128"
https = "http://user:pass@proxy:3128"

```

The underlying `requests` library automatically consumes these values when fetching assets from Pexels or Pixabay.

## Modifying Configuration via the Web UI

The Streamlit interface in [`webui/Main.py`](https://github.com/harry0703/MoneyPrinterTurbo/blob/main/webui/Main.py) interacts directly with the global configuration objects. When you edit a field—such as adding a new Pexels API key—the UI updates `config.app["pexels_api_keys"]` and immediately calls `config.save_config()` to persist the change (see implementation around lines 945‑959).

This design allows non-technical users to manage API keys without touching the filesystem, while developers can still version-control [`config.toml`](https://github.com/harry0703/MoneyPrinterTurbo/blob/main/config.toml) for deployment automation.

## Accessing and Modifying Configuration in Python

Service modules throughout the codebase import the global configuration to retrieve credentials at runtime.

### Reading Configuration Values

```python
from app.config import config

# Retrieve video source with fallback default

source = config.app.get("video_source", "pexels")
print(f"Fetching footage from: {source}")

# Access Azure Speech credentials (as seen in app/services/voice.py)

azure_key = config.azure.get("speech_key")

```

### Updating Configuration Programmatically

To modify settings in code and persist them to disk:

```python
from app.config import config

# Append a new API key at runtime

new_key = "sk-new-api-key"
if new_key not in config.app.get("openai_api_key", []):
    config.app["openai_api_key"] = new_key
    config.save_config()  # Writes to config.toml immediately

```

### Initial Setup Commands

On first run, generate the configuration file by starting the application:

```bash

# Auto-creates config.toml from config.example.toml

python -m main

# Or with Docker:

docker compose up

```

After generation, edit [`config.toml`](https://github.com/harry0703/MoneyPrinterTurbo/blob/main/config.toml) directly or use the Web UI at `http://localhost:8501` to complete setup.

## Summary

- **Location**: [`config.toml`](https://github.com/harry0703/MoneyPrinterTurbo/blob/main/config.toml) resides in the repository root, resolved dynamically by [`app/config/config.py`](https://github.com/harry0703/MoneyPrinterTurbo/blob/main/app/config/config.py).
- **Bootstrap**: The system copies [`config.example.toml`](https://github.com/harry0703/MoneyPrinterTurbo/blob/main/config.example.toml) to [`config.toml`](https://github.com/harry0703/MoneyPrinterTurbo/blob/main/config.toml) automatically if the latter is missing.
- **Structure**: Key sections include `[app]` for API keys and providers, `[ui]` for visual styling, and `[proxy]` for network routing.
- **Persistence**: The `save_config()` function writes runtime changes back to disk, enabling both manual file edits and UI-driven updates.
- **Access**: Import `from app.config import config` to read current values anywhere in the codebase.

## Frequently Asked Questions

### What happens if I delete config.toml?

MoneyPrinterTurbo will regenerate it on the next startup by copying [`config.example.toml`](https://github.com/harry0703/MoneyPrinterTurbo/blob/main/config.example.toml). You will lose any custom API keys or settings, so back up the file before deletion.

### Can I use multiple API keys for the same service?

Yes. The `[app]` section supports arrays for providers like Pexels. Define them as TOML arrays: `pexels_api_keys = ["key1", "key2"]`. The application rotates through them or uses them for redundancy.

### How do I change the font used in generated videos?

Edit the `[ui]` section in [`config.toml`](https://github.com/harry0703/MoneyPrinterTurbo/blob/main/config.toml). Set `font_name` to a valid system font file (e.g., `ArialBold.ttf`) and adjust `font_size` and `text_fore_color` to match your branding.

### Is it safe to commit config.toml to Git?

No. The file contains sensitive API keys. The repository includes [`config.toml`](https://github.com/harry0703/MoneyPrinterTurbo/blob/main/config.toml) in `.gitignore` by default. Commit [`config.example.toml`](https://github.com/harry0703/MoneyPrinterTurbo/blob/main/config.example.toml) instead, which contains placeholder values and documentation.