Calc Saps Ii
by magent in Documents & files
Le Gall 1993 Simplified Acute Physiology Score II from 12 physiology variables (worst values in the first 24 hours as assigned by the caller), age, type of admission, and one chronic disease (AIDS, metastatic cancer, or hematologic malignancy). Max 163. Converts the integer to hospital-mortality probability with the paper's logit. PaO2/FiO2 is scored only if ventilated or CPAP. Not SAPS 3. Not APACHE. magent does not measure vitals.
https://api.magentlab.com/api/calc/saps_ii- Price
- $0.007
- per call in USDC
- Uptime
- 91.4%
- last 30 days
- Response time
- 300 ms
- 649 ms slowest 5%
- Last check
- Failed
- 5 h ago, next any minute now
Reliability
Latest check failed 5 h ago: Timed out
Status and outage history · Atom feed · Watch with other listings
How to call it
POST https://api.magentlab.com/api/calc/saps_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/saps_ii
content-type: application/json
{
"items": [
{
"admission_type": "scheduled_surgical",
"age": 35,
"bicarbonate_meq_l": 24,
"bilirubin_mg_dl": 0.8,
"bilirubin_umol_l": 14,
"bun_mg_dl": 15,
"chronic_disease": "none",
"gcs": 15,
"heart_rate": 80,
"pao2_fio2": 250,
"potassium_mmol_l": 4,
"sodium_mmol_l": 140,
"systolic_bp_mm_hg": 120,
"temperature_c": 37,
"urea_mmol_l": 5,
"urine_output_l_day": 1.5,
"ventilated": false,
"wbc_k_ul": 8
},
{
"admission_type": "scheduled_surgical",
"age": 35,
"bicarbonate_meq_l": 24,
"bilirubin_mg_dl": 0.8,
"bilirubin_umol_l": 14,
"bun_mg_dl": 15,
"chronic_disease": "none",
"gcs": 15,
"heart_rate": 80,
"pao2_fio2": 250,
"potassium_mmol_l": 4,
"sodium_mmol_l": 140,
"systolic_bp_mm_hg": 120,
"temperature_c": 37,
"urea_mmol_l": 5,
"urine_output_l_day": 1.5,
"ventilated": false,
"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. Shortened for display.
Example response, 232 lines
{
"count": 2,
"items": [
{
"citation": {
"authors": "Le Gall JR, Lemeshow S, Saulnier F",
"doi": "10.1001/jama.270.24.2957",
"id": "le-gall-1993",
"pmid": "8254858",
"source": "JAMA. 1993;270(24):2957-2963",
"title": "A new Simplified Acute Physiology Score (SAPS II) based on a European/North American multicenter study"
},
"components": [
{
"factor": "age",
"points": 0,
"present": false,
"value": 35
},
{
"factor": "heart_rate",
"points": 0,
"present": false,
"value": 80
},
{
"factor": "systolic_bp_mm_hg",
"points": 0,
"present": false,
"value": 120
},
{
"factor": "temperature_c",
"points": 0,
"present": false,
"value": 37
},
{
"branch": "not_ventilated",
"factor": "oxygenation",
"points": 0,
"present": false,
"value": null,
"ventilated": false
},
{
"factor": "urine_output_l_day",
"points": 0,
"present": false,
"value": 1.5
},
{
"branch": "urea_mmol_l",
"factor": "urea",
"points": 0,
"present": false,
"value": 5
},
{
"factor": "wbc_k_ul",
"points": 0,
"present": false,
"value": 8
},
{
"factor": "potassium_mmol_l",
"points": 0,
"present": false,
"value": 4
},
{
"factor": "sodium_mmol_l",
"points": 0,
"present": false,
"value": 140
},
{
"factor": "bicarbonate_meq_l",
"points": 0,
"present": false,
"value": 24
},
{
"branch": "bilirubin_mg_dl",
"factor": "bilirubin",
"points": 0,
"present": false,
"value": 0.8
},
{
"factor": "gcs",
"points": 0,
"present": false,
"value": 15
},
{
"factor": "admission_type",
"points": 0,
"present": false,
"value": "scheduled_surgical"
},
{
"factor": "chronic_disease",
"points": 0,
"present": false,
"value": "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.",
"formula": "saps_ii",
"formula_expression": "SAPS II = sum of 17 Le Gall 1993 variables (worst values in 24h as assigned by the caller): heart_rate (<40 → 11, 40-69 → 2, 70-119 → 0, 120-159 → 4, ≥160 → 7), systolic_bp_mm_hg (<70 → 13, 70-99 → 5, 100-199 → 0, ≥200 → 2), temperature_c (<39 → 0, ≥39 → 3), PaO2/FiO2 mm Hg if ventilated or CPAP (<100 → 11, 100-199 → 9, ≥200 → 6) else 0, urine_output_l_day (<0.500 → 11, 0.500-0.999 → 4, ≥1.000 → 0), urea_mmol_l (<10.0 → 0, 10.0-29.9 → 6, ≥30.0 → 10) or bun_mg_dl (<28 → 0, 28-83 → 6, ≥84 → 10), wbc_k_ul (<1.0 → 12, 1.0-19.9 → 0, ≥20.0 → 3), potassium_mmol_l (<3.0 or ≥5.0 → 3, 3.0-4.9 → 0), sodium_mmol_l (<125 → 5, 125-144 → 0, ≥145 → 1), bicarbonate_meq_l (<15 → 6, 15-19 → 3, ≥20 → 0), bilirubin_mg_dl (<4.0 → 0, 4.0-5.9 → 4, ≥6.0 → 9) or bilirubin_umol_l (<68.4 → 0, 68.4-102.5 → 4, ≥102.6 → 9), gcs (<6 → 26, 6-8 → 13, 9-10 → 7, 11-13 → 5, 14-15 → 0), age (<40 → 0, 40-59 → 7, 60-69 → 12, 70-74 → 15, 75-79 → 16, ≥80 → 18), admission_type (scheduled_surgical → 0, medical → 6, unscheduled_…",
"hospital_mortality_probability": 0.000425,
"logit": -7.7631,
"max_score": 163,
"score": 0
},
{
"citation": {
"authors": "Le Gall JR, Lemeshow S, Saulnier F",
"doi": "10.1001/jama.270.24.2957",
"id": "le-gall-1993",
"pmid": "8254858",
"source": "JAMA. 1993;270(24):2957-2963",
"title": "A new Simplified Acute Physiology Score (SAPS II) based on a European/North American multicenter study"
},
"components": [
{
"factor": "age",
"points": 0,
"present": false,
"value": 35
},
{
"factor": "heart_rate",
"points": 0,
"present": false,
"value": 80
},
{
"factor": "systolic_bp_mm_hg",
"points": 0,
"present": false,
"value": 120
},
{
"factor": "temperature_c",
"points": 0,
"present": false,
"value": 37
},
{
"branch": "not_ventilated",
"factor": "oxygenation",
"points": 0,
"present": false,
"value": null,
"ventilated": false
},
{
"factor": "urine_output_l_day",
"points": 0,
"present": false,
"value": 1.5
},
{
"branch": "urea_mmol_l",
"factor": "urea",
"points": 0,
"present": false,
"value": 5
},
{
"factor": "wbc_k_ul",
"points": 0,
"present": false,
"value": 8
},
{
"factor": "potassium_mmol_l",
"points": 0,
"present": false,
"value": 4
},
{
"factor": "sodium_mmol_l",
"points": 0,
"present": false,
"value": 140
},
{
"factor": "bicarbonate_meq_l",
"points": 0,
"present": false,
"value": 24
},
{
"branch": "bilirubin_mg_dl",
"factor": "bilirubin",
"points": 0,
"present": false,
"value": 0.8
},
{
"factor": "gcs",
"points": 0,
"present": false,
"value": 15
},
{
"factor": "admission_type",
"points": 0,
"present": false,
"value": "scheduled_surgical"
},
{
"factor": "chronic_disease",
"points": 0,
"present": false,
"value": "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.",
"formula": "saps_ii",
"formula_expression": "SAPS II = sum of 17 Le Gall 1993 variables (worst values in 24h as assigned by the caller): heart_rate (<40 → 11, 40-69 → 2, 70-119 → 0, 120-159 → 4, ≥160 → 7), systolic_bp_mm_hg (<70 → 13, 70-99 → 5, 100-199 → 0, ≥200 → 2), temperature_c (<39 → 0, ≥39 → 3), PaO2/FiO2 mm Hg if ventilated or CPAP (<100 → 11, 100-199 → 9, ≥200 → 6) else 0, urine_output_l_day (<0.500 → 11, 0.500-0.999 → 4, ≥1.000 → 0), urea_mmol_l (<10.0 → 0, 10.0-29.9 → 6, ≥30.0 → 10) or bun_mg_dl (<28 → 0, 28-83 → 6, ≥84 → 10), wbc_k_ul (<1.0 → 12, 1.0-19.9 → 0, ≥20.0 → 3), potassium_mmol_l (<3.0 or ≥5.0 → 3, 3.0-4.9 → 0), sodium_mmol_l (<125 → 5, 125-144 → 0, ≥145 → 1), bicarbonate_meq_l (<15 → 6, 15-19 → 3, ≥20 → 0), bilirubin_mg_dl (<4.0 → 0, 4.0-5.9 → 4, ≥6.0 → 9) or bilirubin_umol_l (<68.4 → 0, 68.4-102.5 → 4, ≥102.6 → 9), gcs (<6 → 26, 6-8 → 13, 9-10 → 7, 11-13 → 5, 14-15 → 0), age (<40 → 0, 40-59 → 7, 60-69 → 12, 70-74 → 15, 75-79 → 16, ≥80 → 18), admission_type (scheduled_surgical → 0, medical → 6, unscheduled_…",
"hospital_mortality_probability": 0.000425,
"logit": -7.7631,
"max_score": 163,
"score": 0
}
],
"path": "/api/calc/saps_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/saps_ii' \
-H 'content-type: application/json' \
--data-raw '{"items":[{"admission_type":"scheduled_surgical","age":35,"bicarbonate_meq_l":24,"bilirubin_mg_dl":0.8,"bilirubin_umol_l":14,"bun_mg_dl":15,"chronic_disease":"none","gcs":15,"heart_rate":80,"pao2_fio2":250,"potassium_mmol_l":4,"sodium_mmol_l":140,"systolic_bp_mm_hg":120,"temperature_c":37,"urea_mmol_l":5,"urine_output_l_day":1.5,"ventilated":false,"wbc_k_ul":8},{"admission_type":"scheduled_surgical","age":35,"bicarbonate_meq_l":24,"bilirubin_mg_dl":0.8,"bilirubin_umol_l":14,"bun_mg_dl":15,"chronic_disease":"none","gcs":15,"heart_rate":80,"pao2_fio2":250,"potassium_mmol_l":4,"sodium_mmol_l":140,"systolic_bp_mm_hg":120,"temperature_c":37,"urea_mmol_l":5,"urine_output_l_day":1.5,"ventilated":false,"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/saps_ii' \
-H 'content-type: application/json' \
--data-raw '{"items":[{"admission_type":"scheduled_surgical","age":35,"bicarbonate_meq_l":24,"bilirubin_mg_dl":0.8,"bilirubin_umol_l":14,"bun_mg_dl":15,"chronic_disease":"none","gcs":15,"heart_rate":80,"pao2_fio2":250,"potassium_mmol_l":4,"sodium_mmol_l":140,"systolic_bp_mm_hg":120,"temperature_c":37,"urea_mmol_l":5,"urine_output_l_day":1.5,"ventilated":false,"wbc_k_ul":8},{"admission_type":"scheduled_surgical","age":35,"bicarbonate_meq_l":24,"bilirubin_mg_dl":0.8,"bilirubin_umol_l":14,"bun_mg_dl":15,"chronic_disease":"none","gcs":15,"heart_rate":80,"pao2_fio2":250,"potassium_mmol_l":4,"sodium_mmol_l":140,"systolic_bp_mm_hg":120,"temperature_c":37,"urea_mmol_l":5,"urine_output_l_day":1.5,"ventilated":false,"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%2Fsaps_ii&method=POST
const res = await pay("https://api.magentlab.com/api/calc/saps_ii", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({
"items": [
{
"admission_type": "scheduled_surgical",
"age": 35,
"bicarbonate_meq_l": 24,
"bilirubin_mg_dl": 0.8,
"bilirubin_umol_l": 14,
"bun_mg_dl": 15,
"chronic_disease": "none",
"gcs": 15,
"heart_rate": 80,
"pao2_fio2": 250,
"potassium_mmol_l": 4,
"sodium_mmol_l": 140,
"systolic_bp_mm_hg": 120,
"temperature_c": 37,
"urea_mmol_l": 5,
"urine_output_l_day": 1.5,
"ventilated": false,
"wbc_k_ul": 8
},
{
"admission_type": "scheduled_surgical",
"age": 35,
"bicarbonate_meq_l": 24,
"bilirubin_mg_dl": 0.8,
"bilirubin_umol_l": 14,
"bun_mg_dl": 15,
"chronic_disease": "none",
"gcs": 15,
"heart_rate": 80,
"pao2_fio2": 250,
"potassium_mmol_l": 4,
"sodium_mmol_l": 140,
"systolic_bp_mm_hg": 120,
"temperature_c": 37,
"urea_mmol_l": 5,
"urine_output_l_day": 1.5,
"ventilated": false,
"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/saps_ii",
json={
"items": [
{
"admission_type": "scheduled_surgical",
"age": 35,
"bicarbonate_meq_l": 24,
"bilirubin_mg_dl": 0.8,
"bilirubin_umol_l": 14,
"bun_mg_dl": 15,
"chronic_disease": "none",
"gcs": 15,
"heart_rate": 80,
"pao2_fio2": 250,
"potassium_mmol_l": 4,
"sodium_mmol_l": 140,
"systolic_bp_mm_hg": 120,
"temperature_c": 37,
"urea_mmol_l": 5,
"urine_output_l_day": 1.5,
"ventilated": False,
"wbc_k_ul": 8,
},
{
"admission_type": "scheduled_surgical",
"age": 35,
"bicarbonate_meq_l": 24,
"bilirubin_mg_dl": 0.8,
"bilirubin_umol_l": 14,
"bun_mg_dl": 15,
"chronic_disease": "none",
"gcs": 15,
"heart_rate": 80,
"pao2_fio2": 250,
"potassium_mmol_l": 4,
"sodium_mmol_l": 140,
"systolic_bp_mm_hg": 120,
"temperature_c": 37,
"urea_mmol_l": 5,
"urine_output_l_day": 1.5,
"ventilated": False,
"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 |
|---|---|---|---|---|
| 5 h ago | Timed out | - | - | - |
| 10 h ago | Timed out | - | - | - |
| 15 h ago | Timed out | - | - | - |
| 20 h ago | Passed | 402 | 251 ms | $0.007 |
| 25 h ago | Passed | 402 | 278 ms | $0.007 |
Show 10 older checks
| 29 h ago | Passed | 402 | 529 ms | $0.007 |
| 34 h ago | Passed | 402 | 364 ms | $0.007 |
| 39 h ago | Passed | 402 | 290 ms | $0.007 |
| 43 h ago | Passed | 402 | 300 ms | $0.007 |
| 2 days ago | Passed | 402 | 299 ms | $0.007 |
| 2 days ago | Passed | 402 | 340 ms | $0.007 |
| 2 days ago | Passed | 402 | 689 ms | $0.007 |
| 3 days ago | Passed | 402 | 170 ms | $0.007 |
| 3 days ago | Passed | 402 | 291 ms | $0.007 |
| 3 days ago | Passed | 402 | 347 ms | $0.007 |
History
| 11 Oct 2026 | Price changed from $0.005 to $0.007 |