# What CareFix costs to run

Two costs: the AI (per ticket, variable) and the server (fixed). Everything else is Caresoft's own time.

## AI cost per ticket

CareFix uses Claude Sonnet 5 by default. Rates as of 23 September 2026, per million tokens: **$2 input, $10 output**, cached input at 10% of the input rate. Check claude.com/pricing before you budget; the rates are in `CareFix:Claude:Pricing` so a change needs no redeployment.

A typical ticket is one diagnosis run plus a verification run: roughly 6 to 12 AI calls, each carrying the system prompt, the data dictionary context, the conversation and the query results.

| Ticket | Typical AI calls | Cost |
|---|---|---|
| Simple (stuck status, one query) | 4 to 6 | $0.03 to $0.08 |
| Normal (duplicate entry, linked tables) | 8 to 12 | $0.10 to $0.25 |
| Hard (several tables, long conversation) | 15 to 25 | $0.30 to $0.60 |

At 1,500 database tickets a month, expect roughly **$150 to $300 a month**, about ₹13,000 to ₹26,000. Per ticket that is about ₹10 to ₹20, against 45 to 90 minutes of an engineer's time today.

One-off: learning from ticket history costs about $0.02 to $0.04 per 40 tickets read, so a 2,000-ticket export is roughly $1.50.

These are estimates from the prompt sizes in this build, not measured runs. After two weeks of pilot use, **Reports** shows the real figure per period and per ticket. Re-budget from that, not from this table.

## What is already built in to control it

- **Monthly budget.** `CareFix:Claude:MonthlyBudgetUsd` (default $300). When the month's spend reaches it, CareFix stops starting new AI work and says so. Approvals, execution, rollback and the console keep working.
- **Per-ticket cap.** `CareFix:Claude:MaxUsdPerTicket` (default $1.50). One ticket cannot run away; the AI stops and asks a human to take over.
- **Step cap.** `MaxToolCallsPerRun` (default 15) limits calls in one run. The engineer types "continue" to allow more, which keeps a human in the loop on expensive tickets.
- **Prompt caching.** The system prompt and tool definitions are cached, so repeat calls on a ticket pay 10% on that part.
- **Row and size caps.** Query results are capped at 200 rows and trimmed before they reach the AI, which is the single biggest driver of token cost.
- **Every call is metered** in `CF_AI_USAGE` with tokens and cost, tagged as Diagnosis, Verification or Learning.

## Levers if the bill grows

1. **Cut the context, not the quality.** The largest input is the data dictionary and rules sent with every ticket. Keep meanings short; retire rules that no longer apply.
2. **Tighten the row cap.** `Safety:MaxRowsPerSelect` from 200 to 100 roughly halves the result tokens on wide queries.
3. **Model choice.** `CareFix:Claude:Model` is configuration. Haiku 4.5 ($1/$5) is worth testing for simple modules once playbooks are good; keep Sonnet 5 for billing and finance work. Opus 5 ($5/$25) only if accuracy on hard tickets proves worth 2.5x.
4. **Better playbooks reduce cost.** A matched playbook cuts the search-and-explore calls, which is where the tokens go. The Learn-from-tickets drafts pay for themselves here.

## Server cost

One Windows VM (4 vCPU, 8 GB) running IIS and the control database, or a small SQL instance beside it. This is the same shape as Caresoft's existing gateway server; the load is light because CareFix mostly waits on the AI and on hospital databases. Add backup for `CS_CAREFIX`: it holds the audit trail and the snapshots used for rollback.

The agent runs on the hospital's own server and costs nothing extra.

## What to tell the business

At roughly ₹15 a ticket in AI cost, the question is not the bill, it is engineer minutes saved and how quickly hospitals get their data corrected. Track those two in **Reports** from day one of the pilot: median time from ticket to closure, and tickets closed per engineer per week. Those numbers, not the token cost, are the case for rolling CareFix out to all 1,000+ hospitals.
