marcelo-earth/generative-manim
🎨 GPT for video generation ⚡️
Generative Manim – AI‑driven animation creation
What it is
- An open‑source suite that lets you describe a scene in plain English and have a Large Language Model (LLM) write the corresponding Manim Python code, then render it into a video.
- Built around the idea that the Manim renderer itself is a deterministic verifier: the generated code either produces a correct animation or crashes, which can be used as a reward signal for training.
Core components
| Component | Purpose |
|---|---|
| LLM → Manim code engine | A collection of model wrappers (GPT‑4o, Claude, Gemini, open‑weight models via Featherless, LiteLLM passthrough, etc.) that turn natural‑language prompts into Manim scripts. |
| API | A REST‑style Animation Processing Interface that accepts a prompt, selects a model, runs the generation, and returns the rendered video (or the raw Python code). |
| Web demo | Hosted at generative-manim.vercel.app; shows the end‑to‑end flow in a browser. |
| Animo desktop app | A packaged, local‑rendering version of the same pipeline, giving users privacy and zero extra cloud cost. |
| Training pipeline | Open‑source scripts that fine‑tune open‑weight models (Qwen 2.5‑Coder 7B, DeepSeek‑Coder V2 Lite, CodeLlama 7B) using a three‑stage process: Supervised Fine‑Tuning → Direct Preference Optimization → Group Relative Policy Optimization, with the Manim renderer as the reward. |
| Benchmark suite | Reproducible evaluation (pass@k, render‑based scoring, structural checks) for any model that produces Manim code. |
Key features
- Prompt‑to‑animation: Write a sentence like "A ball falls, bounces, and turns into a star" and get a ready‑to‑play video.
- Multiple model back‑ends: Official support for OpenAI, Anthropic, Google Gemini, Moonshot, plus open‑weight models accessed through Featherless or LiteLLM.
- Local rendering with Animo: No need to upload code or video; everything runs on the user’s machine.
- Exportable code: The generated Manim script is provided so you can edit, version‑control, or reuse it.
- Open‑source training: Scripts to train your own code‑generation model, with a benchmark that measures how often the model produces runnable Manim code.
- Community resources: Discord for discussion, a curated Manim Awesome Skills repo, and detailed deployment docs (Docker/Render).
Typical workflow
- Write a description – plain English, no Manim knowledge required.
- Select a model – choose a high‑capability model (e.g., GPT‑4o) or a cheaper open‑weight model.
- Generate code – the API calls the LLM, receives a Python script, and optionally streams it back.
- Render – the script is run through Manim; the resulting video is returned (or saved locally by Animo).
- Iterate – edit the prompt or the generated code and repeat.
Getting started
- Try the demo: Visit https://generative-manim.vercel.app and type a prompt.
- Run the API locally:
git clone https://github.com/360macky/generative-manim.git cd generative-manim/api # set your OpenAI/Anthropic/Google API keys export OPENAI_API_KEY=… uvicorn main:app --reload # or use Docker as described in docs/cloud-deployment.md - Use Animo: Download the desktop app from https://animo.video, install, and start creating without any server.
- Train your own model: Follow the
training/README – it shows how to fine‑tune Qwen 2.5‑Coder 7B with the provided 5k+ prompt‑code pairs and run the benchmark.
Who might benefit
- Educators & content creators who need quick explanatory animations without learning Manim.
- Developers looking for a code‑generation benchmark that has a deterministic, visual reward.
- Researchers interested in LLM‑driven programming, especially for domains where the output can be automatically verified (rendered video).
- Students who want to explore physics or math concepts via animated visualisations generated from natural language.
Community & support
- Discord: https://discord.gg/SNdbPU2AMM
- Issues & pull requests are welcomed on GitHub.
- Sponsorship: currently backed by The Astronomical Software Company.
All information above is taken directly from the repository’s README; no additional features have been inferred.
Related
- Project
- Project
- Project
- Project
- Project