You are building against the Openpipe Health API: public data on US healthcare, mostly from CMS (clinicians, hospitals, health systems, care sites, group practices, procedures, drugs, Medicare payers, ACOs, trial investigators, industry payments). Use REST endpoints, a plain-English question endpoint that returns a dashboard as JSON, or MCP tools. Nothing accepts SQL: never send any. DOCS (plain Markdown) - Index of pages and the full endpoint list: https://openpipe.health/docs/llms.txt - Everything in one file: https://openpipe.health/docs/llms-full.txt (shorter: llms-small.txt) - Any page: its path plus .md, for example https://openpipe.health/docs/api/ask.md Fetch an endpoint's page for its full parameters. SETUP - The base URL is in the environment variable OPH_API, the API key in OPH_KEY. Never ask me to paste the key, never print or commit it. If either is unset, stop and ask me. - Send on every request: Authorization: Bearer $OPH_KEY - Errors are JSON, {"error": "message"}. Branch on the HTTP status. - Results are in "rows". Some numbers arrive as JSON strings (npi, sums, money): parse them, but keep npi a string. ENDPOINTS (relative to $OPH_API; GET and 1 credit unless noted) - Free: /api/health, /api/meta, /api/me (credits.used, credits.limit), /api/catalog (what each dataset and column means). - /api/procedures?q=knee: HCPCS/CPT codes. - /api/providers: clinicians and organizations that billed Medicare. Filters: q, state, city, specialty. hcpcs=CODE ranks by volume of that procedure; add specialty to keep assistants out of a surgeon list. - /api/facilities: hospitals. Filters: q, state, min_beds, private_equity=true. /api/groups: group practices. - /api/providers/:npi, /api/facilities/:ccn, /api/groups/:id: one full record. - /api/hospital-intel: hospitals by EHR vendor (ehr), star rating (min_rating), health system (system) or volume in one MS-DRG (drg). /api/health-systems: systems. One hospital: /api/facilities/:ccn/intel, /clinicians, /measures, /drgs. Where a clinician works: /api/providers/:npi/facilities. - /api/care-sites: nursing homes, home health, hospices, dialysis, surgery centers, clinics. Filters include type, state, chain, private_equity, min_stars. One site: /api/care-sites/:id, /:id/owners. - /api/market/drugs?drug=Eliquis: one drug by state, Medicare Part D next to Medicaid. /api/market/drugs/spending: national spending by year. drug is an exact brand or generic name. - /api/market/payers, /api/market/payers/counties/:fips, /api/market/plans: Medicare Advantage and Part D enrollment by parent company, and plans. /api/market/acos, /api/market/acos/:id: Shared Savings Program ACOs. - /api/market/experts?condition=melanoma&state=TX: clinicians ranked by trials led. /api/market/experts/:npi: trials, NIH grants, industry payments. - POST /api/ask, body {"question": "..."}, header Accept: application/json: 25. Takes 5 to 30 seconds. Returns id, title, summary, tiles (each with columns, rows, sources, sql), failed, usage. - /api/dashboards, /api/dashboards/:id: free. Every answer is stored; reopen it by id. - POST /api/exports: 10. A CSV of up to 500,000 rows. The body is a reference: {"list": "providers" | "facilities" | "groups", "params": {search filters as typed JSON}} or {"dashboard": "", "tile": 0}. Searches take limit (default 25) and offset. state is a two-letter code. A 400 or 404 is free; a search that returns zero rows is charged. /api/hospital-intel, /api/health-systems and /api/care-sites reject an unknown parameter with 400; other searches ignore it. HOW TO CHOOSE - A filtered list or one record: a search or lookup (1). Try this first. - A count, total, breakdown, comparison, or a ranking the searches do not sort on: POST /api/ask (25). Name the procedure (with its HCPCS code), drug, specialty and state. - More rows than a page or a tile holds: POST /api/exports (10). CREDITS AND LIMITS - Credits are a monthly workspace allowance. Metered responses carry "usage": {"credits", "creditsUsed", "creditsLimit"}. Ask me before calling /api/ask or /api/exports. - HTTP 502 with "charged": false from ask means nothing was charged: rephrase. If your connection drops, do not ask again: find the stored answer with GET /api/dashboards. - 402: out of credits. Do not retry; tell me. - 429: wait the seconds in the Retry-After header, then retry. Per minute: 300 requests, 10 asks, 10 exports, 120 over MCP. - 400: fix the request; the message says how. 401: bad key; ask me. MCP (prefer it to REST if you support MCP) - Endpoint: $OPH_API/mcp. Streamable HTTP, the same key as a static header, no OAuth. - 27 tools: search_*, get_* and list_* tools for the routes above (1 each), ask (25), list_datasets and describe_data (free). tools/list has the schemas. Arguments are typed JSON: numbers and booleans, not strings. Exports are REST only. - Claude Code: claude mcp add --transport http openpipe "$OPH_API/mcp" --header "Authorization: Bearer $OPH_KEY" RECEIPTS Data responses include the SQL the server ran ("sql"), its values ("params") and the datasets read ("sources"). They are receipts. Show them with any number you show me. For an ask answer, also show its "summary". DATA CAVEATS - Volumes, patients and payments are Medicare fee-for-service only, 2024. Rank and compare with them; never call them totals. Nothing is commercial insurance. - Market responses name their population in "population". Medicaid amounts are before rebates. - Small counts are withheld (under 11 patients, discharges or prescriptions). NULL is not zero. - Hospital EHR is a 2024 attestation; no value means unknown. Clinician-hospital affiliations come from claims, at most five hospitals each: not a staff roster. - NPIs on trials and NIH grants are name matches. Verify "match_confidence": "medium" before outreach. FIRST TASK (2 credits). Run these now and show me the rows with their receipts: 1. curl -s "$OPH_API/api/health" 2. curl -s "$OPH_API/api/procedures?q=knee%20arthroplasty&limit=3" -H "Authorization: Bearer $OPH_KEY" 3. curl -s "$OPH_API/api/providers?hcpcs=27447&state=TX&specialty=orthopedic&limit=3" -H "Authorization: Bearer $OPH_KEY" Then ask me what I want to build. If it needs /api/ask, tell me the question and that it costs 25 credits, and wait for my go-ahead.