Skip to content

Latest commit

 

History

History
246 lines (192 loc) · 10.9 KB

File metadata and controls

246 lines (192 loc) · 10.9 KB
AIMeter logo

AIMeter

AIMeter ist ein self-hosted Dashboard zur Verfolgung von Nutzung, Kontingent und Verlaufstrends von AI-Providern.

React Express TypeScript Runtime Providers Deploy Deploy

AIMeter dashboard
AIMeter usage history AIMeter endpoint AIMeter settings

Features

  • React-Frontend-Dashboard
  • Express-Backend-API
  • Adapter-Architektur für mehrere Provider
  • Runtime-Modi: node und serverless
  • Datenbankgestützte Speicherung und Bootstrap-Flow
  • Einheitliches Dashboard über mehrere AI-Provider
  • Provider-Credential-Management und Quota-Anzeige
  • Nutzungsverlauf und Chart-Seiten
  • Endpoint-/Proxy-bezogene API-Seiten
  • Bootstrap- und Admin-Initialisierungsflow
  • Datenbank-Engines: sqlite, d1, postgres, mysql

Unterstützte Provider

Aliyun
Aliyun
Antigravity
Antigravity
Claude
Claude
Codex
Codex
Kimi
Kimi
MiniMax
MiniMax
z.ai
z.ai
Copilot
Copilot
OpenRouter
OpenRouter
Ollama
Ollama
OpenCode
OpenCode
Cursor
Cursor
Provider-spezifische Beispiele und Integrationshinweise: [docs/providers](../providers)

Tech Stack

  • Frontend: React 18, TypeScript, Vite, Tailwind CSS
  • Backend: Node.js, Express, TypeScript
  • Storage: SQLite / Cloudflare D1 / PostgreSQL / MySQL

Projektstruktur

.
├─ src/                  # Frontend-App
├─ server/               # Backend API, Auth, Jobs, Storage
├─ deploy/               # Deployment-Guides nach Plattform
├─ docs/                  # API-Doku, Provider-Beispiele, Übersetzungen, Konfig-Doku
├─ config.all.yaml       # Vollständige Konfigurationsvorlage
├─ config.yaml           # Aktive lokale Konfiguration (durch Kopie erzeugen)
└─ .env.all              # Vollständige Env-Vorlage

Quick Start

Option 1: Container (Docker)

Single-Container-Deployment mit nginx + Node.js. Daten werden über ein Volume-Mount persistiert.

mkdir -p ~/aimeter/db ~/aimeter/log
docker run -d --name aimeter \
  -p 3000:3000 \
  -e AIMETER_DATABASE_ENGINE=sqlite \
  -e AIMETER_DATABASE_CONNECTION=/aimeter/db/aimeter.db \
  -e AIMETER_SERVER_PORT=3000 \
  -e AIMETER_BACKEND_PORT=3001 \
  -e AIMETER_RUNTIME_MODE=node \
  -v ~/aimeter/db:/aimeter/db \
  -v ~/aimeter/log:/aimeter/log \
  bugwz/aimeter:latest

Öffnen: http://localhost:3000

Docker Compose, HTTPS, MySQL/PostgreSQL und Multi-Arch-Builds: deploy/container/README.md

Option 2: Vercel

Serverless-Deployment. Erfordert eine externe MySQL- oder PostgreSQL-Datenbank.

Datenbank Deployen
MySQL Deploy with Vercel
PostgreSQL Deploy with Vercel

Umgebungsvariablen setzen, Bootstrap abschließen, dann einen externen Cron-Dienst konfigurieren, der /api/system/jobs/refresh alle 5 Minuten aufruft.

Cron-Einrichtung und vollständige Konfiguration: deploy/vercel/README.md

Option 3: Cloudflare Workers

Serverless-Deployment. Unterstützt Cloudflare D1, MySQL oder PostgreSQL.

Deploy to Cloudflare Workers

Nach dem Deployment Umgebungsvariablen je nach Datenbanktyp setzen:

Modus Erforderliche Umgebungsvariablen
D1 AIMETER_RUNTIME_MODE=serverless
AIMETER_SERVER_PROTOCOL=https
AIMETER_DATABASE_ENGINE=d1
AIMETER_DATABASE_CONNECTION=DB
MySQL AIMETER_RUNTIME_MODE=serverless
AIMETER_SERVER_PROTOCOL=https
AIMETER_DATABASE_ENGINE=mysql
AIMETER_DATABASE_CONNECTION=mysql://USER:PASSWORD@HOST:3306/DATABASE
PostgreSQL AIMETER_RUNTIME_MODE=serverless
AIMETER_SERVER_PROTOCOL=https
AIMETER_DATABASE_ENGINE=postgres
AIMETER_DATABASE_CONNECTION=postgres://USER:PASSWORD@HOST:5432/DATABASE?sslmode=require

Cron Triggers sind eingebaut — wrangler.jsonc plant automatisch alle 5 Minuten einen Refresh.

D1-Binding, Hyperdrive und vollständige Setup-Schritte: deploy/cloudflare/README.md

Skripte

npm run dev            # nur Frontend
npm run start:server   # nur Backend
npm run dev:all        # Frontend + Backend
npm run dev:mock:all   # Frontend + Backend (Mock-Modus)
npm run build          # Type-Check und Frontend-Build
npm run preview        # Frontend-Build lokal prüfen
npm run cf:dev         # lokale Cloudflare Workers-Entwicklung
npm run cf:deploy      # zu Cloudflare Workers deployen

Konfiguration

Quellen und Priorität in der aktuellen Implementierung:

  1. config.yaml (oder Pfad aus AIMETER_CONFIG_FILE)
  2. Umgebungsvariablen
  3. Eingebaute Defaults

Wichtig:

  • database.engine / AIMETER_DATABASE_ENGINE ist erforderlich.
  • database.connection / AIMETER_DATABASE_CONNECTION ist erforderlich.
  • Im serverless-Modus ist der Scheduler deaktiviert.
  • Im node-Modus startet der In-Process-Scheduler automatisch.

Detaillierte Feldzuordnung und Erklärungen:

Deployment

Unterstützte Deployment-Modi und Links:

API-Dokumentation

Sicherheitshinweise

  • Session-Secret und verschlüsselungsrelevante Einstellungen werden im DB-Modus beim Bootstrap initialisiert und persistiert.
  • AIMETER_CRON_SECRET und AIMETER_ENDPOINT_SECRET sind optionale Integrations-Secrets; falls gesetzt, starke 32-Zeichen-Zufallswerte verwenden.
  • In Produktion AIMETER_SERVER_PROTOCOL=https setzen, um strengere Transport-Sicherheitsheader zu aktivieren.