OpenAI + Local API

Apple Health + OpenAI / ChatGPT (via a Local API)

Fetch the exact metric slice you need locally (sleep, steps, workouts, heart rate), then ask ChatGPT to summarize, detect trends, and return structured next steps.

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

Prerequisite: install the Mac app. The app runs the local API on your Mac at 127.0.0.1. If the app isn’t running, the API won’t respond.

  • 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

Why OpenAI + local query endpoints works

Time-series health data explodes in size. The trick is to keep the model focused: query summaries and trends (already aggregated), then ask ChatGPT to reason over the compact payload.

Quickstart

  1. Confirm the API is running: GET http://127.0.0.1:8765/status
  2. Load your token (path returned by /status)
  3. Pull one metric slice (e.g., 30–90 days) using a summary/trend endpoint
  4. Paste the JSON into ChatGPT and ask for structured outputs

Prompts that work well (OpenAI-optimized)

Prompt 1 — Findings + next queries

Analyze the JSON below.

Return:
1) Key findings (bullets)
2) Confidence level (high/med/low) with reasons
3) Outliers/anomalies
4) The next 3 API queries to run (endpoint + date range) to validate your hypothesis

Prompt 2 — Structured action plan

Based on the dataset below, produce:

A) A plain-English summary (max 8 bullets)
B) A JSON action plan with fields:
- goals
- constraints
- interventions
- metrics_to_track
- 14_day_experiment
- follow_up_questions

Example API calls

Daily steps (chart-ready):

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

Workouts summary:

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

Blood glucose summary:

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

Cost & accuracy best practices

Compatibility routes

Compatibility endpoints also exist under /health/* (for example /health/sleep and /health/workouts).

Want the docs + endpoints list?

Start with the Local API, then build your ChatGPT workflow.