npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

mathvideo

v1.2.6

Published

Convert strings to mathematical videos using Groq API and Manim

Readme

MathVideo 🎬

Convert mathematical concepts into beautiful animated videos using Groq API and Manim.

Features

  • 🤖 AI-powered video generation using Groq's Llama 3.1 8B model
  • 🎨 Beautiful mathematical animations with Manim
  • 🔐 Secure API key management
  • 📁 Automatic output organization with timestamps
  • 🖥️ Interactive CLI interface

Prerequisites

Before using MathVideo, you need to have the following installed:

1. Python and Manim

# Install Python (if not already installed)
# Download from https://python.org

# Install Manim
pip install manim

# For better performance, you might want to install additional dependencies:
pip install manim[all]

2. Groq API Key

You'll need a Groq API key to use this package:

  1. Go to Groq Console
  2. Sign up or log in to your account
  3. Navigate to API Keys section
  4. Create a new API key
  5. Copy the key for use with MathVideo

Installation

Global Installation (Recommended)

npm install -g mathvideo

Local Installation

npm install mathvideo

Usage

Global Installation

After installing globally, you can run:

Interactive mode:

mathvideo

Command line mode:

mathvideo "2x+3=7 solve for x"
mathvideo "The Pythagorean theorem states that a² + b² = c²"

Local Installation

If installed locally, run:

npx mathvideo

Programmatic Usage

const MathVideo = require('mathvideo');

const mathVideo = new MathVideo();
await mathVideo.initialize();
await mathVideo.createVideo("The Pythagorean theorem states that a² + b² = c²");

How It Works

  1. Input: You provide a mathematical concept as a string
  2. AI Processing: The concept is sent to Groq's Llama 3.1 8B model using a configurable system prompt
  3. Code Generation: The AI generates complete Manim Python code
  4. Video Rendering: Manim renders the animation into an MP4 file
  5. Output: The video is saved in the output folder with timestamp

Configuration

The package includes a systemprompt.txt file that contains the instructions for the AI model. You can modify this file to customize how the AI generates Manim code.

Example Inputs

Here are some example mathematical concepts you can try:

  • "The Pythagorean theorem states that a² + b² = c²"
  • "Derivative of x² is 2x"
  • "Integration of 2x is x² + C"
  • "The area of a circle is πr²"
  • "Euler's identity: e^(iπ) + 1 = 0"
  • "The quadratic formula: x = (-b ± √(b² - 4ac)) / 2a"

Output

Videos are saved in the output folder with the following naming convention:

  • manim_script_YYYY-MM-DDTHH-MM-SS-sssZ.py (Python script)
  • MathScene_YYYY-MM-DDTHH-MM-SS-sssZ.mp4 (Video file)

Configuration

The package automatically:

  • Creates an output directory in your current working directory
  • Handles API key setup interactively
  • Manages temporary Python files
  • Provides real-time rendering progress
  • Uses a configurable system prompt from systemprompt.txt

Troubleshooting

Common Issues

  1. Manim not found

    pip install manim
  2. Python not in PATH

    • Ensure Python is installed and added to your system PATH
    • On Windows, you might need to restart your terminal after installation
  3. API Key Issues

    • Verify your Groq API key is correct
    • Check your internet connection
    • Ensure you have sufficient API credits
  4. Rendering Errors

    • Check that Manim is properly installed
    • Ensure you have sufficient disk space
    • Try simpler mathematical concepts first

Getting Help

If you encounter issues:

  1. Check that all prerequisites are installed
  2. Verify your Groq API key is valid
  3. Try with a simple mathematical concept first
  4. Check the console output for error messages

Development

To contribute to this project:

git clone https://github.com/yourusername/mathvideo.git
cd mathvideo
npm install
npm start

License

MIT License - see LICENSE file for details.

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

Support

For support, please open an issue on GitHub or contact the maintainers.