PHPackages                             mageprince/magento2-mage-ai-predict - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. mageprince/magento2-mage-ai-predict

ActiveMagento2-module

mageprince/magento2-mage-ai-predict
===================================

Magento 2 AI Predictive Inventory &amp; Raw Material Forecaster (MageAI add-on)

1.0.0(yesterday)00GPL-3.0-or-laterPHP ~8.1.0||~8.2.0||~8.3.0||~8.4.0

Since Jul 22Compare

[ Source](https://github.com/mageprince/magento2-mage-ai-predict)[ Packagist](https://packagist.org/packages/mageprince/magento2-mage-ai-predict)[ RSS](/packages/mageprince-magento2-mage-ai-predict/feed)WikiDiscussions Synced today

READMEChangelog (1)Dependencies (1)Versions (2)Used By (0)

Magento 2 MageAI Predict Extension
==================================

[](#magento-2-mageai-predict-extension)

This Magento 2 extension is an **AI-powered Predictive Inventory &amp; Raw Material Forecaster**. It analyses your store's **historical sales**, predicts **next month's demand** for every product, and turns that into clear, actionable advice: **what to reorder and by when**, and **what is overstocked or dead stock** tying up your capital. It uses **OpenAI (GPT)**, **Anthropic (Claude)**, or **Google Gemini** — reusing the AI provider you already configured in the **MageAI** extension.

❤️ This is a companion to the open-source [MageAI](https://github.com/mageprince/magento2-mage-ai) extension. The goal is the same: keep it fully open-source and continuously expand the ways AI can help run a Magento 2 store — this time on the operations side, helping merchants avoid lost sales from stock-outs and frozen cash from over-stocking. If you're into Magento, AI, or supply-chain, your ideas and contributions are always welcome. Let's build something useful together!

> **Why not just ask an LLM to predict the numbers?** Because LLMs are poor at raw numeric forecasting. This extension does the maths with a deterministic statistical engine, then uses the AI only for what it's genuinely good at — reasoning over trend/seasonality/context and explaining the recommendation in plain language. The AI can be turned off entirely for free, instant, statistics-only forecasts.

Features
--------

[](#features)

- **Demand forecast for the upcoming month** — per-product prediction from 2–3 years of sales history (moving average × seasonality × recent trend)
- **AI-adjusted forecasts + plain-language recommendations** — the LLM refines the statistical baseline and explains *why* in merchant-friendly language
- **Automated procurement alerts** — recommended **reorder quantity** and a **reorder-by date** based on your lead time and safety-stock settings
- **Overstock / dead-stock detection** — flags capital tied up in slow-moving inventory
- **Colour-coded admin grid** — status and confidence shown as badges, plus a summary dashboard (out-of-stock risk / reorder soon / overstock / healthy / total units to reorder)
- **Multi-provider AI support** — reuses the OpenAI / Anthropic / Gemini provider configured in MageAI (one place for API keys)
- **Optional AI layer** — disable it for a free, instant, statistics-only baseline (no API calls)
- **Scheduled forecasting (cron)** — keeps the grid current automatically; configurable schedule
- **Run on demand** — a **"Generate Forecasts Now"** button for an immediate refresh
- **Tunable** — configure history window, lead time, safety stock and overstock threshold to match your business

Supported AI Providers
----------------------

[](#supported-ai-providers)

Provider, models and API keys are inherited from the **MageAI** extension configuration.

ProviderModels**Google Gemini** *(default)*`gemini-2.5-flash`, `gemini-2.5-pro`, `gemini-1.5-flash`, `gemini-1.5-pro`**OpenAI (ChatGPT)**`gpt-4o`, `gpt-4o-mini`, `gpt-4-turbo`, `gpt-4`, `gpt-3.5-turbo`**Anthropic (Claude)**`claude-opus-4-5`, `claude-sonnet-4-6`, `claude-haiku-4-5`Usage
-----

[](#usage)

### Setup

[](#setup)

1. Make sure the **MageAI** extension is installed and its AI **provider + API key** are configured (`Stores > Configuration > Mageprince > MageAI`)
2. Go to `Stores > Configuration > Mageprince > MageAI Predict (Demand Forecast)`
3. Enable **Forecasting**, and choose whether to **Use AI Adjustment** (off = statistics only, no API calls)
4. Set your **Sales History (years)**, **Restock Lead Time**, **Safety Stock (days)** and **Overstock Threshold**
5. Optionally set a **Max Products Per Run** and enable the **Scheduled Forecast** with a cron expression
6. Save the configuration

### Generate a forecast

[](#generate-a-forecast)

1. Open **MageAI Predict &gt; Demand Forecast** from the admin menu
2. Click **"Generate Forecasts Now"** (or wait for the scheduled cron)
3. The grid fills with per-product forecasts, statuses, reorder recommendations and AI rationales

### Read the grid

[](#read-the-grid)

ColumnMeaning**Baseline Forecast**Prediction from pure statistics (sales history only)**Forecast (units)**Final prediction after AI adjustment (falls back to baseline if AI is off/unavailable)**Current Stock**On-hand quantity right now**Reorder Qty / Reorder By**How many units to order, and the deadline to order them**Status**🔴 Out-of-stock risk · 🟠 Reorder soon · 🔵 Overstock / dead stock · 🟢 Healthy**Confidence**How much history backs the forecast (high / medium / low)**AI Recommendation**Plain-language reasoning for the number> The AI is only called for products with **at least 2 months of sales history** — there's no point spending an API call on a product with nothing to reason about. Products below that threshold use the statistical baseline.

How to Install
--------------

[](#how-to-install)

### Install via Composer

[](#install-via-composer)

Run the following commands in your Magento 2 root folder:

```
composer require mageprince/magento2-mage-ai-predict
php bin/magento setup:upgrade
php bin/magento setup:di:compile
php bin/magento setup:static-content:deploy
```

> Requires the **MageAI** extension (`mageprince/magento2-mage-ai`), which is pulled in automatically as a dependency.

Contribution
------------

[](#contribution)

Contributions are highly welcome and encouraged! 🙌

This project is a personal open-source effort to bring the power of AI to Magento 2. Whether you want to:

- Add new features (weather/festival signals, dashboards, bill-of-materials forecasting)
- Improve the forecasting logic or prompts
- Fix bugs
- Help with translations or documentation
- Or just share feedback…

You're very welcome to join in.

**To contribute:**

1. Fork the repository
2. Create your feature branch: `git checkout -b feature/my-feature`
3. Commit your changes: `git commit -m 'Add new feature'`
4. Push to the branch: `git push origin feature/my-feature`
5. Create a new Pull Request

Roadmap
-------

[](#roadmap)

- **v1 (current)** — statistical baseline, AI adjustment + rationale, reorder/overstock alerts, colour-coded grid + summary cards, scheduled cron
- **v1.1** — external signals (weather forecasts, regional festival/holiday calendar), dashboard widget, email/admin reorder notifications
- **v2** — bill-of-materials (BOM): explode finished-goods demand into raw-material requirements, with supplier lead-time tracking

Admin Grid Screenshot
---------------------

[](#admin-grid-screenshot)

[![mageprince-mageai-AI-Demand-Forecast-MageAI-Predict-Magento-Admin-07-22-2026_07_50_PM](https://private-user-images.githubusercontent.com/24751863/625215676-485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I3OTdiLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNjA3MjMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjYwNzIzVDE1MDQzN1omWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWY4Y2UyMzcyNTRmMDUyNjQwNWNhYmY5NDc4YzU0NThmMzhkMTBiNjIyMDg5MDJkOGE2Y2Y0MTFkNmY2ZTk3M2ImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JnJlc3BvbnNlLWNvbnRlbnQtdHlwZT1pbWFnZSUyRnBuZyJ9.jpG7RhdlQsZXdgnDEEK2A1X67906N9lcxbUYW7aAN8Y)

###  Health Score

40

—

FairBetter than 86% of packages

Maintenance100

Actively maintained with recent releases

Popularity0

Limited adoption so far

Community2

Small or concentrated contributor base

Maturity50

Maturing project, gaining track record

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1d ago

### Community

Maintainers

![](https://avatars.githubusercontent.com/u/24751863?v=4)[Mageprince](/maintainers/mageprince)[@mageprince](https://github.com/mageprince)

### Embed Badge

![Health badge](/badges/mageprince-magento2-mage-ai-predict/health.svg)

```
[![Health](https://phpackages.com/badges/mageprince-magento2-mage-ai-predict/health.svg)](https://phpackages.com/packages/mageprince-magento2-mage-ai-predict)
```

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
