# TG18 acute cholangitis

Tokyo cholangitis

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

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

## What it computes

Apply Kiriyama 2018 Tokyo Guidelines 2018 diagnostic criteria and severity grading of acute cholangitis (unchanged from TG13) and return diagnosis (definite, suspected, or none) and severity (grade_i, grade_ii, grade_iii, or none) from caller-assigned flags and age.

## When to use

When an agent already has caller-assigned systemic inflammation, cholestasis, imaging, organ-dysfunction, and Grade II flags plus age and needs the published TG18 (=TG13) cholangitis classification. magent does not examine the patient, assay labs, or read imaging. Not TG18 cholecystitis. Not Alvarado or RIPASA.

## When not to use

- Not a medical device and not a diagnosis of acute cholangitis that replaces imaging or laboratory review.
- TG18 diagnostic criteria and severity grading of acute cholangitis are unchanged from TG13 (Kiriyama 2018).
- This tool is acute cholangitis only. It is not TG18 acute cholecystitis and not Alvarado or RIPASA (appendicitis scores).
- magent does not examine the patient, assay labs, or read imaging. The caller assigns every flag, including whether albumin is <0.7× the local lower limit of normal.
- Not a biliary-drainage order. Severity is none when diagnosis is none. Grade III beats Grade II. Grade II requires any two items, not any one (that any-one rule is TG18 cholecystitis).

## Formula

```
definite iff one A (fever_or_chills or elevated_wbc_or_crp) and one B (jaundice or abnormal_lfts) and one C (biliary_dilatation or etiology_on_imaging); suspected iff one A and one item in either B or C (not all three); else none. When diagnosis is suspected or definite: grade_iii if any organ-dysfunction flag (hypotension_vasopressors, decreased_consciousness, pfr_lt_300, oliguria_or_creatinine_gt_2, pt_inr_gt_1_5, platelets_lt_100k), else grade_ii if any two Grade II items (wbc_gt_12k_or_lt_4k, fever_ge_39, age>=75, bilirubin_ge_5, hypoalbuminemia), else grade_i. When diagnosis is none, severity is none (Kiriyama 2018 TG18 = TG13 unmodified)
```

## Citation

