Quickstart
1. Set the base URL
Section titled “1. Set the base URL”Every path in these docs is relative to the base URL of your deployment. When you run the repo locally with bun run dev, that is http://localhost:4318.
export OPH_API=http://localhost:4318Check that the API is up. This endpoint needs no key:
curl $OPH_API/api/health2. Create an API key
Section titled “2. Create an API key”Sign in to the app at /app, find API key, and select Create a key. Keys start with oph_ and are shown once, so copy it straight away.
The key belongs to the workspace you created it in and spends that workspace’s credits. In an organization workspace, only owners and admins can create keys.
export OPH_KEY=oph_your_key_here3. Search
Section titled “3. Search”Rank Texas clinicians by the number of total knee replacements (HCPCS 27447) they billed to Medicare:
curl "$OPH_API/api/providers?hcpcs=27447&state=TX&limit=5" \ -H "Authorization: Bearer $OPH_KEY"The response has the rows, the SQL that produced them, the datasets it read, and what the call cost:
{ "rows": [ { "npi": "1234567893", "name": "Jane Example", "credentials": "MD", "specialty": "Orthopedic Surgery", "city": "Houston", "state": "TX", "hcpcs_code": "27447", "services": 412, "patients": "398", "medicare_payment": "498213" } ], "sql": "SELECT s.npi, ... FROM medicare_service s JOIN medicare_provider m ...", "params": ["27447", "TX"], "sources": ["medicare_service", "medicare_provider"], "ms": 4, "usage": { "credits": 1, "creditsUsed": 1, "creditsLimit": 100, "txid": "81234" }}Values in example responses throughout these docs are illustrative. Field names and shapes are exact. Identifiers such as npi, and sums and money amounts, arrive as JSON strings.
4. Ask in plain English
Section titled “4. Ask in plain English”curl "$OPH_API/api/ask" \ -H "Authorization: Bearer $OPH_KEY" \ -H "Content-Type: application/json" -H "Accept: application/json" \ -d '{"question": "Which states do the most cataract surgeries per Medicare patient?"}'With Accept: application/json the finished dashboard comes back as one JSON document after 5 to 30 seconds: a title, a summary, and two to four tiles with their columns and rows. Leave the header out and the same answer arrives as server-sent events, one tile at a time. It costs 25 credits either way. See Ask.
5. Connect an AI client
Section titled “5. Connect an AI client”The same key works with the MCP server, which gives Claude Code, Cursor and other MCP clients the search and lookup tools and ask directly:
claude mcp add --transport http openpipe "$OPH_API/mcp" \ --header "Authorization: Bearer $OPH_KEY"Build with an AI agent has a ready-made prompt, rules files for Claude Code and Cursor, and the docs as /docs/llms.txt.
Limits to know about
Section titled “Limits to know about”Requests are rate limited per workspace: 300 a minute overall, 10 for Ask and 10 for exports. A 429 response has a Retry-After header that says how many seconds to wait.