# one-shot query (default mode)
openusage-cli query
# same as above
openusage-cli
# run daemon (background by default)
openusage-cli run-daemon --host 127.0.0.1 --port 0Default daemon port is 0, which means "pick a free port".
- Returns JSON payload once, then exits
- Tries daemon first for fast responses
- Falls back to local plugin execution if daemon is unavailable
- For
--type=usage, fallback performs provider polling and can take noticeable time
Include mode metadata in output:
openusage-cli query --with-statestate.queryMode is cache (daemon path) or direct (fallback path).
- Keeps plugin runtime initialized
- Refreshes snapshots in the background (default interval: 300 seconds)
- Serves data through the local REST API
- Also accelerates
query, becausequerycan reuse daemon data
For daemon operation patterns (standalone vs systemd), see daemon-modes.md.
query: one-shot JSON output (--type=usage|plugins)run-daemon: start daemon modeshow-default-config: print defaultconfig.yamltemplateinstall-systemd-unit: create~/.config/systemd/user/openusage-cli.serviceversion: print versionhelp: print help
Global flags:
--log-level <error|warn|info|debug|trace>
Runtime flags (query, run-daemon):
--plugins-dir <path>--enabled-plugins <csv-globs>(default:*)--app-data-dir <path>--plugin-overrides-dir <path>
run-daemon flags:
--host <host>(default:127.0.0.1)--port <port>(default:0)--refresh-interval-secs <seconds>(default:300)--existing-instance <error|ignore|replace>(default:error)--service-mode <standalone|systemd>(default:standalone)--foreground[=true|false](--foregroundmeanstrue, default:false)--daemon-child(internal)
Base URL example:
http://127.0.0.1:6738
GET /health: service health and loaded plugin count.GET /v1/plugins: plugin metadata for discovered plugins.GET /v1/usage[?refresh=true][&pluginIds=codex,cursor]: usage snapshots.refresh(optional, defaultfalse): trigger fresh probe before returning data.pluginIds(optional): comma-separated plugin IDs filter.
GET /v1/usage/{provider}[?refresh=true]: usage snapshot for one provider.404with{"error":"provider_not_found"}for unknown provider.204 No Contentwhen provider exists but no cached snapshot is available.
POST /v1/probe: force refresh. Optional JSON body:
{
"pluginIds": ["codex", "cursor"]
}GET /v1/config: runtime config currently used by daemon.POST /v1/shutdown: request graceful shutdown.POST /v1/restart: request daemon restart.
Control endpoint restrictions (/v1/shutdown, /v1/restart):
- Requests must come from loopback address (
127.0.0.1/::1). - If
Originheader is present, it must also be local (localhostor loopback IP). - Non-local remote/origin requests are rejected with
403.