[Tokyo Guidelines 2018: diagnostic criteria and severity grading of acute cholangitis (with videos).](https://doi.org/10.1002/jhbp.512)
Kiriyama S, Kozaka K, Takada T, et al.
J Hepatobiliary Pancreat Sci. 2018;25(1):17-30
DOI: [10.1002/jhbp.512](https://doi.org/10.1002/jhbp.512)

## Worked example

### No systemic, cholestasis, or imaging findings

Given: `abnormal_lfts=false, age=60, biliary_dilatation=false, bilirubin_ge_5=false, decreased_consciousness=false, elevated_wbc_or_crp=false, etiology_on_imaging=false, fever_ge_39=false, fever_or_chills=false, hypoalbuminemia=false, hypotension_vasopressors=false, jaundice=false, oliguria_or_creatinine_gt_2=false, pfr_lt_300=false, platelets_lt_100k=false, pt_inr_gt_1_5=false, wbc_gt_12k_or_lt_4k=false`

1. systemic_inflammation, cholestasis, and imaging are all false; age is 60
2. diagnosis is none; severity is none (Grade I is not reported without cholangitis)


### Fever/chills and jaundice without imaging is suspected Grade I

Given: `abnormal_lfts=false, age=60, biliary_dilatation=false, bilirubin_ge_5=false, decreased_consciousness=false, elevated_wbc_or_crp=false, etiology_on_imaging=false, fever_ge_39=false, fever_or_chills=true, hypoalbuminemia=false, hypotension_vasopressors=false, jaundice=true, oliguria_or_creatinine_gt_2=false, pfr_lt_300=false, platelets_lt_100k=false, pt_inr_gt_1_5=false, wbc_gt_12k_or_lt_4k=false`

1. one A and one B hold; imaging is false (Kiriyama 2018 suspected = A + either B or C)
2. diagnosis is suspected; fewer than two Grade II items and no Grade III flag, so severity is grade_i


### Fever/chills and biliary dilatation without cholestasis is suspected Grade I

Given: `abnormal_lfts=false, age=60, biliary_dilatation=true, bilirubin_ge_5=false, decreased_consciousness=false, elevated_wbc_or_crp=false, etiology_on_imaging=false, fever_ge_39=false, fever_or_chills=true, hypoalbuminemia=false, hypotension_vasopressors=false, jaundice=false, oliguria_or_creatinine_gt_2=false, pfr_lt_300=false, platelets_lt_100k=false, pt_inr_gt_1_5=false, wbc_gt_12k_or_lt_4k=false`

1. one A and one C hold; cholestasis is false (Kiriyama 2018 suspected = A + either B or C)
2. diagnosis is suspected; fewer than two Grade II items and no Grade III flag, so severity is grade_i


### One Grade II item is still Grade I (not cholecystitis)

Given: `abnormal_lfts=false, age=60, biliary_dilatation=true, bilirubin_ge_5=false, decreased_consciousness=false, elevated_wbc_or_crp=false, etiology_on_imaging=false, fever_ge_39=false, fever_or_chills=true, hypoalbuminemia=false, hypotension_vasopressors=false, jaundice=true, oliguria_or_creatinine_gt_2=false, pfr_lt_300=false, platelets_lt_100k=false, pt_inr_gt_1_5=false, wbc_gt_12k_or_lt_4k=true`

1. one A, one B, and one C hold, so diagnosis is definite
2. exactly one Grade II item is not enough; TG18 cholangitis Grade II needs any two, so severity is grade_i


## Also searched as

- Tokyo Guidelines 2018 cholangitis
- TG18 acute cholangitis
- TG13 cholangitis
- Kiriyama 2018
- acute cholangitis diagnostic criteria
- Tokyo cholangitis severity grade
- TG18 Grade III cholangitis
- TG18 Grade II any two

## Parameters

- `age` (integer, required): Age in years (18-120). Counts as one Kiriyama 2018 TG18 Grade II item when age ≥75. Age 75 meets; age 74 does not. magent does not examine the patient.
- `fever_or_chills` (boolean, required): Fever and/or shaking chills as assigned by the caller (Kiriyama 2018 TG18 A-1). true or false. magent does not measure temperature or examine the patient.
- `elevated_wbc_or_crp` (boolean, required): Laboratory inflammatory response (elevated WBC or CRP) as assigned by the caller (Kiriyama 2018 TG18 A-2). true or false. magent does not assay WBC or CRP.
- `jaundice` (boolean, required): Jaundice as assigned by the caller (Kiriyama 2018 TG18 B-1). true or false. magent does not examine the patient.
- `abnormal_lfts` (boolean, required): Increased ALP, GGT, AST, or ALT as assigned by the caller (Kiriyama 2018 TG18 B-2). true or false. magent does not assay liver tests.
- `biliary_dilatation` (boolean, required): Biliary dilatation as assigned by the caller (Kiriyama 2018 TG18 C-1). true or false. magent does not read imaging.
- `etiology_on_imaging` (boolean, required): Evidence of etiology on imaging (stricture, stone, stent, or equivalent) as assigned by the caller (Kiriyama 2018 TG18 C-2). true or false. magent does not read imaging.
- `hypotension_vasopressors` (boolean, required): Hypotension requiring dopamine ≥5 µg/kg/min or any norepinephrine as assigned by the caller (Kiriyama 2018 TG18 Grade III cardiovascular dysfunction). true or false. magent does not measure blood pressure or order vasopressors.
- `decreased_consciousness` (boolean, required): Decreased level of consciousness as assigned by the caller (Kiriyama 2018 TG18 Grade III neurological dysfunction). true or false. magent does not examine the patient.
- `pfr_lt_300` (boolean, required): PaO2/FiO2 <300 as assigned by the caller (Kiriyama 2018 TG18 Grade III respiratory dysfunction). true or false. magent does not interpret blood gas or ventilator settings.
- `oliguria_or_creatinine_gt_2` (boolean, required): Oliguria or creatinine >2.0 mg/dL as assigned by the caller (Kiriyama 2018 TG18 Grade III renal dysfunction). true or false. magent does not assay creatinine or measure urine output.
- `pt_inr_gt_1_5` (boolean, required): PT-INR >1.5 as assigned by the caller (Kiriyama 2018 TG18 Grade III hepatic dysfunction). true or false. magent does not interpret coagulation assays.
- `platelets_lt_100k` (boolean, required): Platelet count <100,000/mm³ as assigned by the caller (Kiriyama 2018 TG18 Grade III hematological dysfunction). true or false. magent does not assay platelets.
- `wbc_gt_12k_or_lt_4k` (boolean, required): White blood cell count >12,000/mm³ or <4,000/mm³ as assigned by the caller (Kiriyama 2018 TG18 Grade II). true or false. magent does not assay WBC.
- `fever_ge_39` (boolean, required): Fever ≥39°C as assigned by the caller (Kiriyama 2018 TG18 Grade II). true or false. magent does not measure temperature.
- `bilirubin_ge_5` (boolean, required): Total bilirubin ≥5 mg/dL as assigned by the caller (Kiriyama 2018 TG18 Grade II). true or false. magent does not assay bilirubin.
- `hypoalbuminemia` (boolean, required): Albumin <0.7× the local lower limit of normal as assigned by the caller (Kiriyama 2018 TG18 Grade II). true or false. magent does not assay albumin.

## 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/tokyo_cholangitis`
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": [
    {
      "abnormal_lfts": "false",
      "age": "60",
      "biliary_dilatation": "false",
      "bilirubin_ge_5": "false",
      "decreased_consciousness": "false",
      "elevated_wbc_or_crp": "false",
      "etiology_on_imaging": "false",
      "fever_ge_39": "false",
      "fever_or_chills": "false",
      "hypoalbuminemia": "false",
      "hypotension_vasopressors": "false",
      "jaundice": "false",
      "oliguria_or_creatinine_gt_2": "false",
      "pfr_lt_300": "false",
      "platelets_lt_100k": "false",
      "pt_inr_gt_1_5": "false",
      "wbc_gt_12k_or_lt_4k": "false"
    },
    {
      "abnormal_lfts": "false",
      "age": "60",
      "biliary_dilatation": "false",
      "bilirubin_ge_5": "false",
      "decreased_consciousness": "false",
      "elevated_wbc_or_crp": "false",
      "etiology_on_imaging": "false",
      "fever_ge_39": "false",
      "fever_or_chills": "false",
      "hypoalbuminemia": "false",
      "hypotension_vasopressors": "false",
      "jaundice": "false",
      "oliguria_or_creatinine_gt_2": "false",
      "pfr_lt_300": "false",
      "platelets_lt_100k": "false",
      "pt_inr_gt_1_5": "false",
      "wbc_gt_12k_or_lt_4k": "false"
    }
  ]
}
```

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

Example 200:

```json
{
  "count": 2,
  "path": "/api/calc/tokyo_cholangitis",
  "items": [
    {
      "severity": "none",
      "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": "Kiriyama S, Kozaka K, Takada T, et al.",
        "doi": "10.1002/jhbp.512",
        "id": "kiriyama-2018",
        "pmid": "29032610",
        "source": "J Hepatobiliary Pancreat Sci. 2018;25(1):17-30",
        "title": "Tokyo Guidelines 2018: diagnostic criteria and severity grading of acute cholangitis (with videos)."
      },
      "formula": "tokyo_cholangitis",
      "formula_expression": "definite iff one A (fever_or_chills or elevated_wbc_or_crp) and one B (jaundice or abnormal_lfts) and one C (biliary_dilatation or etiology_on_imaging); suspected iff one A and one item in either B or C (not all three); else none. When diagnosis is suspected or definite: grade_iii if any organ-dysfunction flag (hypotension_vasopressors, decreased_consciousness, pfr_lt_300, oliguria_or_creatinine_gt_2, pt_inr_gt_1_5, platelets_lt_100k), else grade_ii if any two Grade II items (wbc_gt_12k_or_lt_4k, fever_ge_39, age>=75, bilirubin_ge_5, hypoalbuminemia), else grade_i. When diagnosis is none, severity is none (Kiriyama 2018 TG18 = TG13 unmodified)",
      "criteria": [
        {
          "factor": "systemic_inflammation",
          "met": false
        },
        {
          "factor": "cholestasis",
          "met": false
        },
        {
          "factor": "imaging",
          "met": false
        },
        {
          "factor": "grade_iii_any",
          "met": false
        },
        {
          "factor": "grade_ii_two",
          "met": false
        },
        {
          "value": 60,
          "factor": "age_ge_75",
          "met": false
        },
        {
          "factor": "fever_or_chills",
          "met": false
        },
        {
          "factor": "elevated_wbc_or_crp",
          "met": false
        },
        {
          "factor": "jaundice",
          "met": false
        },
        {
          "factor": "abnormal_lfts",
          "met": false
        },
        {
          "factor": "biliary_dilatation",
          "met": false
        },
        {
          "factor": "etiology_on_imaging",
          "met": false
        },
        {
          "factor": "hypotension_vasopressors",
          "met": false
        },
        {
          "factor": "decreased_consciousness",
          "met": false
        },
        {
          "factor": "pfr_lt_300",
          "met": false
        },
        {
          "factor": "oliguria_or_creatinine_gt_2",
          "met": false
        },
        {
          "factor": "pt_inr_gt_1_5",
          "met": false
        },
        {
          "factor": "platelets_lt_100k",
          "met": false
        },
        {
          "factor": "wbc_gt_12k_or_lt_4k",
          "met": false
        },
        {
          "factor": "fever_ge_39",
          "met": false
        },
        {
          "factor": "bilirubin_ge_5",
          "met": false
        },
        {
          "factor": "hypoalbuminemia",
          "met": false
        }
      ],
      "diagnosis": "none"
    },
    {
      "severity": "none",
      "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": "Kiriyama S, Kozaka K, Takada T, et al.",
        "doi": "10.1002/jhbp.512",
        "id": "kiriyama-2018",
        "pmid": "29032610",
        "source": "J Hepatobiliary Pancreat Sci. 2018;25(1):17-30",
        "title": "Tokyo Guidelines 2018: diagnostic criteria and severity grading of acute cholangitis (with videos)."
      },
      "formula": "tokyo_cholangitis",
      "formula_expression": "definite iff one A (fever_or_chills or elevated_wbc_or_crp) and one B (jaundice or abnormal_lfts) and one C (biliary_dilatation or etiology_on_imaging); suspected iff one A and one item in either B or C (not all three); else none. When diagnosis is suspected or definite: grade_iii if any organ-dysfunction flag (hypotension_vasopressors, decreased_consciousness, pfr_lt_300, oliguria_or_creatinine_gt_2, pt_inr_gt_1_5, platelets_lt_100k), else grade_ii if any two Grade II items (wbc_gt_12k_or_lt_4k, fever_ge_39, age>=75, bilirubin_ge_5, hypoalbuminemia), else grade_i. When diagnosis is none, severity is none (Kiriyama 2018 TG18 = TG13 unmodified)",
      "criteria": [
        {
          "factor": "systemic_inflammation",
          "met": false
        },
        {
          "factor": "cholestasis",
          "met": false
        },
        {
          "factor": "imaging",
          "met": false
        },
        {
          "factor": "grade_iii_any",
          "met": false
        },
        {
          "factor": "grade_ii_two",
          "met": false
        },
        {
          "value": 60,
          "factor": "age_ge_75",
          "met": false
        },
        {
          "factor": "fever_or_chills",
          "met": false
        },
        {
          "factor": "elevated_wbc_or_crp",
          "met": false
        },
        {
          "factor": "jaundice",
          "met": false
        },
        {
          "factor": "abnormal_lfts",
          "met": false
        },
        {
          "factor": "biliary_dilatation",
          "met": false
        },
        {
          "factor": "etiology_on_imaging",
          "met": false
        },
        {
          "factor": "hypotension_vasopressors",
          "met": false
        },
        {
          "factor": "decreased_consciousness",
          "met": false
        },
        {
          "factor": "pfr_lt_300",
          "met": false
        },
        {
          "factor": "oliguria_or_creatinine_gt_2",
          "met": false
        },
        {
          "factor": "pt_inr_gt_1_5",
          "met": false
        },
        {
          "factor": "platelets_lt_100k",
          "met": false
        },
        {
          "factor": "wbc_gt_12k_or_lt_4k",
          "met": false
        },
        {
          "factor": "fever_ge_39",
          "met": false
        },
        {
          "factor": "bilirubin_ge_5",
          "met": false
        },
        {
          "factor": "hypoalbuminemia",
          "met": false
        }
      ],
      "diagnosis": "none"
    }
  ]
}
```

## Response fields

- `formula` (string): tokyo_cholangitis
- `formula_expression` (string): Kiriyama 2018 TG18 (=TG13) acute cholangitis diagnostic criteria and severity grading
- `diagnosis` (string): definite when one A, one B, and one C all hold; suspected when one A holds with one B or one C (not all three); otherwise none. Not a diagnosis that replaces imaging.
- `severity` (string): none when diagnosis is none; otherwise grade_iii if any organ-dysfunction flag, else grade_ii if any two Grade II items, else grade_i. Grade III beats Grade II. Grade II is any two, not any one. Not a biliary-drainage order.
- `criteria` (array): Rows for systemic_inflammation (A), cholestasis (B), imaging (C), grade_iii_any, grade_ii_two, age_ge_75, then each caller-assigned flag (factor and met)
- `citation` (object): Kiriyama 2018 J Hepatobiliary Pancreat Sci citation
- `disclaimer` (string): Not-a-device notice

## Example JSON

Frozen fixture. Not a live lookup.

```json
{
  "severity": "none",
  "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": "Kiriyama S, Kozaka K, Takada T, et al.",
    "doi": "10.1002/jhbp.512",
    "id": "kiriyama-2018",
    "pmid": "29032610",
    "source": "J Hepatobiliary Pancreat Sci. 2018;25(1):17-30",
    "title": "Tokyo Guidelines 2018: diagnostic criteria and severity grading of acute cholangitis (with videos)."
  },
  "formula": "tokyo_cholangitis",
  "formula_expression": "definite iff one A (fever_or_chills or elevated_wbc_or_crp) and one B (jaundice or abnormal_lfts) and one C (biliary_dilatation or etiology_on_imaging); suspected iff one A and one item in either B or C (not all three); else none. When diagnosis is suspected or definite: grade_iii if any organ-dysfunction flag (hypotension_vasopressors, decreased_consciousness, pfr_lt_300, oliguria_or_creatinine_gt_2, pt_inr_gt_1_5, platelets_lt_100k), else grade_ii if any two Grade II items (wbc_gt_12k_or_lt_4k, fever_ge_39, age>=75, bilirubin_ge_5, hypoalbuminemia), else grade_i. When diagnosis is none, severity is none (Kiriyama 2018 TG18 = TG13 unmodified)",
  "criteria": [
    {
      "factor": "systemic_inflammation",
      "met": false
    },
    {
      "factor": "cholestasis",
      "met": false
    },
    {
      "factor": "imaging",
      "met": false
    },
    {
      "factor": "grade_iii_any",
      "met": false
    },
    {
      "factor": "grade_ii_two",
      "met": false
    },
    {
      "value": 60,
      "factor": "age_ge_75",
      "met": false
    },
    {
      "factor": "fever_or_chills",
      "met": false
    },
    {
      "factor": "elevated_wbc_or_crp",
      "met": false
    },
    {
      "factor": "jaundice",
      "met": false
    },
    {
      "factor": "abnormal_lfts",
      "met": false
    },
    {
      "factor": "biliary_dilatation",
      "met": false
    },
    {
      "factor": "etiology_on_imaging",
      "met": false
    },
    {
      "factor": "hypotension_vasopressors",
      "met": false
    },
    {
      "factor": "decreased_consciousness",
      "met": false
    },
    {
      "factor": "pfr_lt_300",
      "met": false
    },
    {
      "factor": "oliguria_or_creatinine_gt_2",
      "met": false
    },
    {
      "factor": "pt_inr_gt_1_5",
      "met": false
    },
    {
      "factor": "platelets_lt_100k",
      "met": false
    },
    {
      "factor": "wbc_gt_12k_or_lt_4k",
      "met": false
    },
    {
      "factor": "fever_ge_39",
      "met": false
    },
    {
      "factor": "bilirubin_ge_5",
      "met": false
    },
    {
      "factor": "hypoalbuminemia",
      "met": false
    }
  ],
  "diagnosis": "none"
}
```

## Errors

- HTTP 400 `invalid_flag`: boolean clinical flags must be true or false Returned before settlement; you are not charged.
- HTTP 400 `invalid_age`: age must be an integer from 18 to 120 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

- [Tokyo cholecystitis](https://magentlab.com/docs/tokyo-cholecystitis) — Apply Yokoe 2018 Tokyo Guidelines 2018 diagnostic criteria and severity grading of acute cholecystitis (unchanged from TG13) and return diagnosis (definite, suspected, or none) and severity (grade_i, grade_ii, grade_iii, or none) from caller-assigned flags.
- [Alvarado score](https://magentlab.com/docs/alvarado) — Compute the Alvarado 1986 MANTRELS score from caller-assigned findings, temperature, WBC, and neutrophil percent.

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