# Revised original AIH score (IAIHG 1999)

Original AIH score

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

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

## What it computes

Sum the Alvarez 1999 revised original IAIHG autoimmune-hepatitis score from caller-assigned sex, ALP:AST or ALP:ALT ratio, globulin/IgG, ANA/SMA/LKM titer, AMA, viral markers, drugs, alcohol, additive histology, other autoimmune disease, and optional HLA/other autoantibodies and treatment response, and return pretreatment or posttreatment definite, probable, or not_aih.

## When to use

When an agent already has Alvarez 1999 table items assigned and needs the published total and pre/post bands, not an autoimmune-hepatitis diagnosis and not the Hennes 2008 simplified score.

## When not to use

- Not a medical device and not an autoimmune-hepatitis diagnosis, biopsy order, or immunosuppression order. magent does not examine the patient.
- This is the Alvarez 1999 revised original IAIHG score, not the Hennes 2008 simplified AIH criteria.
- magent does not titer autoantibodies, assay globulin/IgG vs ULN, or read liver histology. All items are caller-assigned. Optional HLA and other autoantibodies score only when ANA/SMA/LKM are seronegative (titer lt_1_40), as published.
- This API does not collect names, MRNs, or dates of birth.

## Formula

```
revised original IAIHG AIH (Alvarez 1999) = sex (male 0, female 2) + alp_ratio (lt_1_5 2, 1_5_to_3 0, gt_3 -2) + globulin_igg (lt_1x 0, 1_to_1_5x 1, 1_5_to_2x 2, gt_2x 3) + autoantibody_titer (lt_1_40 0, 1_40 1, 1_80 2, gt_1_80 3) + ama_positive (true -4) + viral_markers (positive -3, negative 3) + hepatotoxic_drugs (true -4, false 1) + alcohol (lt_25 2, 25_to_60 0, gt_60 -2) + histology (interface 3, lymphoplasmacytic 1, rosettes 1, none of those -5, biliary -3, other atypical -3; additive) + other_autoimmune_disease (true 2) + other_autoantibodies (true 2 if titer lt_1_40) + hla_dr3_or_dr4 (true 1 if titer lt_1_40) + treatment_response (complete 2, relapse 3); max 26; pretreatment definite >15, probable 10-15; posttreatment definite >17, probable 12-17
```

## Citation

