# Lung injury prediction score

LIPS

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

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

## What it computes

Sum Gajic 2011 Table 3 lung injury prediction score items from caller-assigned flags and return the published ROC cutoff band (low <4, high ≥4).

## When to use

When an agent needs the published LIPS point total and must not invent an ARDS diagnosis or additional cut-points.

## When not to use

- Not a medical device. Not an ARDS diagnosis. magent does not examine the patient or read imaging; every flag is caller-assigned.
- Gajic 2011 Table 3 worksheet only. At most one high-risk surgery type (orthopedic_spine, acute_abdomen, cardiac, aortic_vascular) may be true.
- Emergency surgery adds 1.5 in addition to the surgery type (footnote *). Diabetes mellitus subtracts 1 only when sepsis is true (footnote †); diabetes without sepsis scores 0.
- Bands are low (score <4) and high (score ≥4) from the paper ROC cutoff. No other cut-points are returned.
- max_score 15.5 is the published observed range in Gajic 2011, not a theoretical sum of every Table 3 row.

## Formula

```
LIPS = shock(2) + aspiration(2) + sepsis(1) + pneumonia(1.5) + at most one of orthopedic_spine(1), acute_abdomen(2), cardiac(2.5), aortic_vascular(3.5) + emergency_surgery(1.5) + traumatic_brain_injury(2) + smoke_inhalation(2) + near_drowning(2) + lung_contusion(1.5) + multiple_fractures(1.5) + alcohol_abuse(1) + obesity_bmi_gt_30(1) + hypoalbuminemia(1) + chemotherapy(1) + fio2_gt_035(2) + tachypnea_rr_gt_30(1.5) + spo2_lt_95(1) + acidosis_ph_lt_735(1.5) + diabetes_mellitus(-1 only if sepsis); Gajic 2011 Table 3; published observed range 0-15.5; low <4, high >=4
```

## Citation

