---
title: "Architecture and AI engines"
url: https://phatdev.net/en/docs/media-studio/kien-truc
lang: en
updated: 2026-10-20
alternate:
  vi: https://phatdev.net/docs/media-studio/kien-truc
markdown: https://phatdev.net/en/docs/media-studio/kien-truc.md
---

# Architecture and AI engines

Part of the doc set: [Media Studio](https://phatdev.net/en/docs/media-studio.md)

> Which engine does what, how it falls back automatically when a usage limit is reached, and where the benchmark data comes from.

Media Studio is a **Node.js (Express)** server running on a dedicated Mac, with a plain HTML/CSS/JS web interface, reachable remotely over HTTPS with a login. Each kind of work is handed to the engine best suited for it, and **every paid or rate-limited engine has a fallback**.

## Engine map

| Task | Main engine | Fallback |
|---|---|---|
| Image generation | **GPT Image 2** | **Nano Banana** (Gemini) - switches automatically when the main engine reaches its usage limit |
| Writing scripts, scoring images, reading camera angle / lighting | **Gemini** | The main image engine |
| Web lookup (benchmarks, specs) | Gemini web search | Read component names directly from the product page + the NotebookCheck database |
| Background removal | rembg (isnet) | macOS Vision → background-color cut → Photoshop Select Subject |
| Upscaling / sharpening | **UltraSharpV2** (runs on the Mac's GPU) | Real-ESRGAN → Lanczos |
| Voice-over | **Gemini TTS** (default voice *Charon*) | VieNeu on-device → Edge TTS |
| Speech recognition (subtitles, timestamps) | faster-whisper (runs locally) | - |
| Video rendering | **Remotion 4** (React) + FFmpeg | - |
| Banner rendering | Chrome headless-shell (puppeteer) | Chrome restarts itself when it hangs |
| Image compression | TinyPNG (several keys rotated by month) | - |

## How usage limits are shared

- **The image engine's limit is reserved for drawing.** Text work and "looking at images" (scoring, script writing, lighting analysis) run on Gemini - a separate limit that never eats into the drawing limit.
- **When the limit is reached, it doesn't keep trying.** When the main engine returns 429, the app remembers the reset time and sends later images straight to Nano Banana until then - no wasted failed requests. If both engines are exhausted, it returns `503` with the wait time.
- **Pipelines that need images from the main engine only** can send the header `x-engine` (see `GET /api/v1/info` for the values) so they never receive an image from the fallback engine.

## Benchmark data

CPU/GPU/game FPS scores are built from the NotebookCheck CSV set, and 3D render scores come from **Blender Open Data** (CC0, 462 GPUs + 1,123 CPUs). Videos and charts **use real numbers only** from these sources; if a number is missing, the scene is dropped rather than invented.

## Address

- **media.phatdev.net** - Media Studio (an account is required).