[International Autoimmune Hepatitis Group Report: review of criteria for diagnosis of autoimmune hepatitis](https://doi.org/10.1016/s0168-8278(99)80297-9)
Alvarez F, Berg PA, Bianchi FB, et al.
J Hepatol. 1999;31(5):929-938
DOI: [10.1016/s0168-8278(99)80297-9](https://doi.org/10.1016/s0168-8278(99)80297-9)

## Worked example

### Lowest tabulated penalties (male, cholestatic ratio, AMA, viral, drugs, alcohol, no typical histology, biliary and other atypical)

Given: `alcohol_intake=gt_60, alp_ratio=gt_3, ama_positive=true, autoantibody_titer=lt_1_40, biliary_changes=true, globulin_igg=lt_1x, hepatotoxic_drugs=true, interface_hepatitis=false, liver_cell_rosettes=false, lymphoplasmacytic_infiltrate=false, other_atypical_histology=true, other_autoimmune_disease=false, sex=male, viral_markers_positive=true`

1. male 0; alp_ratio gt_3 -2; globulin lt_1x 0; titer lt_1_40 0; AMA -4; viral -3; drugs -4; alcohol gt_60 -2
2. no interface/plasma/rosettes -5; biliary -3; other atypical -3; other autoimmune 0
3. Score = -26 (max 26); timing = pretreatment; aih_band = not_aih


### Pretreatment definite (female, hepatitic ratio, high IgG and titer, negative viral/AMA/drugs, typical histology, other autoimmune disease)

Given: `alcohol_intake=lt_25, alp_ratio=lt_1_5, ama_positive=false, autoantibody_titer=gt_1_80, biliary_changes=false, globulin_igg=gt_2x, hepatotoxic_drugs=false, interface_hepatitis=true, liver_cell_rosettes=true, lymphoplasmacytic_infiltrate=true, other_atypical_histology=false, other_autoimmune_disease=true, sex=female, viral_markers_positive=false`

1. female 2; alp_ratio lt_1_5 2; globulin gt_2x 3; titer gt_1_80 3; AMA 0; viral 3; drugs 1; alcohol lt_25 2
2. interface 3; lymphoplasmacytic 1; rosettes 1; other autoimmune 2
3. Score = 23 (max 26); timing = pretreatment; aih_band = definite (>15)


## Also searched as

- original IAIHG score
- revised original AIH score
- Alvarez 1999 AIH
- IAHG 1999 score
- autoimmune hepatitis original score
- revised IAIHG criteria
- 1999 AIH diagnostic score
- original autoimmune hepatitis score

## Parameters

- `sex` (string, required): Caller-assigned sex (Alvarez 1999). female scores 2; male scores 0. magent does not examine the patient.
- `alp_ratio` (string, required): Caller-assigned ALP:(AST or ALT) ratio as multiples of ULN (Alvarez 1999 note 1). lt_1_5 (<1.5) scores 2; 1_5_to_3 (1.5–3.0) scores 0; gt_3 (>3) scores -2. magent does not take raw enzymes.
- `globulin_igg` (string, required): Caller-assigned serum globulin or IgG as multiples of ULN (Alvarez 1999). lt_1x scores 0; 1_to_1_5x scores 1; 1_5_to_2x scores 2; gt_2x scores 3. magent does not assay globulin or IgG.
- `autoantibody_titer` (string, required): Caller-assigned highest ANA, SMA, or LKM-1 immunofluorescence titer (Alvarez 1999). lt_1_40 scores 0; 1_40 scores 1; 1_80 scores 2; gt_1_80 scores 3. magent does not titer autoantibodies.
- `ama_positive` (boolean, required): Caller-assigned antimitochondrial antibody. true scores -4; false scores 0 (Alvarez 1999). magent does not assay AMA.
- `viral_markers_positive` (boolean, required): Caller-assigned hepatitis A/B/C viral markers (Alvarez 1999 note 3). true scores -3; false (negative) scores 3. magent does not interpret viral serology.
- `hepatotoxic_drugs` (boolean, required): Recent or current known or suspected hepatotoxic drugs (Alvarez 1999 note 4). true scores -4; false scores 1.
- `alcohol_intake` (string, required): Caller-assigned average alcohol intake (Alvarez 1999). lt_25 (<25 g/day) scores 2; 25_to_60 scores 0 (gap between the tabulated <25 and >60 cells); gt_60 (>60 g/day) scores -2.
- `interface_hepatitis` (boolean, required): Caller-assigned interface hepatitis on liver histology. true scores 3 (Alvarez 1999; additive). magent does not read histology.
- `lymphoplasmacytic_infiltrate` (boolean, required): Caller-assigned predominantly lymphoplasmacytic infiltrate. true scores 1 (Alvarez 1999; additive). magent does not read histology.
- `liver_cell_rosettes` (boolean, required): Caller-assigned liver-cell rosettes. true scores 1 (Alvarez 1999; additive). magent does not read histology.
- `biliary_changes` (boolean, required): Caller-assigned biliary changes typical of PBC or PSC (Alvarez 1999 note 5). true scores -3; additive with other histology items. magent does not read histology.
- `other_atypical_histology` (boolean, required): Caller-assigned other prominent histologic features suggesting a different etiology (Alvarez 1999 note 6). true scores -3; additive. magent does not read histology.
- `other_autoimmune_disease` (boolean, required): Any other autoimmune disorder in the patient or first-degree relatives (Alvarez 1999 note 7). true scores 2; false scores 0.
- `other_autoantibodies` (boolean, optional): Optional. Seropositivity for other defined autoantibodies (pANCA, anti-LC1, anti-SLA, anti-ASGPR, anti-LP, anti-sulfatide; Alvarez 1999 note 8). true scores 2 only when autoantibody_titer is lt_1_40; otherwise 0. Omit or false scores 0.
- `hla_dr3_or_dr4` (boolean, optional): Optional. HLA DR3 or DR4 (Alvarez 1999 note 9). true scores 1 only when autoantibody_titer is lt_1_40; otherwise 0. Omit or false scores 0.
- `treatment_response` (string, optional): Optional. Alvarez 1999 response to therapy, added to presentation points. none or omit: pretreatment bands (definite >15, probable 10-15). complete scores 2; relapse scores 3; both use posttreatment bands (definite >17, probable 12-17). Not an immunosuppression 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/aih_original`
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": [
    {
      "alcohol_intake": "gt_60",
      "alp_ratio": "gt_3",
      "ama_positive": "true",
      "autoantibody_titer": "lt_1_40",
      "biliary_changes": "true",
      "globulin_igg": "lt_1x",
      "hepatotoxic_drugs": "true",
      "interface_hepatitis": "false",
      "liver_cell_rosettes": "false",
      "lymphoplasmacytic_infiltrate": "false",
      "other_atypical_histology": "true",
      "other_autoimmune_disease": "false",
      "sex": "male",
      "viral_markers_positive": "true"
    },
    {
      "alcohol_intake": "gt_60",
      "alp_ratio": "gt_3",
      "ama_positive": "true",
      "autoantibody_titer": "lt_1_40",
      "biliary_changes": "true",
      "globulin_igg": "lt_1x",
      "hepatotoxic_drugs": "true",
      "interface_hepatitis": "false",
      "liver_cell_rosettes": "false",
      "lymphoplasmacytic_infiltrate": "false",
      "other_atypical_histology": "true",
      "other_autoimmune_disease": "false",
      "sex": "male",
      "viral_markers_positive": "true"
    }
  ]
}
```

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

Example 200:

```json
{
  "count": 2,
  "path": "/api/calc/aih_original",
  "items": [
    {
      "components": [
        {
          "value": "male",
          "factor": "sex",
          "points": 0,
          "present": false
        },
        {
          "value": "gt_3",
          "factor": "alp_ratio",
          "points": -2,
          "present": true
        },
        {
          "value": "lt_1x",
          "factor": "globulin_igg",
          "points": 0,
          "present": false
        },
        {
          "value": "lt_1_40",
          "factor": "autoantibody_titer",
          "points": 0,
          "present": false
        },
        {
          "factor": "ama_positive",
          "points": -4,
          "present": true
        },
        {
          "value": true,
          "factor": "viral_markers_positive",
          "points": -3,
          "present": true
        },
        {
          "value": true,
          "factor": "hepatotoxic_drugs",
          "points": -4,
          "present": true
        },
        {
          "value": "gt_60",
          "factor": "alcohol_intake",
          "points": -2,
          "present": true
        },
        {
          "factor": "interface_hepatitis",
          "points": 0,
          "present": false
        },
        {
          "factor": "lymphoplasmacytic_infiltrate",
          "points": 0,
          "present": false
        },
        {
          "factor": "liver_cell_rosettes",
          "points": 0,
          "present": false
        },
        {
          "factor": "typical_histology_absent",
          "points": -5,
          "present": true
        },
        {
          "factor": "biliary_changes",
          "points": -3,
          "present": true
        },
        {
          "factor": "other_atypical_histology",
          "points": -3,
          "present": true
        },
        {
          "factor": "other_autoimmune_disease",
          "points": 0,
          "present": false
        },
        {
          "factor": "other_autoantibodies",
          "points": 0,
          "present": false
        },
        {
          "factor": "hla_dr3_or_dr4",
          "points": 0,
          "present": false
        },
        {
          "value": "none",
          "factor": "treatment_response",
          "points": 0,
          "present": false
        }
      ],
      "timing": "pretreatment",
      "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": "Alvarez F, Berg PA, Bianchi FB, et al.",
        "doi": "10.1016/s0168-8278(99)80297-9",
        "id": "alvarez-1999",
        "pmid": "10580593",
        "source": "J Hepatol. 1999;31(5):929-938",
        "title": "International Autoimmune Hepatitis Group Report: review of criteria for diagnosis of autoimmune hepatitis"
      },
      "formula": "aih_original",
      "formula_expression": "revised original IAIHG AIH (Alvarez 1999) = sex (male 0, female 2) + alp_ratio (lt_1_5 2, 1_5_to_3 0, gt_3 -2) + globulin_igg (lt_1x 0, 1_to_1_5x 1, 1_5_to_2x 2, gt_2x 3) + autoantibody_titer (lt_1_40 0, 1_40 1, 1_80 2, gt_1_80 3) + ama_positive (true -4) + viral_markers (positive -3, negative 3) + hepatotoxic_drugs (true -4, false 1) + alcohol (lt_25 2, 25_to_60 0, gt_60 -2) + histology (interface 3, lymphoplasmacytic 1, rosettes 1, none of those -5, biliary -3, other atypical -3; additive) + other_autoimmune_disease (true 2) + other_autoantibodies (true 2 if titer lt_1_40) + hla_dr3_or_dr4 (true 1 if titer lt_1_40) + treatment_response (complete 2, relapse 3); max 26; pretreatment definite >15, probable 10-15; posttreatment definite >17, probable 12-17",
      "max_score": 26,
      "score": -26,
      "aih_band": "not_aih"
    },
    {
      "components": [
        {
          "value": "male",
          "factor": "sex",
          "points": 0,
          "present": false
        },
        {
          "value": "gt_3",
          "factor": "alp_ratio",
          "points": -2,
          "present": true
        },
        {
          "value": "lt_1x",
          "factor": "globulin_igg",
          "points": 0,
          "present": false
        },
        {
          "value": "lt_1_40",
          "factor": "autoantibody_titer",
          "points": 0,
          "present": false
        },
        {
          "factor": "ama_positive",
          "points": -4,
          "present": true
        },
        {
          "value": true,
          "factor": "viral_markers_positive",
          "points": -3,
          "present": true
        },
        {
          "value": true,
          "factor": "hepatotoxic_drugs",
          "points": -4,
          "present": true
        },
        {
          "value": "gt_60",
          "factor": "alcohol_intake",
          "points": -2,
          "present": true
        },
        {
          "factor": "interface_hepatitis",
          "points": 0,
          "present": false
        },
        {
          "factor": "lymphoplasmacytic_infiltrate",
          "points": 0,
          "present": false
        },
        {
          "factor": "liver_cell_rosettes",
          "points": 0,
          "present": false
        },
        {
          "factor": "typical_histology_absent",
          "points": -5,
          "present": true
        },
        {
          "factor": "biliary_changes",
          "points": -3,
          "present": true
        },
        {
          "factor": "other_atypical_histology",
          "points": -3,
          "present": true
        },
        {
          "factor": "other_autoimmune_disease",
          "points": 0,
          "present": false
        },
        {
          "factor": "other_autoantibodies",
          "points": 0,
          "present": false
        },
        {
          "factor": "hla_dr3_or_dr4",
          "points": 0,
          "present": false
        },
        {
          "value": "none",
          "factor": "treatment_response",
          "points": 0,
          "present": false
        }
      ],
      "timing": "pretreatment",
      "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": "Alvarez F, Berg PA, Bianchi FB, et al.",
        "doi": "10.1016/s0168-8278(99)80297-9",
        "id": "alvarez-1999",
        "pmid": "10580593",
        "source": "J Hepatol. 1999;31(5):929-938",
        "title": "International Autoimmune Hepatitis Group Report: review of criteria for diagnosis of autoimmune hepatitis"
      },
      "formula": "aih_original",
      "formula_expression": "revised original IAIHG AIH (Alvarez 1999) = sex (male 0, female 2) + alp_ratio (lt_1_5 2, 1_5_to_3 0, gt_3 -2) + globulin_igg (lt_1x 0, 1_to_1_5x 1, 1_5_to_2x 2, gt_2x 3) + autoantibody_titer (lt_1_40 0, 1_40 1, 1_80 2, gt_1_80 3) + ama_positive (true -4) + viral_markers (positive -3, negative 3) + hepatotoxic_drugs (true -4, false 1) + alcohol (lt_25 2, 25_to_60 0, gt_60 -2) + histology (interface 3, lymphoplasmacytic 1, rosettes 1, none of those -5, biliary -3, other atypical -3; additive) + other_autoimmune_disease (true 2) + other_autoantibodies (true 2 if titer lt_1_40) + hla_dr3_or_dr4 (true 1 if titer lt_1_40) + treatment_response (complete 2, relapse 3); max 26; pretreatment definite >15, probable 10-15; posttreatment definite >17, probable 12-17",
      "max_score": 26,
      "score": -26,
      "aih_band": "not_aih"
    }
  ]
}
```

## Response fields

- `formula` (string): aih_original
- `formula_expression` (string): Exact expression used
- `score` (integer): Alvarez 1999 revised original IAIHG integer sum (can be negative); max 26
- `max_score` (integer): 26 including optional relapse
- `aih_band` (string): definite, probable, or not_aih. Pretreatment: definite >15, probable 10-15. Posttreatment: definite >17, probable 12-17 (Alvarez 1999). Not a diagnosis. Not Hennes 2008 simplified AIH.
- `timing` (string): pretreatment when treatment_response is none or omitted; posttreatment when complete or relapse
- `components` (array): Per-factor points
- `citation` (object): Alvarez 1999 J Hepatol citation
- `disclaimer` (string): Not-a-device notice

## Example JSON

Frozen fixture. Not a live lookup.

```json
{
  "components": [
    {
      "value": "male",
      "factor": "sex",
      "points": 0,
      "present": false
    },
    {
      "value": "gt_3",
      "factor": "alp_ratio",
      "points": -2,
      "present": true
    },
    {
      "value": "lt_1x",
      "factor": "globulin_igg",
      "points": 0,
      "present": false
    },
    {
      "value": "lt_1_40",
      "factor": "autoantibody_titer",
      "points": 0,
      "present": false
    },
    {
      "factor": "ama_positive",
      "points": -4,
      "present": true
    },
    {
      "value": true,
      "factor": "viral_markers_positive",
      "points": -3,
      "present": true
    },
    {
      "value": true,
      "factor": "hepatotoxic_drugs",
      "points": -4,
      "present": true
    },
    {
      "value": "gt_60",
      "factor": "alcohol_intake",
      "points": -2,
      "present": true
    },
    {
      "factor": "interface_hepatitis",
      "points": 0,
      "present": false
    },
    {
      "factor": "lymphoplasmacytic_infiltrate",
      "points": 0,
      "present": false
    },
    {
      "factor": "liver_cell_rosettes",
      "points": 0,
      "present": false
    },
    {
      "factor": "typical_histology_absent",
      "points": -5,
      "present": true
    },
    {
      "factor": "biliary_changes",
      "points": -3,
      "present": true
    },
    {
      "factor": "other_atypical_histology",
      "points": -3,
      "present": true
    },
    {
      "factor": "other_autoimmune_disease",
      "points": 0,
      "present": false
    },
    {
      "factor": "other_autoantibodies",
      "points": 0,
      "present": false
    },
    {
      "factor": "hla_dr3_or_dr4",
      "points": 0,
      "present": false
    },
    {
      "value": "none",
      "factor": "treatment_response",
      "points": 0,
      "present": false
    }
  ],
  "timing": "pretreatment",
  "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": "Alvarez F, Berg PA, Bianchi FB, et al.",
    "doi": "10.1016/s0168-8278(99)80297-9",
    "id": "alvarez-1999",
    "pmid": "10580593",
    "source": "J Hepatol. 1999;31(5):929-938",
    "title": "International Autoimmune Hepatitis Group Report: review of criteria for diagnosis of autoimmune hepatitis"
  },
  "formula": "aih_original",
  "formula_expression": "revised original IAIHG AIH (Alvarez 1999) = sex (male 0, female 2) + alp_ratio (lt_1_5 2, 1_5_to_3 0, gt_3 -2) + globulin_igg (lt_1x 0, 1_to_1_5x 1, 1_5_to_2x 2, gt_2x 3) + autoantibody_titer (lt_1_40 0, 1_40 1, 1_80 2, gt_1_80 3) + ama_positive (true -4) + viral_markers (positive -3, negative 3) + hepatotoxic_drugs (true -4, false 1) + alcohol (lt_25 2, 25_to_60 0, gt_60 -2) + histology (interface 3, lymphoplasmacytic 1, rosettes 1, none of those -5, biliary -3, other atypical -3; additive) + other_autoimmune_disease (true 2) + other_autoantibodies (true 2 if titer lt_1_40) + hla_dr3_or_dr4 (true 1 if titer lt_1_40) + treatment_response (complete 2, relapse 3); max 26; pretreatment definite >15, probable 10-15; posttreatment definite >17, probable 12-17",
  "max_score": 26,
  "score": -26,
  "aih_band": "not_aih"
}
```

## Errors

- HTTP 400 `invalid_aih_original`: Revised original AIH score inputs must match Alvarez 1999 International Autoimmune Hepatitis Group criteria from that paper. 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

- [Simplified AIH](https://magentlab.com/docs/simplified-aih) — Sum the Hennes 2008 simplified autoimmune-hepatitis criteria (Table 2) from caller-assigned autoantibody, IgG, histology, and viral-hepatitis points and return not_aih (<6), probable (6), or definite (≥7).
- [R factor](https://magentlab.com/docs/r-factor) — Compute the Bénichou 1990 / CIOMS R ratio from ALT, ALP, and their laboratory upper limits of normal, then classify hepatocellular (R ≥ 5), cholestatic (R ≤ 2), or mixed (2 < R < 5).
- [King's College criteria](https://magentlab.com/docs/kings-college) — Apply the O'Grady 1989 King's College poor-prognosis criteria for fulminant hepatic failure, with separate acetaminophen and non-acetaminophen trees using prothrombin time in seconds.

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