CLI Commands
Start Application and Worker Together (Recommended)
# Start both app and worker with default config.yml
eai start-all
# Start with custom config
eai start-all --config production.yml
# Start with frontend file watching (auto-rebuild on changes)
eai start-all --watch-frontend
# Start without building frontend (if already built)
eai start-all --no-build-frontend
# Start without auto-reload (production mode)
eai start-all --no-reload --no-build-frontend
# Customize worker log level
eai start-all --worker-loglevel debugNote: This is the recommended way to run EfficientAI. It starts both the API server and Celery worker in a single command. Press Ctrl+C to stop both services.
Start Application Only
# Start just the API server (worker must be started separately)
eai start --config config.yml
# Start with auto-reload for development
eai start --reload
# Start with frontend file watching
eai start --watch-frontend
# Start with default config.yml
eai start
# Start with custom config
eai start --config production.yml
# Start with frontend file watching (auto-rebuild on changes)
eai start --watch-frontend
# Start without building frontend (if already built)
eai start --no-build-frontend
# Start without auto-reload (production mode)
eai start --no-reload --no-build-frontendStart Worker Only
# Start Celery worker with default config.yml
eai worker
# Start with custom config
eai worker --config production.yml
# Start with custom log level
eai worker --loglevel debug
# Or use Celery command directly
celery -A app.workers.celery_app worker --loglevel=infoNote: The worker is required for processing background tasks (transcription, evaluation, etc.). If you use eai start-all, the worker starts automatically. Only use this command if you need to run the worker separately.
Development Mode
# Full development setup with both backend and frontend hot reload
eai start-all --watch-frontend --reload
# Or for application only
eai start --watch-frontend --reloadGenerate Config File
# Generate default config.yml
eai init-config
# Generate custom config file
eai init-config --output my-config.ymlDatabase Migrations
# Run pending migrations manually
eai migrate
# Run migrations with verbose output
eai migrate --verboseNote: Migrations run automatically on application startup. You only need to run them manually if you want to apply migrations before starting the server.
Usage pricing
Manage model pricing rates and backfill stored usage costs on llm_usage_daily rollups. Requires beat, worker-usage, and the default worker (or eai start-all).
# Upsert model_pricing_rates from app/config/models.json
eai usage seed-rates --config config.yml
# Compare models.json pricing vs Postgres
eai usage diff-rates --config config.yml
# Backfill costs in-process (all orgs; use after migrate or catalog change)
eai usage recompute --config config.yml --sync
# Async recompute via usage queue (requires --organization-id)
eai usage recompute --config config.yml --organization-id <org-uuid>
# Optional scopes: --model, --usage-kind, --start-date, --end-date
# Optional: fetch LiteLLM prices into pricing_catalog.json
eai usage sync-litellm --local
eai usage sync-litellm --local --write-modelsAfter migrations or catalog changes:
eai migrate
eai usage seed-rates --config config.yml
eai usage recompute --config config.yml --syncFlush / Usage UI tuning — set in .env (see env.example):
| Variable | Default | Purpose |
|---|---|---|
USAGE_FLUSH_BUCKET_BATCH_SIZE | 500 | Buckets per DB transaction |
USAGE_FLUSH_MAX_BATCHES_PER_RUN | 30 | Batches per flush tick (≤ 15,000 buckets/run) |
USAGE_FLUSH_BEAT_SECONDS | 120 | Celery Beat flush interval (~2 min lag vs Redis) |
USAGE_FLUSH_LOCK_TTL_SECONDS | 300 | Per-org flush lock TTL |
USAGE_READ_CACHE_TTL_SECONDS | 90 | Redis cache TTL for usage summary/breakdown/filters |
CRON_DISPATCH_INTERVAL_SECONDS | 30 | Evaluator cron dispatcher tick (default worker) |
The Usage UI reads Postgres only (summary/breakdown/filters). Redis counters flush on the Celery Beat schedule (~2 min eventual consistency). If Redis backlog grows, lower USAGE_FLUSH_BEAT_SECONDS or raise USAGE_FLUSH_MAX_BATCHES_PER_RUN.
See Usage for the end-user guide.
Community & contact
- Found a bug or have a feature request? Open a GitHub issue.
- Join our Discord for faster replies!
