Gemini + Local API

Apple Health + Gemini (via a Local API)

Gemini is excellent at turning structured inputs into clear reports. Query compact Apple Health summaries locally, then generate weekly/monthly briefs.

Export → AirDrop → Analyze with Claude, ChatGPT, or any AI.

Prerequisite: install the Mac app (it hosts the local API on your machine). Gemini doesn’t connect to Apple Health directly—your Mac app is the bridge.

  • Base URL: http://127.0.0.1:8765
  • Auth header (most routes): X-Health-Analyzer-Token: <token>
  • Token file path: returned by GET /status

Docs: Apple Health Local API · Hub: Apple Health + AI

Best use case: recurring reports

Instead of one-off analysis, use Gemini to generate:

Quickstart

  1. Confirm API + token: GET http://127.0.0.1:8765/status
  2. Pull compact datasets: /summary, /sleep/summary, /heart-rate/trends
  3. Ask Gemini to format a report and propose follow-up queries

Example prompts (report-style)

Prompt 1 — Weekly brief

Turn this JSON into a weekly report.

Sections:
- Highlights (bullets)
- Concerns / risks (bullets)
- What changed vs prior period
- Recommended experiment for next 7 days
- Next 3 API queries to run (endpoint + date range)

Prompt 2 — Compare periods

Compare the last 14 days vs the previous 14 days.

What shifted most, and what is the most likely explanation?
List competing explanations and what data would disambiguate them.

Example API calls

Overall summary:

curl -s \
  -H "X-Health-Analyzer-Token: $TOKEN" \
  "http://127.0.0.1:8765/summary?start=2026-02-25&end=2026-03-27"

Sleep summary:

curl -s \
  -H "X-Health-Analyzer-Token: $TOKEN" \
  "http://127.0.0.1:8765/sleep/summary?start=2026-02-25&end=2026-03-27"

OpenClaw read-only endpoints (no token)

If you’re using OpenClaw automation, these endpoints are read-only and do not require the token:

Compatibility routes

Compatibility endpoints also exist under /health/*, for example /health/status and /health/sleep.

Start with the Local API

Query compact summaries first. Expand only if Gemini asks for more data.