# Levy 2006 Seattle Heart Failure Model

Seattle Heart Failure Model

Status: LIVE
Price: $0.005 USDC
`GET /api/calc/shfm`
HTML: https://magentlab.com/docs/seattle-hf
Markdown: https://magentlab.com/docs/seattle-hf.md

Not a medical device. Not a diagnosis, dose, or listing recommendation.

## What it computes

Compute Levy 2006 Seattle Heart Failure Model 1-, 2-, and 3-year survival percents from Table 2 multivariate hazard ratios for a patient already on the listed medications and devices.

## When to use

When an agent already has those Levy 2006 predictors and needs that paper's 1-, 2-, and 3-year survival percents. Caller assigns NYHA class, etiology, and therapy flags. Not a diagnosis, prescription, or device order.

## When not to use

- Not a medical device. Not a diagnosis of heart failure. Not a treatment order, medication recommendation, or device order.
- Estimates 1-, 2-, and 3-year survival from Levy 2006 Table 2 for a patient already on the listed medications and devices. Does not estimate whether a drug or device can be added safely and is not a reason to withhold therapy.
- Caller assigns NYHA class, ischemic etiology, and medication/device flags. magent does not examine the patient, does not measure blood pressure or weight, and does not assay labs.
- Diuretic dose is furosemide-equivalent mg/kg/day (paper: furosemide 80 = torsemide 40 = bumetanide 3). Lymphocytes >47%, uric acid <3.4 mg/dL, and SBP >160 mm Hg are truncated as in the paper. Gender male 1.089 was forced into Table 2.
- Derived and validated mainly in systolic heart-failure outpatients. Not for hospitalized patients or major non-cardiac comorbidities. Does not include peak VO2 or natriuretic peptides.

## Formula

```
score = sum(ln(HR)*x); S(t)=exp(-0.0405*t)**exp(score) for t years 0-5; Levy 2006 Table 2 multivariate HRs (italic β=ln(HR); medication/device = patient-already-on column); 1/2/3-year survival % round 1 decimal; age/10 * ln(1.090); male ln(1.089) (forced); NYHA * ln(1.600); (100/EF)*ln(1.030); ischemic ln(1.354); min(SBP,160)/10 * ln(0.877); furosemide-eq mg/kg/day * ln(1.178) (furosemide 80 = torsemide 40 = bumetanide 3); allopurinol ln(1.571); if Na<138: (138-Na)*ln(1.050); (100/cholesterol)*ln(2.206); if Hb<16: (16-Hb)*ln(1.124); if Hb>16: (Hb-16)*ln(1.336); min(%lymphocytes,47)/5 * ln(0.897); max(uric_acid,3.4)*ln(1.064); ACEI ln(0.77); beta-blocker ln(0.66); ARB ln(0.85); K-sparing diuretic ln(0.74); statin ln(0.63); BiV pacemaker ln(1.00); ICD ln(0.73); BiV-ICD ln(0.79); devices mutually exclusive; not a diagnosis or treatment/device order
```

## Citation

