MoneyPrinterTurbo API Endpoints: Complete FastAPI Reference Guide
MoneyPrinterTurbo exposes 14 REST API endpoints via FastAPI for automated video generation, task orchestration, media asset management, and LLM-powered content creation, all defined in app/controllers/v1/video.py and app/controllers/v1/llm.py.
MoneyPrinterTurbo is an open-source automated video generation service that provides a programmable interface for creating short-form content. The API is built on FastAPI and organizes routes under versioned controllers, allowing developers to generate videos, manage background music, and automate scriptwriting through HTTP requests.
API Architecture and Routing Structure
The application mounts all public routes through a root router defined in app/router.py. This router aggregates versioned sub-routers from the app/controllers/v1/ directory, specifically separating video processing logic from LLM operations.
The endpoint surface is divided into three logical layers:
- Core Video Pipeline: Endpoints for full video generation, subtitle creation, and audio synthesis
- Task and Asset Management: CRUD operations for tasks and local media file handling
- Content Generation: LLM-powered endpoints for script and keyword generation
All endpoints return JSON responses following the schema models defined in app/models/schema.py, with the exception of the streaming and download endpoints which return binary content.
Video Generation Pipeline Endpoints
The video controller in app/controllers/v1/video.py implements three primary creation endpoints that handle different stages of the production pipeline.
POST /videos creates a complete short video through the full automation pipeline. Located at line 56 in app/controllers/v1/video.py, this endpoint accepts parameters including video_subject, video_aspect, voice_name, and bgm_type, returning a task ID for asynchronous tracking.
POST /subtitle generates subtitle files independently without video rendering. Implemented at line 63, this endpoint processes a script and returns subtitle timing data.
POST /audio synthesizes speech audio from a provided script using the configured text-to-speech provider. This endpoint is defined at line 70.
Task Lifecycle Management
The API provides comprehensive task monitoring and cleanup capabilities through the following endpoints in app/controllers/v1/video.py:
GET /tasks(line 101): Retrieves a paginated list of all video generation tasks. Acceptspageandpage_sizequery parameters.GET /tasks/{task_id}(line 116): Returns the current status, progress, and output URLs for a specific task UUID.DELETE /tasks/{task_id}(line 161): Removes a task record and deletes associated generated files from storage.
Media Asset Management
MoneyPrinterTurbo maintains local repositories for background music and video materials, exposed through these endpoints:
Background Music (/musics):
GET /musics(line 84): Lists all available.mp3files in the local BGM directoryPOST /musics(line 104): Uploads a new background music file with multipart/form-data encoding
Video Materials (/video_materials):
GET /video_materials(line 27): Lists local video and image assets available for compositionPOST /video_materials(line 49): Uploads media files with support formp4,mov,avi,flv,mkv,jpg,jpeg, andpngformats
LLM Content Generation Endpoints
The LLM controller in app/controllers/v1/llm.py provides endpoints for automated content creation using large language models:
POST /scripts(line 18): Generates a video script from a specified subject. Acceptsvideo_subject,video_language, andparagraph_numberparameters.POST /terms(line 33): Extracts visual search terms and keywords from a provided script to facilitate media asset retrieval.
File Delivery and Streaming
For retrieving completed content, the API offers two delivery mechanisms defined in app/controllers/v1/video.py:
GET /stream/{file_path:path} (line 73): Streams video files with HTTP range request support, enabling partial content delivery for large files and adaptive playback.
GET /download/{file_path:path} (line 84): Returns generated files as downloadable attachments using the Content-Disposition header.
Practical API Usage Examples
Health Check Endpoint
Verify service availability using the simple ping endpoint defined in app/controllers/ping.py:
curl -X GET http://localhost:8000/ping
import requests
response = requests.get("http://localhost:8000/ping")
print(response.text) # Output: "pong"
Creating a Full Video
Submit a video generation task to the POST /videos endpoint:
curl -X POST http://localhost:8000/videos \
-H "Content-Type: application/json" \
-d '{
"video_subject": "春天的花海",
"video_aspect": "portrait",
"voice_name": "zh-CN-XiaoxiaoNeural-Female",
"bgm_type": "random"
}'
import requests
payload = {
"video_subject": "春天的花海",
"video_aspect": "portrait",
"voice_name": "zh-CN-XiaoxiaoNeural-Female",
"bgm_type": "random"
}
response = requests.post("http://localhost:8000/videos", json=payload)
print(response.json())
# {"status":200,"message":"success","data":{"task_id":"<uuid>"}}
Monitoring Task Status
Poll the task status endpoint to track progress:
curl -X GET "http://localhost:8000/tasks/<task_id>"
task_id = "6c85c8cc-a77a-42b9-bc30-947815aa0558"
response = requests.get(f"http://localhost:8000/tasks/{task_id}")
print(response.json())
Downloading Generated Files
Retrieve completed videos using the download endpoint:
curl -OJ "http://localhost:8000/download/6c85c8cc-a77a-42b9-bc30-947815aa0558/final-1.mp4"
download_url = f"http://localhost:8000/download/{task_id}/final-1.mp4"
with requests.get(download_url, stream=True) as r:
r.raise_for_status()
with open("final-1.mp4", "wb") as f:
for chunk in r.iter_content(chunk_size=8192):
f.write(chunk)
Generating Scripts via LLM
Create video scripts programmatically:
curl -X POST http://localhost:8000/scripts \
-H "Content-Type: application/json" \
-d '{"video_subject":"春天的花海","video_language":"zh","paragraph_number":1}'
payload = {
"video_subject": "春天的花海",
"video_language": "zh",
"paragraph_number": 1
}
response = requests.post("http://localhost:8000/scripts", json=payload)
print(response.json()["data"]["video_script"])
Uploading Background Music
Add custom BGM files to the local library:
curl -X POST http://localhost:8000/musics \
-F "file=@/path/to/track.mp3"
files = {"file": open("/path/to/track.mp3", "rb")}
response = requests.post("http://localhost:8000/musics", files=files)
print(response.json())
Core Implementation Files
The following source files define the MoneyPrinterTurbo API surface:
app/router.py: Root router that aggregates versioned sub-routers (video,llm)app/controllers/v1/video.py: Implements video generation, task CRUD, media upload/listing, and file streaming (lines 27-161)app/controllers/v1/llm.py: Contains script generation and term extraction endpoints (lines 18-33)app/controllers/ping.py: Health check implementation returning"pong"app/models/schema.py: Pydantic models defining request/response validation schemasapp/asgi.py: FastAPI application factory with CORS configuration and static file mounts
Summary
- MoneyPrinterTurbo provides 14 distinct API endpoints covering video generation, task management, media handling, and LLM content creation.
- The API follows REST conventions with standardized HTTP methods:
POSTfor creation,GETfor retrieval, andDELETEfor cleanup. - Video generation is asynchronous: The
POST /videosendpoint returns a task ID that must be polled viaGET /tasks/{task_id}. - File delivery supports both streaming and download via dedicated endpoints with HTTP range support.
- Media uploads are restricted to specific formats: Videos (mp4, mov, avi, flv, mkv) and images (jpg, jpeg, png) for materials, mp3 for music.
- All business logic is centralized in
app/controllers/v1/video.pyandapp/controllers/v1/llm.pyaccording to the FastAPI router pattern.
Frequently Asked Questions
What is the base URL for MoneyPrinterTurbo API endpoints?
By default, the FastAPI server runs on http://localhost:8000 when started locally. All endpoints documented here are mounted relative to this base URL. The application also serves static files under /tasks (for completed outputs) and / (for the web UI) via the ASGI configuration in app/asgi.py, though these paths are not part of the programmatic API contract.
How do I check the status of a video generation task?
Use the GET /tasks/{task_id} endpoint, where task_id is the UUID returned by the initial POST /videos request. This endpoint, implemented at line 116 of app/controllers/v1/video.py, returns the current processing state, progress percentage, and URLs to the final files once generation completes.
What file formats are supported for video material uploads?
The POST /video_materials endpoint accepts video files in mp4, mov, avi, flv, and mkv formats, as well as static images in jpg, jpeg, and png formats. For background music uploads via POST /musics, only .mp3 files are supported according to the controller logic in app/controllers/v1/video.py.
Does MoneyPrinterTurbo support partial content streaming for large videos?
Yes. The GET /stream/{file_path:path} endpoint supports HTTP range requests, allowing clients to request specific byte ranges of large video files. This enables adaptive bitrate streaming and resume capabilities for downloads. For standard file retrieval without streaming, use the GET /download/{file_path:path} endpoint which returns the file as an attachment.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →