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 · Compare: AI health analysis tools

Why OpenAI + local query endpoints works

Apple says 15 iCloud data categories, including Health, are end-to-end encrypted by default. OpenAI works best here when it sees the smallest useful health payload: query local summaries and trends first, then ask ChatGPT to reason over the compact result.

Quickstart

Apple says end-to-end encrypted Health data requires iOS 12 or later and two-factor authentication. Keep that privacy posture in the AI workflow: confirm the local API, fetch one narrow metric slice, and paste only the summary ChatGPT needs.

  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)

Apple lists Health among 15 data categories protected with end-to-end encryption by default. Good ChatGPT prompts should preserve that boundary by asking for findings, uncertainty, and next queries from a prepared summary instead of a raw Apple Health archive.

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

Apple documents 2 requirements for end-to-end encrypted Health data in iCloud: iOS 12 or later and two-factor authentication. These example API calls follow the same minimization idea: request only one metric and date range before using ChatGPT.

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

Apple says 15 iCloud categories, including Health, use end-to-end encryption by default. For cost and accuracy, keep ChatGPT inputs small: start with summary endpoints, use a short date range, and make the model request more data before drawing strong conclusions.

Compatibility routes

Apple documents 2 baseline requirements for end-to-end encrypted Health data. Compatibility routes keep the same local-first workflow while supporting older endpoint names under /health/*, including /health/sleep and /health/workouts.

Want the docs + endpoints list?

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