Skip to content

Daemon API

The LeaseGate-Lite daemon exposes a local REST API on localhost:5177. No external network access — all communication stays on the machine.

MethodPathDescription
GET/statusLive StatusSnapshot — CPU%, RAM%, queue depth, heat state
GET/configCurrent configuration
GET/config/defaultsDefault config values
POST/configApply new configuration
POST/config/resetReset to defaults
POST/service/startStart the daemon
POST/service/stopStop the daemon
POST/service/restartRestart the daemon
POST/service/pause-backgroundPause/resume background work
POST/service/exitGraceful daemon shutdown
GET/autostart/statusAutostart toggle status
POST/autostartEnable/disable autostart
GET/notificationsNotification settings
POST/notificationsEnable/disable notifications
GET/presetsList all presets
POST/preset/previewPreview preset diff against current config
POST/preset/applyApply a preset (Quiet/Balanced/Performance)
GET/profilesPer-app profile overrides
POST/profiles/applySet per-app profile override
POST/diagnostics/exportExport JSON diagnostic bundle
GET/diagnostics/previewPreview diagnostic export contents
GET/events/tail?n=200Event tail (last N events)
GET/events/streamPoll for new events since a given ID
POST/simulate/pressureSet pressure mode (requires --enable-simulation)
POST/simulate/floodFlood simulation (requires --enable-simulation)

The GET /status endpoint returns a StatusSnapshot object with:

  • CPU% — current processor utilization
  • RAM% — available memory percentage
  • Queue depth — number of pending AI calls (interactive + background)
  • Heat state — one of Calm, Warm, or Spicy
  • Effective concurrency — current throttled concurrency limit
  • Throttle reason — why throttling is active (CPU pressure, memory pressure, cooldown, rate limit, manual clamp)

The daemon reads real Windows system metrics using PerformanceCounter (CPU) and GlobalMemoryStatusEx (RAM), then simulates queue pressure dynamics for the throttling engine.

  1. GET /config — read current settings
  2. Modify values (concurrency, thresholds, rate limits, etc.)
  3. POST /config — apply changes (takes effect immediately)
  4. POST /config/reset — restore factory defaults at any time

Every request can include optional headers for client tracking:

HeaderPurpose
X-Client-AppIdApplication identifier (used for per-app profiles)
X-Process-NameProcess name of the calling application
X-Client-SignatureClient signature for identification

The daemon tracks recently seen clients and uses the ClientAppId to apply per-app profile overrides. See Configuration for per-app profile details.

The daemon accepts several flags:

FlagDescription
--require-authEnable token-based authentication via X-Auth-Token header
--enable-simulationEnable /simulate/* endpoints
--install-autostartRegister the daemon to start on login
--uninstall-autostartRemove the autostart registration
--statusPrint daemon status and exit
--runStandard run mode

The daemon listens on localhost:5177 with no authentication by default. For environments where local process isolation matters, start the daemon with --require-auth to enable token-based authentication. The token is auto-generated at first run and stored in %LOCALAPPDATA%\LeaseGateLite\daemon.token. Clients must pass it via the X-Auth-Token header.

Simulation endpoints (/simulate/pressure and /simulate/flood) are disabled by default. Enable them with --enable-simulation or by running in Development mode. Only one daemon instance can run at a time — the daemon uses a named mutex (Local\LeaseGateLite.Daemon.Singleton) to enforce single-instance.

POST /diagnostics/export generates a JSON diagnostic bundle containing the current configuration, recent events, system metrics history, and throttling state. Useful for troubleshooting thermal issues or tuning thresholds.

The export respects two toggles:

  • includePaths — when false (default), local file paths are redacted to [PATH]
  • includeVerbose — when true, exports up to 1000 events and status samples instead of the default 250/120

Event logs are rotated at 5 MB on disk with one generation kept.