Inspiration

Hospital list prices can sit far above what hospitals are actually paid: a national study found an average charge-to-cost ratio of 3.4 in 2012 (Bai & Anderson, Health Affairs 2015), and uninsured patients are commonly asked to pay full charges. A patient holding a bill has no easy way to see which lines sit far above a public reference, or to pay a suggested amount with a paper trail. I'm a physician; I wanted a tool that does both, and that never guesses.

What it does

  1. Bill in. Paste the bill text, upload a text-based PDF, or pick one of five synthetic sample bills.
  2. AI reader. GPT-OSS 120B on Fireworks turns the bill into line items (code, modifier, units, amount, date). The output is held to a fixed schema, and every code, amount and date must appear on the bill itself. Anything else is refused.
  3. Audit. Each eligible line is compared with its 2026 Medicare price (Physician Fee Schedule, hospital outpatient OPPS rates, or the lab fee schedule). A line is flagged when it is above what private health plans paid on average relative to Medicare in RAND's Round 5.1 study: 1.84x for professional services, 2.79x for outpatient hospital services. Lines Medicare bundles into another payment, or whose separate price could not be confirmed, are not flagged; the app says "benchmark not available" instead of guessing.
  4. Explain. The model writes a short plain-language summary. It is shown only if every dollar figure in it appears in the audit; otherwise a fixed template is shown.
  5. Pay with PayPal. The patient pays the suggested total with PayPal Orders v2 (JavaScript SDK buttons, server-held amount, capture checked against the audit). BillCheck then uses PayPal Invoicing v2 to generate an itemized invoice at the suggested amounts from the provider's sandbox merchant account, send it to the payer, and record the captured payment on it, so it shows as paid.

Example, synthetic bill C08: $4,445.00 billed, $1,882.38 suggested. The ED visit ($2,400.00) is compared with the 2026 OPPS rate of $426.30 and suggested at $1,189.38.

A flag is a negotiation reference based on public prices, not proof that a charge is incorrect.

How I built it

  • Python 3.12 + FastAPI, one phone-first page in plain HTML/CSS/JS.
  • The pricing rules are fixed code and a benchmark table built from CMS 2026 files (PFS, CLFS, OPPS Addendum B, the CY 2026 OPPS final rule for packaging). I signed each rule as the clinician owner before it was coded; the AI never sets a price.
  • PayPal: JavaScript SDK, Orders v2 (create, capture) and Invoicing v2 (create, send, record payment), all in the sandbox. One order per audit, state checks at each step, and idempotency keys on capture, invoice and payment-record calls.
  • Claude Code wrote and tested the code under my direction; GitHub Copilot and separate AI reviewer agents reviewed the pull requests; GPT-6 Sol acted as an independent quality checker for the rules, test expectations and measured results.

Challenges I ran into

  • Medicare packaging. An ED visit can only be priced on its own when nothing else on the bill changes how Medicare pays it, so the app uses a closed-world test and shows "not available" when it cannot be sure.
  • The AI reader's first run matched only 19 of 28 test bills: the model sometimes returned a schema stub instead of a bill, and one of my own bill layouts wrote quantities ambiguously. Constraining the output to the bill schema and fixing the layout brought it to 28 of 28, with no case-specific rules.
  • PayPal sandbox region. My first sandbox merchant was registered outside the US and PayPal refused the capture with COMPLIANCE_VIOLATION; a US sandbox business account with Invoicing enabled fixed it.

Accomplishments that I'm proud of

  • After tuning on the same synthetic test set, the final run matched the scored extraction fields on all 28 bills rendered in our two layouts; this does not estimate accuracy on real bills.
  • 149 automated tests, run by CI on every pull request.
  • A 22/22 stress round: 6 AI audits at once, 200 requests at 50-way concurrency, a 9-way double click giving one PayPal order, invalid inputs answered with the expected 4xx responses, and a prompt-injection test that still returned the expected total.
  • A live sandbox run where PayPal reports the capture COMPLETED for $1,882.38 and the generated invoice MARKED_AS_PAID for $1,882.38.

What I learned

The hard part of a pricing tool is knowing when not to give a number. Most of the work went into the cases where the honest answer is "benchmark not available".

What's next for BillCheck

Scanned bills, locality-adjusted prices, more fee schedules, and testing with patient advocates on real (consented, de-identified) bills before any claim about real-world accuracy.

Synthetic bills and PayPal sandbox money only. Not medical, legal or financial advice.

Built With

Share this project:

Updates

Submission history