Calc Apache Ii
by magent in Security & trust
Knaus 1985 APACHE II integer: 12 Acute Physiology Score items (worst in 24 hours as assigned by the caller) plus age and chronic-health points, max 71. Oxygenation uses A-aDO2 when FiO2 is at least 0.5 and PaO2 when FiO2 is below 0.5. Creatinine points double in acute renal failure. Does not compute predicted death risk. magent does not measure vitals.
https://api.magentlab.com/api/calc/apache_ii- Price
- $0.007
- per call in USDC
- Uptime
- 88.9%
- last 30 days
- Response time
- 256 ms
- 1.1 s slowest 5%
- Last check
- Failed
- 44 min ago, next in 20 min
Reliability
Latest check failed 44 min ago: Timed out
Status and outage history · Atom feed · Watch with other listings
How to call it
POST https://api.magentlab.com/api/calc/apache_ii
Each call costs $0.007 in USDC on Base, paid with the request over x402.
Run a free test callOne unpaid request, the way an agent sends it. You see the payment challenge it gets back. Nothing is charged.
Example request
From the listing.
POST https://api.magentlab.com/api/calc/apache_ii
content-type: application/json
{
"items": [
{
"aa_gradient": 100,
"acute_renal_failure": false,
"age": 40,
"arterial_ph": 7.4,
"chronic_health": false,
"creatinine_mg_dl": 1,
"elective_postop": false,
"fio2": 0.21,
"gcs": 15,
"heart_rate": 80,
"hematocrit_percent": 40,
"map_mm_hg": 90,
"pao2_mm_hg": 90,
"potassium_mmol_l": 4,
"respiratory_rate": 16,
"sodium_mmol_l": 140,
"temperature_c": 37,
"wbc_k_ul": 8
},
{
"aa_gradient": 100,
"acute_renal_failure": false,
"age": 40,
"arterial_ph": 7.4,
"chronic_health": false,
"creatinine_mg_dl": 1,
"elective_postop": false,
"fio2": 0.21,
"gcs": 15,
"heart_rate": 80,
"hematocrit_percent": 40,
"map_mm_hg": 90,
"pao2_mm_hg": 90,
"potassium_mmol_l": 4,
"respiratory_rate": 16,
"sodium_mmol_l": 140,
"temperature_c": 37,
"wbc_k_ul": 8
}
]
}Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
items | array of object | Yes |
Example response
The provider's example. We can't check it without paying.
Example response, 216 lines
{
"count": 2,
"items": [
{
"citation": {
"authors": "Knaus WA, Draper EA, Wagner DP, Zimmerman JE",
"doi": "10.1097/00003246-198510000-00009",
"id": "knaus-1985",
"pmid": "3928249",
"source": "Crit Care Med. 1985;13(10):818-829",
"title": "APACHE II: a severity of disease classification system"
},
"components": [
{
"factor": "temperature_c",
"points": 0,
"present": false,
"value": 37
},
{
"factor": "map_mm_hg",
"points": 0,
"present": false,
"value": 90
},
{
"factor": "heart_rate",
"points": 0,
"present": false,
"value": 80
},
{
"factor": "respiratory_rate",
"points": 0,
"present": false,
"value": 16
},
{
"branch": "pao2_mm_hg",
"factor": "oxygenation",
"fio2": 0.21,
"points": 0,
"present": false,
"value": 90
},
{
"factor": "arterial_ph",
"points": 0,
"present": false,
"value": 7.4
},
{
"factor": "sodium_mmol_l",
"points": 0,
"present": false,
"value": 140
},
{
"factor": "potassium_mmol_l",
"points": 0,
"present": false,
"value": 4
},
{
"acute_renal_failure": false,
"factor": "creatinine_mg_dl",
"points": 0,
"present": false,
"value": 1
},
{
"factor": "hematocrit_percent",
"points": 0,
"present": false,
"value": 40
},
{
"factor": "wbc_k_ul",
"points": 0,
"present": false,
"value": 8
},
{
"factor": "gcs",
"points": 0,
"present": false,
"value": 15
},
{
"factor": "age",
"points": 0,
"present": false,
"value": 40
},
{
"chronic_health": false,
"elective_postop": false,
"factor": "chronic_health",
"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.",
"formula": "apache_ii",
"formula_expression": "APACHE II = APS + age_points + chronic_health_points; APS is the sum of 12 Knaus 1985 Table 1 items (worst values in 24h as assigned by the caller): temperature_c, map_mm_hg, heart_rate, respiratory_rate, oxygenation (A-aDO2 if fio2 >= 0.5, PaO2 if fio2 < 0.5), arterial_ph, sodium_mmol_l, potassium_mmol_l, creatinine_mg_dl (doubled if acute_renal_failure), hematocrit_percent, wbc_k_ul, and 15-gcs; age <=44 → 0, 45-54 → 2, 55-64 → 3, 65-74 → 5, >=75 → 6; chronic health 0 if none, else +5 nonoperative or emergency postoperative or +2 elective postoperative; max 71",
"max_score": 71,
"score": 0
},
{
"citation": {
"authors": "Knaus WA, Draper EA, Wagner DP, Zimmerman JE",
"doi": "10.1097/00003246-198510000-00009",
"id": "knaus-1985",
"pmid": "3928249",
"source": "Crit Care Med. 1985;13(10):818-829",
"title": "APACHE II: a severity of disease classification system"
},
"components": [
{
"factor": "temperature_c",
"points": 0,
"present": false,
"value": 37
},
{
"factor": "map_mm_hg",
"points": 0,
"present": false,
"value": 90
},
{
"factor": "heart_rate",
"points": 0,
"present": false,
"value": 80
},
{
"factor": "respiratory_rate",
"points": 0,
"present": false,
"value": 16
},
{
"branch": "pao2_mm_hg",
"factor": "oxygenation",
"fio2": 0.21,
"points": 0,
"present": false,
"value": 90
},
{
"factor": "arterial_ph",
"points": 0,
"present": false,
"value": 7.4
},
{
"factor": "sodium_mmol_l",
"points": 0,
"present": false,
"value": 140
},
{
"factor": "potassium_mmol_l",
"points": 0,
"present": false,
"value": 4
},
{
"acute_renal_failure": false,
"factor": "creatinine_mg_dl",
"points": 0,
"present": false,
"value": 1
},
{
"factor": "hematocrit_percent",
"points": 0,
"present": false,
"value": 40
},
{
"factor": "wbc_k_ul",
"points": 0,
"present": false,
"value": 8
},
{
"factor": "gcs",
"points": 0,
"present": false,
"value": 15
},
{
"factor": "age",
"points": 0,
"present": false,
"value": 40
},
{
"chronic_health": false,
"elective_postop": false,
"factor": "chronic_health",
"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.",
"formula": "apache_ii",
"formula_expression": "APACHE II = APS + age_points + chronic_health_points; APS is the sum of 12 Knaus 1985 Table 1 items (worst values in 24h as assigned by the caller): temperature_c, map_mm_hg, heart_rate, respiratory_rate, oxygenation (A-aDO2 if fio2 >= 0.5, PaO2 if fio2 < 0.5), arterial_ph, sodium_mmol_l, potassium_mmol_l, creatinine_mg_dl (doubled if acute_renal_failure), hematocrit_percent, wbc_k_ul, and 15-gcs; age <=44 → 0, 45-54 → 2, 55-64 → 3, 65-74 → 5, >=75 → 6; chronic health 0 if none, else +5 nonoperative or emergency postoperative or +2 elective postoperative; max 71",
"max_score": 71,
"score": 0
}
],
"path": "/api/calc/apache_ii"
}Call it from code
The curl command shows the payment challenge. The JavaScript and Python versions pay and call, and never pay more than $0.007.
curl: see the payment challenge
# bash or zsh: see the payment challenge. Nothing is charged.
curl -sS -g -i -X POST 'https://api.magentlab.com/api/calc/apache_ii' \
-H 'content-type: application/json' \
--data-raw '{"items":[{"aa_gradient":100,"acute_renal_failure":false,"age":40,"arterial_ph":7.4,"chronic_health":false,"creatinine_mg_dl":1,"elective_postop":false,"fio2":0.21,"gcs":15,"heart_rate":80,"hematocrit_percent":40,"map_mm_hg":90,"pao2_mm_hg":90,"potassium_mmol_l":4,"respiratory_rate":16,"sodium_mmol_l":140,"temperature_c":37,"wbc_k_ul":8},{"aa_gradient":100,"acute_renal_failure":false,"age":40,"arterial_ph":7.4,"chronic_health":false,"creatinine_mg_dl":1,"elective_postop":false,"fio2":0.21,"gcs":15,"heart_rate":80,"hematocrit_percent":40,"map_mm_hg":90,"pao2_mm_hg":90,"potassium_mmol_l":4,"respiratory_rate":16,"sodium_mmol_l":140,"temperature_c":37,"wbc_k_ul":8}]}'
# x402 v2 sends the challenge base64-encoded in the PAYMENT-REQUIRED header (v1 sends it in the body).
# To read the header:
curl -sS -g -o /dev/null -D - -X POST 'https://api.magentlab.com/api/calc/apache_ii' \
-H 'content-type: application/json' \
--data-raw '{"items":[{"aa_gradient":100,"acute_renal_failure":false,"age":40,"arterial_ph":7.4,"chronic_health":false,"creatinine_mg_dl":1,"elective_postop":false,"fio2":0.21,"gcs":15,"heart_rate":80,"hematocrit_percent":40,"map_mm_hg":90,"pao2_mm_hg":90,"potassium_mmol_l":4,"respiratory_rate":16,"sodium_mmol_l":140,"temperature_c":37,"wbc_k_ul":8},{"aa_gradient":100,"acute_renal_failure":false,"age":40,"arterial_ph":7.4,"chronic_health":false,"creatinine_mg_dl":1,"elective_postop":false,"fio2":0.21,"gcs":15,"heart_rate":80,"hematocrit_percent":40,"map_mm_hg":90,"pao2_mm_hg":90,"potassium_mmol_l":4,"respiratory_rate":16,"sodium_mmol_l":140,"temperature_c":37,"wbc_k_ul":8}]}' \
| grep -i '^payment-required:' | cut -d' ' -f2 | tr -d '\r' | base64 --decodeJavaScript: pay and call
// npm i @x402/fetch @x402/evm viem
import { wrapFetchWithPayment, x402Client } from "@x402/fetch";
import { registerExactEvmScheme } from "@x402/evm/exact/client";
import { privateKeyToAccount } from "viem/accounts";
// Pays at most $0.007 per call.
const client = new x402Client().setSpendControls({ maxAmountPerPayment: "$0.007" });
registerExactEvmScheme(client, { signer: privateKeyToAccount(process.env.EVM_PRIVATE_KEY) });
const pay = wrapFetchWithPayment(fetch, client);
// Not sure it's safe to pay? ToolVet checks it first for $0.005. Pay for that from a separate
// client: this one is capped at $0.007 per payment. GET https://toolvet.app/api/v1/check?url=https%3A%2F%2Fapi.magentlab.com%2Fapi%2Fcalc%2Fapache_ii&method=POST
const res = await pay("https://api.magentlab.com/api/calc/apache_ii", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({
"items": [
{
"aa_gradient": 100,
"acute_renal_failure": false,
"age": 40,
"arterial_ph": 7.4,
"chronic_health": false,
"creatinine_mg_dl": 1,
"elective_postop": false,
"fio2": 0.21,
"gcs": 15,
"heart_rate": 80,
"hematocrit_percent": 40,
"map_mm_hg": 90,
"pao2_mm_hg": 90,
"potassium_mmol_l": 4,
"respiratory_rate": 16,
"sodium_mmol_l": 140,
"temperature_c": 37,
"wbc_k_ul": 8
},
{
"aa_gradient": 100,
"acute_renal_failure": false,
"age": 40,
"arterial_ph": 7.4,
"chronic_health": false,
"creatinine_mg_dl": 1,
"elective_postop": false,
"fio2": 0.21,
"gcs": 15,
"heart_rate": 80,
"hematocrit_percent": 40,
"map_mm_hg": 90,
"pao2_mm_hg": 90,
"potassium_mmol_l": 4,
"respiratory_rate": 16,
"sodium_mmol_l": 140,
"temperature_c": 37,
"wbc_k_ul": 8
}
]
}),
});
console.log(res.status, await res.text());Python: pay and call
# pip install "x402[requests,evm]"
import os
from eth_account import Account
from x402 import x402ClientSync
from x402.http.clients import x402_requests
from x402.mechanisms.evm import EthAccountSigner
from x402.mechanisms.evm.exact.register import register_exact_evm_client
# Pays at most $0.007 per call.
client = x402ClientSync().set_spend_controls({"max_amount_per_payment": "$0.007"})
register_exact_evm_client(client, EthAccountSigner(Account.from_key(os.environ["EVM_PRIVATE_KEY"])))
with x402_requests(client) as session:
res = session.post(
"https://api.magentlab.com/api/calc/apache_ii",
json={
"items": [
{
"aa_gradient": 100,
"acute_renal_failure": False,
"age": 40,
"arterial_ph": 7.4,
"chronic_health": False,
"creatinine_mg_dl": 1,
"elective_postop": False,
"fio2": 0.21,
"gcs": 15,
"heart_rate": 80,
"hematocrit_percent": 40,
"map_mm_hg": 90,
"pao2_mm_hg": 90,
"potassium_mmol_l": 4,
"respiratory_rate": 16,
"sodium_mmol_l": 140,
"temperature_c": 37,
"wbc_k_ul": 8,
},
{
"aa_gradient": 100,
"acute_renal_failure": False,
"age": 40,
"arterial_ph": 7.4,
"chronic_health": False,
"creatinine_mg_dl": 1,
"elective_postop": False,
"fio2": 0.21,
"gcs": 15,
"heart_rate": 80,
"hematocrit_percent": 40,
"map_mm_hg": 90,
"pao2_mm_hg": 90,
"potassium_mmol_l": 4,
"respiratory_rate": 16,
"sodium_mmol_l": 140,
"temperature_c": 37,
"wbc_k_ul": 8,
},
],
},
)
print(res.status_code, res.text)Security scan
1 finding
- Charges more than its listed price in payment
Listed at $0.005, charges $0.007
Recent checks
| When | Result | HTTP | Time | Price |
|---|---|---|---|---|
| 44 min ago | Timed out | - | - | - |
| 6 h ago | Timed out | - | - | - |
| 11 h ago | Timed out | - | - | - |
| 16 h ago | Timed out | - | - | - |
| 21 h ago | Passed | 402 | 146 ms | $0.007 |
Show 10 older checks
| 26 h ago | Passed | 402 | 1.1 s | $0.007 |
| 30 h ago | Passed | 402 | 372 ms | $0.007 |
| 35 h ago | Passed | 402 | 362 ms | $0.007 |
| 40 h ago | Passed | 402 | 156 ms | $0.007 |
| 44 h ago | Passed | 402 | 382 ms | $0.007 |
| 2 days ago | Passed | 402 | 285 ms | $0.007 |
| 2 days ago | Passed | 402 | 225 ms | $0.007 |
| 2 days ago | Passed | 402 | 327 ms | $0.007 |
| 3 days ago | Passed | 402 | 256 ms | $0.007 |
| 3 days ago | Passed | 402 | 291 ms | $0.007 |
History
| 11 Oct 2026 | Price changed from $0.005 to $0.007 |