[The Seattle Heart Failure Model: Prediction of Survival in Heart Failure](https://doi.org/10.1161/CIRCULATIONAHA.105.584102)
Levy WC, Mozaffarian D, Linker DT, Sutradhar SC, Anker SD, Cropp AB, et al.
Circulation. 2006;113(11):1424-1433
DOI: [10.1161/CIRCULATIONAHA.105.584102](https://doi.org/10.1161/CIRCULATIONAHA.105.584102)

## Worked example

### NYHA II, EF 30%, male age 60, SBP 120, no diuretic, ACE inhibitor and beta-blocker

Given: `ace_inhibitor=true, age=60, allopurinol=false, arb=false, beta_blocker=true, biv_icd=false, biv_pacemaker=false, ef_percent=30, hemoglobin_g_dl=14, icd=false, ischemic=false, k_sparing_diuretic=false, loop_diuretic_furosemide_eq_mg_day=0, lymphocyte_percent=25, nyha=2, sbp_mm_hg=120, sex=male, sodium_meq_l=140, statin=false, total_cholesterol_mg_dl=180, uric_acid_mg_dl=6, weight_kg=80`

1. Table 2 score = ln(1.090)*(60/10) + ln(1.089) + ln(1.600)*2 + ln(1.030)*(100/30) + ln(0.877)*(120/10) + ln(2.206)*(100/180) + ln(1.124)*(16-14) + ln(0.897)*(25/5) + ln(1.064)*6 + ln(0.77) + ln(0.66)
2. ischemic, allopurinol, ARB, K-sparing diuretic, statin, and devices are false (0); Na 140 ≥138 adds 0; diuretic 0 mg/kg/day
3. score -0.1089
4. S(t)=exp(-0.0405*t)**exp(score); survival_1y_percent 96.4; survival_2y_percent 93.0; survival_3y_percent 89.7


## Also searched as

- Seattle Heart Failure Model
- SHFM survival
- Levy 2006 heart failure survival
- PRAISE1 heart failure model
- NYHA EF diuretic survival
- 1-year heart failure survival
- furosemide equivalent heart failure

## Parameters

- `age` (integer, required): Age in years (integer 14-100). Levy 2006 Table 2: per decade, multivariate HR 1.090. magent does not take a date of birth.
- `sex` (string, required): Sex used by the forced Table 2 male HR 1.089 (female or male). magent does not assign sex.
- `nyha` (integer, required): NYHA class 1-4 as assigned by the caller (integer). Levy 2006 Table 2 multivariate HR 1.600 per class. magent does not examine the patient.
- `ef_percent` (number, required): Left-ventricular ejection fraction in percent (1-80). Enters as 100/EF with Table 2 HR 1.030. magent does not interpret an echocardiogram.
- `ischemic` (boolean, required): Ischemic etiology as assigned by the caller (true or false). Table 2 multivariate HR 1.354. magent does not assign etiology.
- `sbp_mm_hg` (number, required): Systolic blood pressure in mm Hg (50-250). Table 2: per 10 mm Hg, HR 0.877, truncated at 160 (SBP 180 is scored as 160). magent does not measure blood pressure.
- `weight_kg` (number, required): Body weight in kg (20-250) used only to convert the furosemide-equivalent diuretic dose to mg/kg/day. magent does not weigh the patient.
- `loop_diuretic_furosemide_eq_mg_day` (number, required): Daily loop-diuretic dose as furosemide milligram equivalent (0-1000). Paper conversion: furosemide 80 = torsemide 40 = bumetanide 3. Divided by weight_kg; Table 2 HR 1.178 per mg/kg/day. magent does not prescribe a diuretic.
- `allopurinol` (boolean, required): Current allopurinol as assigned by the caller (true or false). Table 2 multivariate HR 1.571. magent does not prescribe allopurinol.
- `sodium_meq_l` (number, required): Serum sodium in mEq/L (110-160). Table 2: if Na<138, (138-Na) with HR 1.050 per mEq; values ≥138 add 0. magent does not assay sodium.
- `total_cholesterol_mg_dl` (number, required): Total cholesterol in mg/dL (50-800). Enters as 100/cholesterol with Table 2 HR 2.206. magent does not assay lipids.
- `hemoglobin_g_dl` (number, required): Hemoglobin in g/dL (4-22). Table 2: if Hb<16, (16-Hb) with HR 1.124 per g/dL; if Hb>16, (Hb-16) with HR 1.336 per g/dL. magent does not assay hemoglobin.
- `lymphocyte_percent` (number, required): Percent lymphocytes (0-100). Table 2: per 5% when <47%, HR 0.897; values >47% are truncated to 47. magent does not assay a CBC.
- `uric_acid_mg_dl` (number, required): Serum uric acid in mg/dL (0.5-25). Table 2: per mg/dL when >3.4, HR 1.064; values <3.4 are truncated to 3.4. magent does not assay uric acid.
- `ace_inhibitor` (boolean, required): Patient already on an ACE inhibitor as assigned by the caller (true or false). Table 2 already-on HR 0.77. Not a prescription.
- `beta_blocker` (boolean, required): Patient already on a beta-blocker as assigned by the caller (true or false). Table 2 already-on HR 0.66. Not a prescription.
- `arb` (boolean, required): Patient already on an angiotensin-receptor blocker as assigned by the caller (true or false). Table 2 already-on HR 0.85. Not a prescription.
- `k_sparing_diuretic` (boolean, required): Patient already on a potassium-sparing diuretic as assigned by the caller (true or false). Table 2 already-on HR 0.74. Not a prescription.
- `statin` (boolean, required): Patient already on a statin as assigned by the caller (true or false). Table 2 already-on / multivariate HR 0.63. Not a prescription.
- `biv_pacemaker` (boolean, required): Patient already has a biventricular pacemaker (without ICD) as assigned by the caller (true or false). Table 2 already-on HR 1.00. Mutually exclusive with icd and biv_icd. Not a device order.
- `icd` (boolean, required): Patient already has an ICD (without biventricular pacing) as assigned by the caller (true or false). Table 2 already-on HR 0.73. Mutually exclusive with biv_pacemaker and biv_icd. Not a device order.
- `biv_icd` (boolean, required): Patient already has a biventricular ICD as assigned by the caller (true or false). Table 2 already-on HR 0.79. Mutually exclusive with biv_pacemaker and icd. Not a device order.

## Bulk (POST)

POST the same path with a JSON items array. The first item is the GET unit; each additional item is $0.002. Invalid items return HTTP 400 before settlement.

Method: `POST /api/calc/shfm`
Max items: 25
Price: unit_amount + extra_item_amount * (n - 1) (unit 5000 atomic, extra 2000 atomic)
Status: PREVIEW

- 1 to 25 items. Each item uses the same keys as the GET query parameters.
- POST of 1 item costs the same as GET. Lists longer than 25: chunk into multiple POSTs. Extra items still execute; do not pad dummy rows.
- The first invalid item fails the whole request (index in the 400 JSON). You are not charged.
- HTTP 200 is {count, path, items}. Each items[i] is the GET 200 body for that row.
- Catalog misses (empty matches, found=false) stay paid 200s inside that slot.
- x402 resource URL is this path plus n and body_sha256. Browsers that prefer text/html get the same paywall as GET; Pay retries POST with the same items.

Example request:

```json
{
  "items": [
    {
      "ace_inhibitor": "true",
      "age": "60",
      "allopurinol": "false",
      "arb": "false",
      "beta_blocker": "true",
      "biv_icd": "false",
      "biv_pacemaker": "false",
      "ef_percent": "30",
      "hemoglobin_g_dl": "14",
      "icd": "false",
      "ischemic": "false",
      "k_sparing_diuretic": "false",
      "loop_diuretic_furosemide_eq_mg_day": "0",
      "lymphocyte_percent": "25",
      "nyha": "2",
      "sbp_mm_hg": "120",
      "sex": "male",
      "sodium_meq_l": "140",
      "statin": "false",
      "total_cholesterol_mg_dl": "180",
      "uric_acid_mg_dl": "6",
      "weight_kg": "80"
    },
    {
      "ace_inhibitor": "true",
      "age": "60",
      "allopurinol": "false",
      "arb": "false",
      "beta_blocker": "true",
      "biv_icd": "false",
      "biv_pacemaker": "false",
      "ef_percent": "30",
      "hemoglobin_g_dl": "14",
      "icd": "false",
      "ischemic": "false",
      "k_sparing_diuretic": "false",
      "loop_diuretic_furosemide_eq_mg_day": "0",
      "lymphocyte_percent": "25",
      "nyha": "2",
      "sbp_mm_hg": "120",
      "sex": "male",
      "sodium_meq_l": "140",
      "statin": "false",
      "total_cholesterol_mg_dl": "180",
      "uric_acid_mg_dl": "6",
      "weight_kg": "80"
    }
  ]
}
```

Human paywall (two-item fixture): https://api.magentlab.com/paywall/bulk/seattle-hf

Example 200:

```json
{
  "count": 2,
  "path": "/api/calc/shfm",
  "items": [
    {
      "age": 60,
      "disclaimer": "Not a medical device. Deterministic published-formula or published-code output for autonomous agents. A licensed clinician remains responsible for patient care and billing submissions.",
      "citation": {
        "authors": "Levy WC, Mozaffarian D, Linker DT, Sutradhar SC, Anker SD, Cropp AB, et al.",
        "doi": "10.1161/CIRCULATIONAHA.105.584102",
        "id": "levy-2006-shfm",
        "pmid": "16534009",
        "source": "Circulation. 2006;113(11):1424-1433",
        "title": "The Seattle Heart Failure Model: Prediction of Survival in Heart Failure"
      },
      "formula": "shfm",
      "formula_expression": "score = sum(ln(HR)*x); S(t)=exp(-0.0405*t)**exp(score) for t years 0-5; Levy 2006 Table 2 multivariate HRs (italic β=ln(HR); medication/device = patient-already-on column); 1/2/3-year survival % round 1 decimal; age/10 * ln(1.090); male ln(1.089) (forced); NYHA * ln(1.600); (100/EF)*ln(1.030); ischemic ln(1.354); min(SBP,160)/10 * ln(0.877); furosemide-eq mg/kg/day * ln(1.178) (furosemide 80 = torsemide 40 = bumetanide 3); allopurinol ln(1.571); if Na<138: (138-Na)*ln(1.050); (100/cholesterol)*ln(2.206); if Hb<16: (16-Hb)*ln(1.124); if Hb>16: (Hb-16)*ln(1.336); min(%lymphocytes,47)/5 * ln(0.897); max(uric_acid,3.4)*ln(1.064); ACEI ln(0.77); beta-blocker ln(0.66); ARB ln(0.85); K-sparing diuretic ln(0.74); statin ln(0.63); BiV pacemaker ln(1.00); ICD ln(0.73); BiV-ICD ln(0.79); devices mutually exclusive; not a diagnosis or treatment/device order",
      "score": -0.1089,
      "lymphocyte_percent": 25.0,
      "weight_kg": 80.0,
      "sex": "male",
      "sbp_mm_hg": 120.0,
      "total_cholesterol_mg_dl": 180.0,
      "hemoglobin_g_dl": 14.0,
      "nyha": 2,
      "beta_blocker": true,
      "ef_percent": 30.0,
      "statin": false,
      "ace_inhibitor": true,
      "allopurinol": false,
      "arb": false,
      "biv_icd": false,
      "biv_pacemaker": false,
      "diuretic_furosemide_eq_mg_kg_day": 0.0,
      "icd": false,
      "ischemic": false,
      "k_sparing_diuretic": false,
      "loop_diuretic_furosemide_eq_mg_day": 0.0,
      "sodium_meq_l": 140.0,
      "survival_1y_percent": 96.4,
      "survival_2y_percent": 93.0,
      "survival_3y_percent": 89.7,
      "uric_acid_mg_dl": 6.0
    },
    {
      "age": 60,
      "disclaimer": "Not a medical device. Deterministic published-formula or published-code output for autonomous agents. A licensed clinician remains responsible for patient care and billing submissions.",
      "citation": {
        "authors": "Levy WC, Mozaffarian D, Linker DT, Sutradhar SC, Anker SD, Cropp AB, et al.",
        "doi": "10.1161/CIRCULATIONAHA.105.584102",
        "id": "levy-2006-shfm",
        "pmid": "16534009",
        "source": "Circulation. 2006;113(11):1424-1433",
        "title": "The Seattle Heart Failure Model: Prediction of Survival in Heart Failure"
      },
      "formula": "shfm",
      "formula_expression": "score = sum(ln(HR)*x); S(t)=exp(-0.0405*t)**exp(score) for t years 0-5; Levy 2006 Table 2 multivariate HRs (italic β=ln(HR); medication/device = patient-already-on column); 1/2/3-year survival % round 1 decimal; age/10 * ln(1.090); male ln(1.089) (forced); NYHA * ln(1.600); (100/EF)*ln(1.030); ischemic ln(1.354); min(SBP,160)/10 * ln(0.877); furosemide-eq mg/kg/day * ln(1.178) (furosemide 80 = torsemide 40 = bumetanide 3); allopurinol ln(1.571); if Na<138: (138-Na)*ln(1.050); (100/cholesterol)*ln(2.206); if Hb<16: (16-Hb)*ln(1.124); if Hb>16: (Hb-16)*ln(1.336); min(%lymphocytes,47)/5 * ln(0.897); max(uric_acid,3.4)*ln(1.064); ACEI ln(0.77); beta-blocker ln(0.66); ARB ln(0.85); K-sparing diuretic ln(0.74); statin ln(0.63); BiV pacemaker ln(1.00); ICD ln(0.73); BiV-ICD ln(0.79); devices mutually exclusive; not a diagnosis or treatment/device order",
      "score": -0.1089,
      "lymphocyte_percent": 25.0,
      "weight_kg": 80.0,
      "sex": "male",
      "sbp_mm_hg": 120.0,
      "total_cholesterol_mg_dl": 180.0,
      "hemoglobin_g_dl": 14.0,
      "nyha": 2,
      "beta_blocker": true,
      "ef_percent": 30.0,
      "statin": false,
      "ace_inhibitor": true,
      "allopurinol": false,
      "arb": false,
      "biv_icd": false,
      "biv_pacemaker": false,
      "diuretic_furosemide_eq_mg_kg_day": 0.0,
      "icd": false,
      "ischemic": false,
      "k_sparing_diuretic": false,
      "loop_diuretic_furosemide_eq_mg_day": 0.0,
      "sodium_meq_l": 140.0,
      "survival_1y_percent": 96.4,
      "survival_2y_percent": 93.0,
      "survival_3y_percent": 89.7,
      "uric_acid_mg_dl": 6.0
    }
  ]
}
```

## Response fields

- `formula` (string): shfm
- `formula_expression` (string): Levy 2006 Table 2 multivariate SHFM score and S(t)
- `age` (integer): Age in years used (14-100)
- `sex` (string): female or male used
- `nyha` (integer): NYHA class 1-4 used
- `ef_percent` (number): Ejection fraction used, percent
- `ischemic` (boolean): Caller-assigned ischemic etiology used
- `sbp_mm_hg` (number): Systolic BP used, mm Hg
- `weight_kg` (number): Weight used, kg
- `loop_diuretic_furosemide_eq_mg_day` (number): Furosemide-equivalent loop-diuretic dose used, mg/day
- `diuretic_furosemide_eq_mg_kg_day` (number): Table 2 diuretic dose, furosemide-eq mg/kg/day, 4 decimals
- `allopurinol` (boolean): Caller-assigned allopurinol used
- `sodium_meq_l` (number): Serum sodium used, mEq/L
- `total_cholesterol_mg_dl` (number): Total cholesterol used, mg/dL
- `hemoglobin_g_dl` (number): Hemoglobin used, g/dL
- `lymphocyte_percent` (number): Percent lymphocytes used
- `uric_acid_mg_dl` (number): Uric acid used, mg/dL
- `ace_inhibitor` (boolean): Caller-assigned already-on ACE inhibitor used
- `beta_blocker` (boolean): Caller-assigned already-on beta-blocker used
- `arb` (boolean): Caller-assigned already-on ARB used
- `k_sparing_diuretic` (boolean): Caller-assigned already-on potassium-sparing diuretic used
- `statin` (boolean): Caller-assigned already-on statin used
- `biv_pacemaker` (boolean): Caller-assigned already-on biventricular pacemaker used
- `icd` (boolean): Caller-assigned already-on ICD used
- `biv_icd` (boolean): Caller-assigned already-on biventricular ICD used
- `score` (number): Table 2 SHFM score (sum of ln(HR)*x), 4 decimals
- `survival_1y_percent` (number): 1-year survival percent, 1 decimal
- `survival_2y_percent` (number): 2-year survival percent, 1 decimal
- `survival_3y_percent` (number): 3-year survival percent, 1 decimal
- `citation` (object): Levy et al. Circulation 2006 citation
- `disclaimer` (string): Not-a-device notice

## Example JSON

Frozen fixture. Not a live lookup.

```json
{
  "age": 60,
  "disclaimer": "Not a medical device. Deterministic published-formula or published-code output for autonomous agents. A licensed clinician remains responsible for patient care and billing submissions.",
  "citation": {
    "authors": "Levy WC, Mozaffarian D, Linker DT, Sutradhar SC, Anker SD, Cropp AB, et al.",
    "doi": "10.1161/CIRCULATIONAHA.105.584102",
    "id": "levy-2006-shfm",
    "pmid": "16534009",
    "source": "Circulation. 2006;113(11):1424-1433",
    "title": "The Seattle Heart Failure Model: Prediction of Survival in Heart Failure"
  },
  "formula": "shfm",
  "formula_expression": "score = sum(ln(HR)*x); S(t)=exp(-0.0405*t)**exp(score) for t years 0-5; Levy 2006 Table 2 multivariate HRs (italic β=ln(HR); medication/device = patient-already-on column); 1/2/3-year survival % round 1 decimal; age/10 * ln(1.090); male ln(1.089) (forced); NYHA * ln(1.600); (100/EF)*ln(1.030); ischemic ln(1.354); min(SBP,160)/10 * ln(0.877); furosemide-eq mg/kg/day * ln(1.178) (furosemide 80 = torsemide 40 = bumetanide 3); allopurinol ln(1.571); if Na<138: (138-Na)*ln(1.050); (100/cholesterol)*ln(2.206); if Hb<16: (16-Hb)*ln(1.124); if Hb>16: (Hb-16)*ln(1.336); min(%lymphocytes,47)/5 * ln(0.897); max(uric_acid,3.4)*ln(1.064); ACEI ln(0.77); beta-blocker ln(0.66); ARB ln(0.85); K-sparing diuretic ln(0.74); statin ln(0.63); BiV pacemaker ln(1.00); ICD ln(0.73); BiV-ICD ln(0.79); devices mutually exclusive; not a diagnosis or treatment/device order",
  "score": -0.1089,
  "lymphocyte_percent": 25.0,
  "weight_kg": 80.0,
  "sex": "male",
  "sbp_mm_hg": 120.0,
  "total_cholesterol_mg_dl": 180.0,
  "hemoglobin_g_dl": 14.0,
  "nyha": 2,
  "beta_blocker": true,
  "ef_percent": 30.0,
  "statin": false,
  "ace_inhibitor": true,
  "allopurinol": false,
  "arb": false,
  "biv_icd": false,
  "biv_pacemaker": false,
  "diuretic_furosemide_eq_mg_kg_day": 0.0,
  "icd": false,
  "ischemic": false,
  "k_sparing_diuretic": false,
  "loop_diuretic_furosemide_eq_mg_day": 0.0,
  "sodium_meq_l": 140.0,
  "survival_1y_percent": 96.4,
  "survival_2y_percent": 93.0,
  "survival_3y_percent": 89.7,
  "uric_acid_mg_dl": 6.0
}
```

## Errors

- HTTP 400 `invalid_shfm`: Seattle Heart Failure Model inputs must match Levy 2006 Table 2 clinical, laboratory, medication, and device predictors. Returned before settlement; you are not charged.
- HTTP 400 `invalid_items`: POST body must be a JSON object with only an items array Returned before settlement; you are not charged.
- HTTP 400 `invalid_item_count`: items must be an array of 1 to 25 objects Returned before settlement; you are not charged.
- HTTP 400 `invalid_item`: each items entry must be a JSON object Returned before settlement; you are not charged.

Shared HTTP 402 and 503: https://magentlab.com/docs/payments

## Related tools

- [MAGGIC](https://magentlab.com/docs/maggic) — Sum the Pocock 2013 MAGGIC integer chart from thirteen caller-supplied heart-failure predictors and return the published Table 4 1-year and 3-year death probabilities for scores 0-50.
- [GWTG-HF](https://magentlab.com/docs/gwtg-hf) — Sum Peterson 2010 Figure 2 GWTG-HF integer points from seven admission predictors (age, systolic BP, BUN, sodium, heart rate, COPD, and caller-assigned nonblack race) for in-hospital mortality in hospitalized heart failure.
- [PCP-HF 10-year incident HF](https://magentlab.com/docs/pcp-hf) — Compute the Khan 2019 PCP-HF 10-year incident heart-failure percent for adults aged 30-79 from Table 2 sex- and cohort-specific Cox coefficients.

## Payment

Unpaid requests return HTTP 402 even if query parameters or POST items are missing or invalid, so CDP and agents can index the path. After a PAYMENT-SIGNATURE, invalid params return HTTP 400 JSON before settlement. magent does not charge. Fix the params, then request a new 402 quote for that complete URL. Catalog misses (empty matches, found=false) are valid paid 200s.

- GET the tool with Accept: application/json (do not send Accept: text/html unless you want the human paywall).
- HTTP 402 means you have not paid. Decode the base64 PAYMENT-REQUIRED header. HTTP 503 is not a new quote.
- Sign accepts[0] (exact, EIP-3009) with validBefore = now + maxTimeoutSeconds (600 seconds), or accepts[1] (batch-settlement deposit/voucher) on product GET. Ping and POST {items} stay exact. Magent retries transient facilitator 429/5xx before answering.
- Retry the same URL with PAYMENT-SIGNATURE (base64 JSON of accepted and payload). Magent attaches canonical extensions.bazaar on CDP verify/settle; echoing 402 bazaar is optional.
- Success is HTTP 200 JSON plus PAYMENT-RESPONSE. exact settles before the tool. batch-settlement verifies (and deposit-settles) before the tool and commits the charge after HTTP 2xx. HTTP 503: retry the same PAYMENT-SIGNATURE. Mint a new exact nonce only after a new HTTP 402.

- offered `exact` on eip155:8453: Fixed-price USDC on Base. The buyer authorizes the advertised amount (EIP-3009). magent settles before the tool runs (paymentFlow upfront). extra.assetTransferMethod=eip3009 extra.paymentFlow=upfront.
- offered `batch-settlement` on eip155:8453: Payment-channel vouchers claimed later in batches. Exact stays accepts[0]. Same-path POST {items} is still exact. extra.assetTransferMethod=eip3009 extra.paymentFlow=authorization.

- not offered `upto`: Not offered. Usage-based: buyer authorizes a ceiling, seller settles the actual amount after work. Reserved for a future metered tool. Not for current calculators or code search.

Same-path POST {items} is still scheme exact: one EIP-3009 authorization for GET unit plus $0.002 per extra item. That is not x402 batch-settlement (payment channels / vouchers).

Shared HTTP 402 and 503 table: https://magentlab.com/docs/payments

Stdio MCP (one process per host): https://magentlab.com/docs/mcp

## Guarantees

- HTTP 402 is unpaid, including a missing query. After PAYMENT-SIGNATURE, invalid parameters return HTTP 400 before settlement. You are not charged. HTTP 402 never includes the tool JSON.
- exact: settlement finishes before the tool (paymentFlow upfront). batch-settlement: verify/deposit before the tool; chargedCumulativeAmount commits after HTTP 2xx. Uncertain or failed settlement fails closed (HTTP 503). Retry the same PAYMENT-SIGNATURE.
- HTTP 402 is unpaid only. Do not sign a second authorization because of a 503.
- Execution is timeout-bounded and concurrency-capped.
- Calculator inputs are stored encrypted for allowlisted operators (Magent Console). They are not in public logs, SSH lookups, catalog, or rollups. Request logs store path without query.