[Early Identification of Patients at Risk of Acute Lung Injury: Evaluation of Lung Injury Prediction Score in a Multicenter Cohort Study](https://doi.org/10.1164/rccm.201004-0549OC)
Gajic O, Dabbagh O, Park PK, Adesanya A, Chang SY, Hou P, Anderson H 3rd, Hoth JJ, Mikkelsen ME, Gentile NT, Gong MN, Talmor D, Bajwa E, Watkins TR, Festic E, Yilmaz M, Liendahl M, Khan NA, Sevransky JE, Malinchoc M; US Critical Illness and Injury Trials Group: Lung Injury Prevention Study Investigators (USCIITG-LIPS)
Am J Respir Crit Care Med. 2011;183(4):462-470
DOI: [10.1164/rccm.201004-0549OC](https://doi.org/10.1164/rccm.201004-0549OC)

## Worked example

### Table 3 example 1: septic shock, pneumonia, alcohol, FiO2 >0.35

Given: `acidosis_ph_lt_735=false, acute_abdomen=false, alcohol_abuse=true, aortic_vascular=false, aspiration=false, cardiac=false, chemotherapy=false, diabetes_mellitus=false, emergency_surgery=false, fio2_gt_035=true, hypoalbuminemia=false, lung_contusion=false, multiple_fractures=false, near_drowning=false, obesity_bmi_gt_30=false, orthopedic_spine=false, pneumonia=true, sepsis=true, shock=true, smoke_inhalation=false, spo2_lt_95=false, tachypnea_rr_gt_30=false, traumatic_brain_injury=false`

1. sepsis → 1; shock → 2; pneumonia → 1.5; alcohol_abuse → 1; fio2_gt_035 → 2
2. score = 1+2+1.5+1+2 = 7.5; lips_band high (>=4)


### Table 3 example 2: diabetes, urosepsis, and shock

Given: `acidosis_ph_lt_735=false, acute_abdomen=false, alcohol_abuse=false, aortic_vascular=false, aspiration=false, cardiac=false, chemotherapy=false, diabetes_mellitus=true, emergency_surgery=false, fio2_gt_035=false, hypoalbuminemia=false, lung_contusion=false, multiple_fractures=false, near_drowning=false, obesity_bmi_gt_30=false, orthopedic_spine=false, pneumonia=false, sepsis=true, shock=true, smoke_inhalation=false, spo2_lt_95=false, tachypnea_rr_gt_30=false, traumatic_brain_injury=false`

1. sepsis → 1; shock → 2; diabetes_mellitus → -1 (footnote †, sepsis true)
2. score = 1+2-1 = 2; lips_band low (<4)


## Also searched as

- lung injury prediction score
- LIPS score
- Gajic LIPS
- ALI prediction score
- lung injury prediction
- LIPS Gajic 2011
- acute lung injury prediction

## Parameters

- `shock` (boolean, required): Shock as assigned by the caller (Gajic 2011 Table 3). true scores 2. magent does not examine the patient.
- `aspiration` (boolean, required): Aspiration as assigned by the caller (Gajic 2011 Table 3). true scores 2. magent does not examine the patient.
- `sepsis` (boolean, required): Sepsis as assigned by the caller (Gajic 2011 Table 3). true scores 1. magent does not diagnose sepsis.
- `pneumonia` (boolean, required): Pneumonia as assigned by the caller (Gajic 2011 Table 3). true scores 1.5. magent does not read imaging.
- `orthopedic_spine` (boolean, required): High-risk orthopedic spine surgery as assigned by the caller (Gajic 2011 Table 3). true scores 1. At most one of orthopedic_spine, acute_abdomen, cardiac, and aortic_vascular may be true.
- `acute_abdomen` (boolean, required): High-risk acute abdomen surgery as assigned by the caller (Gajic 2011 Table 3). true scores 2. At most one of orthopedic_spine, acute_abdomen, cardiac, and aortic_vascular may be true.
- `cardiac` (boolean, required): High-risk cardiac surgery as assigned by the caller (Gajic 2011 Table 3). true scores 2.5. At most one of orthopedic_spine, acute_abdomen, cardiac, and aortic_vascular may be true.
- `aortic_vascular` (boolean, required): High-risk aortic vascular surgery as assigned by the caller (Gajic 2011 Table 3). true scores 3.5. At most one of orthopedic_spine, acute_abdomen, cardiac, and aortic_vascular may be true.
- `emergency_surgery` (boolean, required): Emergency surgery as assigned by the caller (Gajic 2011 Table 3 footnote *: add 1.5 points if emergency surgery). true scores 1.5 in addition to any one surgery type.
- `traumatic_brain_injury` (boolean, required): Traumatic brain injury as assigned by the caller (Gajic 2011 Table 3). true scores 2. Trauma items may stack. magent does not read imaging.
- `smoke_inhalation` (boolean, required): Smoke inhalation as assigned by the caller (Gajic 2011 Table 3). true scores 2. Trauma items may stack.
- `near_drowning` (boolean, required): Near drowning as assigned by the caller (Gajic 2011 Table 3). true scores 2. Trauma items may stack.
- `lung_contusion` (boolean, required): Lung contusion as assigned by the caller (Gajic 2011 Table 3). true scores 1.5. Trauma items may stack. magent does not read imaging.
- `multiple_fractures` (boolean, required): Multiple fractures as assigned by the caller (Gajic 2011 Table 3). true scores 1.5. Trauma items may stack.
- `alcohol_abuse` (boolean, required): Alcohol abuse as assigned by the caller (Gajic 2011 Table 3). true scores 1.
- `obesity_bmi_gt_30` (boolean, required): Obesity (BMI >30) as assigned by the caller (Gajic 2011 Table 3). true scores 1. magent does not take height or weight.
- `hypoalbuminemia` (boolean, required): Hypoalbuminemia as assigned by the caller (Gajic 2011 Table 3). true scores 1. magent does not assay albumin.
- `chemotherapy` (boolean, required): Chemotherapy as assigned by the caller (Gajic 2011 Table 3). true scores 1.
- `fio2_gt_035` (boolean, required): FiO2 >0.35 or >4 L/min as assigned by the caller (Gajic 2011 Table 3). true scores 2. magent does not read the ventilator or flowmeter.
- `tachypnea_rr_gt_30` (boolean, required): Tachypnea (respiratory rate >30) as assigned by the caller (Gajic 2011 Table 3). true scores 1.5. magent does not count respirations.
- `spo2_lt_95` (boolean, required): SpO2 <95% as assigned by the caller (Gajic 2011 Table 3). true scores 1. magent does not measure SpO2.
- `acidosis_ph_lt_735` (boolean, required): Acidosis (pH <7.35) as assigned by the caller (Gajic 2011 Table 3). true scores 1.5. magent does not assay blood gas.
- `diabetes_mellitus` (boolean, required): Diabetes mellitus as assigned by the caller (Gajic 2011 Table 3 footnote dagger). Subtracts 1 only when sepsis is true. If diabetes is true and sepsis is false, 0 points (do not subtract). magent does not diagnose diabetes.

## 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/lips`
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": [
    {
      "acidosis_ph_lt_735": "false",
      "acute_abdomen": "false",
      "alcohol_abuse": "true",
      "aortic_vascular": "false",
      "aspiration": "false",
      "cardiac": "false",
      "chemotherapy": "false",
      "diabetes_mellitus": "false",
      "emergency_surgery": "false",
      "fio2_gt_035": "true",
      "hypoalbuminemia": "false",
      "lung_contusion": "false",
      "multiple_fractures": "false",
      "near_drowning": "false",
      "obesity_bmi_gt_30": "false",
      "orthopedic_spine": "false",
      "pneumonia": "true",
      "sepsis": "true",
      "shock": "true",
      "smoke_inhalation": "false",
      "spo2_lt_95": "false",
      "tachypnea_rr_gt_30": "false",
      "traumatic_brain_injury": "false"
    },
    {
      "acidosis_ph_lt_735": "false",
      "acute_abdomen": "false",
      "alcohol_abuse": "true",
      "aortic_vascular": "false",
      "aspiration": "false",
      "cardiac": "false",
      "chemotherapy": "false",
      "diabetes_mellitus": "false",
      "emergency_surgery": "false",
      "fio2_gt_035": "true",
      "hypoalbuminemia": "false",
      "lung_contusion": "false",
      "multiple_fractures": "false",
      "near_drowning": "false",
      "obesity_bmi_gt_30": "false",
      "orthopedic_spine": "false",
      "pneumonia": "true",
      "sepsis": "true",
      "shock": "true",
      "smoke_inhalation": "false",
      "spo2_lt_95": "false",
      "tachypnea_rr_gt_30": "false",
      "traumatic_brain_injury": "false"
    }
  ]
}
```

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

Example 200:

```json
{
  "count": 2,
  "path": "/api/calc/lips",
  "items": [
    {
      "components": [
        {
          "factor": "shock",
          "points": 2,
          "present": true
        },
        {
          "factor": "aspiration",
          "points": 0,
          "present": false
        },
        {
          "factor": "sepsis",
          "points": 1,
          "present": true
        },
        {
          "factor": "pneumonia",
          "points": 1.5,
          "present": true
        },
        {
          "factor": "emergency_surgery",
          "points": 0.0,
          "present": false
        },
        {
          "factor": "traumatic_brain_injury",
          "points": 0,
          "present": false
        },
        {
          "factor": "smoke_inhalation",
          "points": 0,
          "present": false
        },
        {
          "factor": "near_drowning",
          "points": 0,
          "present": false
        },
        {
          "factor": "lung_contusion",
          "points": 0.0,
          "present": false
        },
        {
          "factor": "multiple_fractures",
          "points": 0.0,
          "present": false
        },
        {
          "factor": "alcohol_abuse",
          "points": 1,
          "present": true
        },
        {
          "factor": "obesity_bmi_gt_30",
          "points": 0,
          "present": false
        },
        {
          "factor": "hypoalbuminemia",
          "points": 0,
          "present": false
        },
        {
          "factor": "chemotherapy",
          "points": 0,
          "present": false
        },
        {
          "factor": "fio2_gt_035",
          "points": 2,
          "present": true
        },
        {
          "factor": "tachypnea_rr_gt_30",
          "points": 0.0,
          "present": false
        },
        {
          "factor": "spo2_lt_95",
          "points": 0,
          "present": false
        },
        {
          "factor": "acidosis_ph_lt_735",
          "points": 0.0,
          "present": false
        },
        {
          "factor": "orthopedic_spine",
          "points": 0,
          "present": false
        },
        {
          "factor": "acute_abdomen",
          "points": 0,
          "present": false
        },
        {
          "factor": "cardiac",
          "points": 0.0,
          "present": false
        },
        {
          "factor": "aortic_vascular",
          "points": 0.0,
          "present": false
        },
        {
          "factor": "diabetes_mellitus",
          "points": 0,
          "present": false
        }
      ],
      "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": "Gajic O, Dabbagh O, Park PK, Adesanya A, Chang SY, Hou P, Anderson H 3rd, Hoth JJ, Mikkelsen ME, Gentile NT, Gong MN, Talmor D, Bajwa E, Watkins TR, Festic E, Yilmaz M, Liendahl M, Khan NA, Sevransky JE, Malinchoc M; US Critical Illness and Injury Trials Group: Lung Injury Prevention Study Investigators (USCIITG-LIPS)",
        "doi": "10.1164/rccm.201004-0549OC",
        "id": "gajic-2011",
        "pmid": "20802164",
        "source": "Am J Respir Crit Care Med. 2011;183(4):462-470",
        "title": "Early Identification of Patients at Risk of Acute Lung Injury: Evaluation of Lung Injury Prediction Score in a Multicenter Cohort Study"
      },
      "formula": "lips",
      "formula_expression": "LIPS = shock(2) + aspiration(2) + sepsis(1) + pneumonia(1.5) + at most one of orthopedic_spine(1), acute_abdomen(2), cardiac(2.5), aortic_vascular(3.5) + emergency_surgery(1.5) + traumatic_brain_injury(2) + smoke_inhalation(2) + near_drowning(2) + lung_contusion(1.5) + multiple_fractures(1.5) + alcohol_abuse(1) + obesity_bmi_gt_30(1) + hypoalbuminemia(1) + chemotherapy(1) + fio2_gt_035(2) + tachypnea_rr_gt_30(1.5) + spo2_lt_95(1) + acidosis_ph_lt_735(1.5) + diabetes_mellitus(-1 only if sepsis); Gajic 2011 Table 3; published observed range 0-15.5; low <4, high >=4",
      "max_score": 15.5,
      "score": 7.5,
      "lips_band": "high"
    },
    {
      "components": [
        {
          "factor": "shock",
          "points": 2,
          "present": true
        },
        {
          "factor": "aspiration",
          "points": 0,
          "present": false
        },
        {
          "factor": "sepsis",
          "points": 1,
          "present": true
        },
        {
          "factor": "pneumonia",
          "points": 1.5,
          "present": true
        },
        {
          "factor": "emergency_surgery",
          "points": 0.0,
          "present": false
        },
        {
          "factor": "traumatic_brain_injury",
          "points": 0,
          "present": false
        },
        {
          "factor": "smoke_inhalation",
          "points": 0,
          "present": false
        },
        {
          "factor": "near_drowning",
          "points": 0,
          "present": false
        },
        {
          "factor": "lung_contusion",
          "points": 0.0,
          "present": false
        },
        {
          "factor": "multiple_fractures",
          "points": 0.0,
          "present": false
        },
        {
          "factor": "alcohol_abuse",
          "points": 1,
          "present": true
        },
        {
          "factor": "obesity_bmi_gt_30",
          "points": 0,
          "present": false
        },
        {
          "factor": "hypoalbuminemia",
          "points": 0,
          "present": false
        },
        {
          "factor": "chemotherapy",
          "points": 0,
          "present": false
        },
        {
          "factor": "fio2_gt_035",
          "points": 2,
          "present": true
        },
        {
          "factor": "tachypnea_rr_gt_30",
          "points": 0.0,
          "present": false
        },
        {
          "factor": "spo2_lt_95",
          "points": 0,
          "present": false
        },
        {
          "factor": "acidosis_ph_lt_735",
          "points": 0.0,
          "present": false
        },
        {
          "factor": "orthopedic_spine",
          "points": 0,
          "present": false
        },
        {
          "factor": "acute_abdomen",
          "points": 0,
          "present": false
        },
        {
          "factor": "cardiac",
          "points": 0.0,
          "present": false
        },
        {
          "factor": "aortic_vascular",
          "points": 0.0,
          "present": false
        },
        {
          "factor": "diabetes_mellitus",
          "points": 0,
          "present": false
        }
      ],
      "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": "Gajic O, Dabbagh O, Park PK, Adesanya A, Chang SY, Hou P, Anderson H 3rd, Hoth JJ, Mikkelsen ME, Gentile NT, Gong MN, Talmor D, Bajwa E, Watkins TR, Festic E, Yilmaz M, Liendahl M, Khan NA, Sevransky JE, Malinchoc M; US Critical Illness and Injury Trials Group: Lung Injury Prevention Study Investigators (USCIITG-LIPS)",
        "doi": "10.1164/rccm.201004-0549OC",
        "id": "gajic-2011",
        "pmid": "20802164",
        "source": "Am J Respir Crit Care Med. 2011;183(4):462-470",
        "title": "Early Identification of Patients at Risk of Acute Lung Injury: Evaluation of Lung Injury Prediction Score in a Multicenter Cohort Study"
      },
      "formula": "lips",
      "formula_expression": "LIPS = shock(2) + aspiration(2) + sepsis(1) + pneumonia(1.5) + at most one of orthopedic_spine(1), acute_abdomen(2), cardiac(2.5), aortic_vascular(3.5) + emergency_surgery(1.5) + traumatic_brain_injury(2) + smoke_inhalation(2) + near_drowning(2) + lung_contusion(1.5) + multiple_fractures(1.5) + alcohol_abuse(1) + obesity_bmi_gt_30(1) + hypoalbuminemia(1) + chemotherapy(1) + fio2_gt_035(2) + tachypnea_rr_gt_30(1.5) + spo2_lt_95(1) + acidosis_ph_lt_735(1.5) + diabetes_mellitus(-1 only if sepsis); Gajic 2011 Table 3; published observed range 0-15.5; low <4, high >=4",
      "max_score": 15.5,
      "score": 7.5,
      "lips_band": "high"
    }
  ]
}
```

## Response fields

- `formula` (string): lips
- `formula_expression` (string): Exact expression used
- `score` (number): LIPS points as a number (0.0, 1.5, 7.5, …). Half-points are allowed.
- `max_score` (number): 15.5 is the Gajic 2011 published observed upper range, not a sum of every Table 3 row.
- `lips_band` (string): Gajic 2011 ROC cutoff: low when score <4, high when score >=4. Not an ARDS diagnosis. No other cut-points.
- `components` (array): Per-factor points
- `citation` (object): Gajic et al. AJRCCM 2011 citation
- `disclaimer` (string): Not-a-device notice

## Example JSON

Frozen fixture. Not a live lookup.

```json
{
  "components": [
    {
      "factor": "shock",
      "points": 2,
      "present": true
    },
    {
      "factor": "aspiration",
      "points": 0,
      "present": false
    },
    {
      "factor": "sepsis",
      "points": 1,
      "present": true
    },
    {
      "factor": "pneumonia",
      "points": 1.5,
      "present": true
    },
    {
      "factor": "emergency_surgery",
      "points": 0.0,
      "present": false
    },
    {
      "factor": "traumatic_brain_injury",
      "points": 0,
      "present": false
    },
    {
      "factor": "smoke_inhalation",
      "points": 0,
      "present": false
    },
    {
      "factor": "near_drowning",
      "points": 0,
      "present": false
    },
    {
      "factor": "lung_contusion",
      "points": 0.0,
      "present": false
    },
    {
      "factor": "multiple_fractures",
      "points": 0.0,
      "present": false
    },
    {
      "factor": "alcohol_abuse",
      "points": 1,
      "present": true
    },
    {
      "factor": "obesity_bmi_gt_30",
      "points": 0,
      "present": false
    },
    {
      "factor": "hypoalbuminemia",
      "points": 0,
      "present": false
    },
    {
      "factor": "chemotherapy",
      "points": 0,
      "present": false
    },
    {
      "factor": "fio2_gt_035",
      "points": 2,
      "present": true
    },
    {
      "factor": "tachypnea_rr_gt_30",
      "points": 0.0,
      "present": false
    },
    {
      "factor": "spo2_lt_95",
      "points": 0,
      "present": false
    },
    {
      "factor": "acidosis_ph_lt_735",
      "points": 0.0,
      "present": false
    },
    {
      "factor": "orthopedic_spine",
      "points": 0,
      "present": false
    },
    {
      "factor": "acute_abdomen",
      "points": 0,
      "present": false
    },
    {
      "factor": "cardiac",
      "points": 0.0,
      "present": false
    },
    {
      "factor": "aortic_vascular",
      "points": 0.0,
      "present": false
    },
    {
      "factor": "diabetes_mellitus",
      "points": 0,
      "present": false
    }
  ],
  "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": "Gajic O, Dabbagh O, Park PK, Adesanya A, Chang SY, Hou P, Anderson H 3rd, Hoth JJ, Mikkelsen ME, Gentile NT, Gong MN, Talmor D, Bajwa E, Watkins TR, Festic E, Yilmaz M, Liendahl M, Khan NA, Sevransky JE, Malinchoc M; US Critical Illness and Injury Trials Group: Lung Injury Prevention Study Investigators (USCIITG-LIPS)",
    "doi": "10.1164/rccm.201004-0549OC",
    "id": "gajic-2011",
    "pmid": "20802164",
    "source": "Am J Respir Crit Care Med. 2011;183(4):462-470",
    "title": "Early Identification of Patients at Risk of Acute Lung Injury: Evaluation of Lung Injury Prediction Score in a Multicenter Cohort Study"
  },
  "formula": "lips",
  "formula_expression": "LIPS = shock(2) + aspiration(2) + sepsis(1) + pneumonia(1.5) + at most one of orthopedic_spine(1), acute_abdomen(2), cardiac(2.5), aortic_vascular(3.5) + emergency_surgery(1.5) + traumatic_brain_injury(2) + smoke_inhalation(2) + near_drowning(2) + lung_contusion(1.5) + multiple_fractures(1.5) + alcohol_abuse(1) + obesity_bmi_gt_30(1) + hypoalbuminemia(1) + chemotherapy(1) + fio2_gt_035(2) + tachypnea_rr_gt_30(1.5) + spo2_lt_95(1) + acidosis_ph_lt_735(1.5) + diabetes_mellitus(-1 only if sepsis); Gajic 2011 Table 3; published observed range 0-15.5; low <4, high >=4",
  "max_score": 15.5,
  "score": 7.5,
  "lips_band": "high"
}
```

## Errors

- HTTP 400 `invalid_flag`: boolean clinical flags must be true or false Returned before settlement; you are not charged.
- HTTP 400 `invalid_lips_surgery`: at most one high-risk surgery type may be true: orthopedic_spine, acute_abdomen, cardiac, or aortic_vascular (Gajic 2011 Table 3). 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

- [Berlin Definition of ARDS](https://magentlab.com/docs/berlin-ards) — Apply the 2012 Berlin Definition of ARDS and return whether the clinical box holds, severity (none, mild, moderate, or severe), and berlin_ards.
- [Murray lung injury score](https://magentlab.com/docs/murray) — Mean the four Murray 1988 lung injury score components (chest radiograph quadrants, PaO2/FiO2, PEEP, and compliance), each 0–4, and return LIS and injury_band.
- [PaO2/FiO2 ratio](https://magentlab.com/docs/pf-ratio) — Compute the PaO2/FiO2 ratio as arterial PO2 in mm Hg divided by inspired oxygen fraction.

## 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.
