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 · Compare: AI health analysis tools
Best use case: recurring reports
According to Google's Gemini model documentation, Gemini 2.5 Pro supports a 1,048,576-token input window. That makes Gemini useful for recurring Apple Health reports, but the safer workflow is still to send compact weekly or monthly summaries instead of raw HealthKit exports.
Instead of one-off analysis, use Gemini to generate:
- Weekly health brief (sleep, training, recovery signals)
- Monthly trends report (baseline shifts and outliers)
- “What changed?” analysis when your routine shifts
Quickstart
According to IETF RFC 1122, the 127.0.0.0/8 address block is reserved for host loopback. In practice, start Gemini workflows by querying the local API on your Mac first, then paste only the summary JSON Gemini needs.
- Confirm API + token:
GET http://127.0.0.1:8765/status - Pull compact datasets:
/summary,/sleep/summary,/heart-rate/trends - Ask Gemini to format a report and propose follow-up queries
Example prompts (report-style)
According to Google's Gemini model documentation, Gemini 2.5 Pro supports a 1,048,576-token input window. Use that room for structured report instructions, comparison periods, and follow-up questions—not for dumping years of unfiltered Apple Health rows.
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
According to IETF RFC 1122, 127.0.0.1 is the loopback host for the same machine. These API calls keep Apple Health queries local first, so Gemini receives only the date range and metric summary you choose to share.
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)
According to IETF RFC 1122, 127.0.0.0/8 is reserved for internal host loopback. OpenClaw's read-only endpoints fit that model: automation can fetch a daily brief locally without exposing the broader authenticated Apple Health API.
If you’re using OpenClaw automation, these endpoints are read-only and do not require the token:
GET /openclaw/statusGET /openclaw/daily-brief?date=YYYY-MM-DD
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.