Skip to content

cochbild/invoke-ai-reports

InvokeAI Reports

A web-based analytics dashboard that reads your InvokeAI installation's SQLite database and presents usage statistics through interactive charts and tables. Understand your image generation patterns — model preferences, prompt habits, parameter trends, and more.

Features

  • Model Analytics — Top models, family distribution, model leaderboard with usage stats
  • Prompt Analysis — Token frequency, word clouds, prompt length distribution
  • Trend Tracking — Generation volume over time, parameter evolution, activity heatmaps
  • Generation Stats — Resolution distribution, scheduler usage, LoRA statistics, error rates
  • Unused Models — Installed models that were never used in any generation (filterable by main/LoRA, with size totals to help reclaim disk space)
  • Multi-User — Auto-detects users from InvokeAI, filterable per-user or aggregate
  • Date Filtering — Custom date ranges with preset shortcuts (7d, 30d, 90d, all-time)

Architecture

InvokeAI DB (invokeai.db) → Importer (read-only) → App DB (reports.db) → FastAPI → React UI

The importer reads InvokeAI's database in read-only mode, parses JSON metadata, and flattens it into the app's own reports.db. All analytics queries run against the app database, never the source.

Quick Start

Prerequisites

  • Python 3.10+
  • uv (recommended) or pip
  • Node.js 18+ (only needed if building the frontend from source)
  • An InvokeAI installation with a databases/invokeai.db file

Installation

git clone https://github.com/cochbild/invoke-ai-reports.git
cd invoke-ai-reports

# Set up Python backend (uv handles venv + locked deps)
uv sync

# Build the frontend
cd frontend
npm install
npm run build
cd ..

Prefer plain pip? python -m venv .venv && .venv/bin/pip install -e . works too — pyproject.toml is the source of truth.

Running

All platforms:

uv run uvicorn backend.app.main:app --port 9876

Open http://localhost:9876 in your browser. On first run, enter your InvokeAI installation path (e.g., G:\InvokeUi, C:\Users\you\InvokeAI, or /home/user/invokeai).

Without uv, activate your venv first (source .venv/bin/activate on Linux/Mac, .venv\Scripts\activate on Windows) and drop the uv run prefix.

Open http://localhost:9876. When prompted for the InvokeAI path:

  • Native Linux: Enter the path directly (e.g., /home/user/invokeai)
  • WSL accessing a Windows drive: Use the WSL mount path (e.g., /mnt/g/InvokeUi) or the Windows path (G:\InvokeUi) — both are accepted

Path Flexibility

The setup page accepts any of these path formats:

Input What it finds
G:\InvokeUi G:\InvokeUi\databases\invokeai.db
G:\InvokeUi\databases G:\InvokeUi\databases\invokeai.db
G:\InvokeUi\databases\invokeai.db Exact file path
/mnt/g/InvokeUi /mnt/g/InvokeUi/databases/invokeai.db (WSL)

Configuration

Environment variables (prefix INVOKE_REPORTS_):

Variable Default Description
INVOKE_REPORTS_PORT 9876 Server port
INVOKE_REPORTS_HOST 127.0.0.1 Server host
INVOKE_REPORTS_APP_DB_PATH reports.db Path to app database
INVOKE_REPORTS_DEV_CORS false Allow Vite dev server (:5173) origin — set when running npm run dev

Development

Backend

# Sync deps including dev tooling (pytest, httpx, pip-audit)
uv sync --dev

# Run backend tests
uv run pytest -v

# Run backend with hot reload
uv run uvicorn backend.app.main:app --reload --port 9876

# Audit dependencies for known CVEs
uv run pip-audit

Frontend

cd frontend

# Install dependencies
npm install

# Run dev server (proxies /api to backend on port 9876)
npm run dev

# Run frontend tests
npx vitest run

# Production build
npm run build

During development, run the backend (uvicorn ... --port 9876) and frontend dev server (npm run dev) simultaneously. The Vite dev server proxies /api requests to the backend.

API Endpoints

All stats endpoints accept optional user_id, start_date, and end_date query parameters.

Method Path Description
POST /api/sync Trigger data import
GET /api/sync/status Last sync info
GET /api/users List users
GET /api/stats/overview KPI summary
GET /api/stats/models/top Top models by usage
GET /api/stats/models/least Least used models
GET /api/stats/models/unused Installed models never used (lifetime); ?type=main|lora and ?search=…
GET /api/stats/models/family-distribution Model family breakdown
GET /api/stats/models/leaderboard Full model stats table
GET /api/stats/prompts/top-tokens Most frequent prompt tokens
GET /api/stats/prompts/length-distribution Prompt length histogram
GET /api/stats/trends/volume Generation count over time
GET /api/stats/trends/heatmap Activity by day/hour
GET /api/stats/trends/parameters Avg steps/CFG over time
GET /api/stats/generation/resolutions Resolution frequency
GET /api/stats/generation/schedulers Scheduler distribution
GET /api/stats/generation/steps Steps histogram
GET /api/stats/generation/cfg CFG scale histogram
GET /api/stats/generation/loras LoRA usage stats
GET /api/stats/generation/errors Failure rates and error types
POST /api/validate-path Check InvokeAI DB path
GET /api/settings Current config
PUT /api/settings Update config
POST /api/settings/clear Reset to first-run state

Tech Stack

Layer Technology
Backend Python, FastAPI, SQLAlchemy, SQLite
Frontend React, TypeScript, Vite, Chakra UI, Recharts
Testing pytest, Vitest

License

MIT

Releases

No releases published

Packages

 
 
 

Contributors