# How to Integrate MoneyPrinterTurbo with Pixabay API: Complete Configuration Guide

> Integrate MoneyPrinterTurbo with Pixabay API easily. This guide shows configuration for automatic royalty-free video clip retrieval. Get started now.

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

---

**MoneyPrinterTurbo includes native Pixabay API support that activates automatically once you configure your API key and set the video source to "pixabay", enabling automatic retrieval of royalty-free video clips.**

MoneyPrinterTurbo streamlines automated video generation by integrating directly with Pixabay's extensive library of royalty-free footage. By configuring the Pixabay API integration, you enable the application to automatically search, filter, and download relevant video clips that match your generated scripts. This guide covers the complete integration process using both the configuration file and Streamlit UI, with references to the specific implementation details found in the MoneyPrinterTurbo source code.

## Step 1: Obtain Your Pixabay API Key

Before configuring MoneyPrinterTurbo, you must generate a Pixabay API key:

1. Visit the [Pixabay API documentation](https://pixabay.com/api/docs/) and create a free account.
2. Navigate to your account settings and copy your API key.
3. Store this key securely—you'll need it for the next configuration step.

Pixabay offers generous rate limits for free accounts, making it ideal for automated video generation workflows.

## Step 2: Configure the API Key in MoneyPrinterTurbo

MoneyPrinterTurbo retrieves your Pixabay credentials through the `pixabay_api_keys` configuration parameter. According to [`app/services/material.py`](https://github.com/harry0703/MoneyPrinterTurbo/blob/main/app/services/material.py) (lines 17-31), the system calls `get_api_key("pixabay_api_keys")` to retrieve credentials when initializing searches.

### Option A: Using config.toml

Copy the example configuration file and add your key:

```toml

# config.toml (copied from config.example.toml)

pixabay_api_keys = "YOUR_PIXABAY_API_KEY"

```

The application loads this value at startup via [`app/config.py`](https://github.com/harry0703/MoneyPrinterTurbo/blob/main/app/config.py). You can also specify multiple keys separated by commas to enable automatic rotation.

### Option B: Using the Streamlit UI

For users running the web interface:

1. Launch the application: `streamlit run webui/Main.py`.
2. Expand **Video Source Settings** in the sidebar.
3. Paste your key into the **Pixabay API Key** field (implemented in [`webui/Main.py`](https://github.com/harry0703/MoneyPrinterTurbo/blob/main/webui/Main.py), lines 75-79).
4. Click **Save** to persist the configuration.

The UI mirrors the configuration file settings and stores the key for subsequent API calls.

## Step 3: Select Pixabay as Your Video Source

After configuring your API key, specify Pixabay as the video provider:

- **Via UI**: Select **Pixabay** from the *Video Source* dropdown menu.
- **Via configuration**: Set `video_source = "pixabay"` in your [`config.toml`](https://github.com/harry0703/MoneyPrinterTurbo/blob/main/config.toml).

When you initiate video generation, MoneyPrinterTurbo invokes the download pipeline. The source selection logic in [`webui/Main.py`](https://github.com/harry0703/MoneyPrinterTurbo/blob/main/webui/Main.py) (lines 1001-1012) routes requests to the Pixabay-specific downloader when this setting is active.

## How the Pixabay Integration Works (Source Code Deep Dive)

Understanding the internal implementation helps troubleshoot integration issues and optimize your workflow.

### The Search Implementation

The core Pixabay search logic resides in [`app/services/material.py`](https://github.com/harry0703/MoneyPrinterTurbo/blob/main/app/services/material.py) (lines 91-138) within the `search_videos_pixabay()` function:

- **Authentication**: The function retrieves your stored key using `get_api_key("pixabay_api_keys")`.
- **Request Construction**: It builds the endpoint URL `https://pixabay.com/api/videos/` with your search terms and API key as query parameters (lines 100-108).
- **Response Processing**: The function parses the JSON response, filters results by minimum duration requirements, and instantiates `MaterialInfo` objects with the `provider` field set to `"pixabay"` (lines 121-138).

### Video Download Pipeline

Once search results are returned, the `download_videos()` function handles the actual file retrieval. According to [`webui/Main.py`](https://github.com/harry0703/MoneyPrinterTurbo/blob/main/webui/Main.py) (lines 1001-1012), the system:

1. Validates the selected video source.
2. Calls the appropriate search function based on the `source` parameter.
3. Downloads matching videos to your configured `material_directory` (default: `cache_videos`).
4. Caches files to avoid redundant API calls for identical search terms.

## Programmatic Usage Example

You can trigger Pixabay video downloads directly from Python without using the UI:

```python
from app.services.material import download_videos
from app.models.schema import VideoAspect, VideoConcatMode

# Download videos matching "city skyline" from Pixabay

video_paths = download_videos(
    task_id="demo_task",
    search_terms=["city skyline"],
    source="pixabay",                     # Specify Pixabay as the source

    video_aspect=VideoAspect.landscape,   # Options: landscape, portrait

    video_concat_mode=VideoConcatMode.random,
    audio_duration=120,                   # Match video length to audio (seconds)

    max_clip_duration=10,                 # Maximum clip length per segment

)

print(f"Downloaded {len(video_paths)} videos: {video_paths}")

```

This code invokes `search_videos_pixabay()` internally, which executes the API call using your configured credentials and returns local file paths to the downloaded MP4 files.

## Summary

- **MoneyPrinterTurbo includes native Pixabay support** through the `search_videos_pixabay()` function in [`app/services/material.py`](https://github.com/harry0703/MoneyPrinterTurbo/blob/main/app/services/material.py).
- **Configuration requires only your API key** added to `pixabay_api_keys` in [`config.toml`](https://github.com/harry0703/MoneyPrinterTurbo/blob/main/config.toml) or the Streamlit UI (lines 75-79 of [`webui/Main.py`](https://github.com/harry0703/MoneyPrinterTurbo/blob/main/webui/Main.py)).
- **Automatic key rotation** is supported if you provide multiple API keys separated by commas.
- **Source selection** triggers the Pixabay pipeline when set to `"pixabay"` (handled in [`webui/Main.py`](https://github.com/harry0703/MoneyPrinterTurbo/blob/main/webui/Main.py), lines 1001-1012).
- **Downloaded videos** are cached in your configured `material_directory` to optimize repeated generations.

## Frequently Asked Questions

### Can I use multiple Pixabay API keys with MoneyPrinterTurbo?

Yes. The `pixabay_api_keys` configuration parameter accepts comma-separated values (e.g., `"key1,key2,key3"`). According to the implementation in [`app/services/material.py`](https://github.com/harry0703/MoneyPrinterTurbo/blob/main/app/services/material.py) (lines 17-31), the application automatically rotates through available keys when making requests to the `https://pixabay.com/api/videos/` endpoint, helping distribute rate limits across multiple accounts.

### Where does MoneyPrinterTurbo store downloaded Pixabay videos?

Downloaded files are stored in the directory specified by `material_directory` in your [`config.toml`](https://github.com/harry0703/MoneyPrinterTurbo/blob/main/config.toml) file, defaulting to `cache_videos` in the project root. The `download_videos()` function manages this caching automatically, reusing existing files when search terms match previously downloaded content to minimize redundant API calls.

### What happens if the Pixabay API returns no results for my search terms?

If `search_videos_pixabay()` returns an empty list after filtering (lines 121-138 of [`app/services/material.py`](https://github.com/harry0703/MoneyPrinterTurbo/blob/main/app/services/material.py)), the application logs a warning and either skips the video segment or falls back to alternative sources if configured. Ensure your search terms are generic enough to match Pixabay's video library, as highly specific phrases may yield limited results.

### Is there a way to filter Pixabay videos by duration or aspect ratio?

Yes. The `search_videos_pixabay()` function filters API results by minimum duration before returning `MaterialInfo` objects (lines 121-138). Additionally, you can specify `video_aspect` (landscape or portrait) and `max_clip_duration` parameters when calling `download_videos()`, which further refines the selection during the download phase according to your project requirements.