Skip to main content

GET /v1/locopilot/health

Heartbeat endpoint for liveness and readiness probes.

Source: src/api/routes/health.ts

Endpoint

GET http://localhost:8080/v1/locopilot/health

Public — listed in PUBLIC_ROUTES, no Authorization header required.

Probes

The handler runs every probe in parallel via Promise.allSettled:

ProbeWhat it does
ollamaGET <OLLAMA_HOST>/ (default http://localhost:11434) with a 5 s timeout
sqlitequery('SELECT 1') against ~/.locopilot/db.sqlite
cloud (Pro only)GET <CLOUD_URL>/api/health with Authorization: Bearer qs_…

Response shape

interface HealthResponse {
status: 'ok' | 'degraded';
mode: 'free' | 'pro';
services: Record<string, ServiceHealth>;
}

interface ServiceHealth {
ok: boolean;
responseMs?: number; // present on success
error?: string; // present on failure
}

status is degraded whenever any single probe failed; otherwise ok. The HTTP response code is always 200 — inspect the JSON body to determine actual health.

Free tier

{
"status": "ok",
"mode": "free",
"services": {
"ollama": { "ok": true, "responseMs": 12 },
"sqlite": { "ok": true, "responseMs": 1 }
}
}

Pro tier

{
"status": "ok",
"mode": "pro",
"services": {
"ollama": { "ok": true, "responseMs": 11 },
"sqlite": { "ok": true, "responseMs": 1 },
"cloud": { "ok": true, "responseMs": 84 }
}
}

Degraded example

{
"status": "degraded",
"mode": "free",
"services": {
"ollama": { "ok": false, "error": "Ollama health check failed: 502" },
"sqlite": { "ok": true, "responseMs": 1 }
}
}

Use cases

  • Kubernetes / Docker readiness probes (parse services.<name>.ok)
  • CI pre-flight checks before running an integration suite
  • A simple ping for "is LocoPilot running?" from your own UI
  • The locopilot doctor command uses this internally