Calc Grace
by magent in Other
Granger 2003 in-hospital GRACE 1.0: integer nomogram points from age, heart rate, systolic BP, creatinine (mg/dL or µmol/L), Killip class 1-4, cardiac arrest, ST-segment deviation, and elevated initial enzymes. Total 1-372. In-hospital mortality percent is that paper's printed score readout. Not GRACE 2.0, not Fox 2006 6-month, not ESC 108/140 cutoffs. Not a medical device and not a cath-lab order.
https://api.magentlab.com/api/calc/grace- Price
- $0.007
- per call in USDC
- Uptime
- 94.1%
- last 30 days
- Response time
- 170 ms
- 500 ms slowest 5%
- Last check
- Failed
- 4 h ago, next any minute now
Reliability
Latest check failed 4 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/grace
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/grace
content-type: application/json
{
"items": [
{
"age": 65,
"cardiac_arrest": false,
"creatinine_mg_dl": 1,
"creatinine_umol_l": 88.42,
"elevated_enzymes": false,
"heart_rate_bpm": 80,
"killip_class": 1,
"sbp_mm_hg": 130,
"st_deviation": false
},
{
"age": 65,
"cardiac_arrest": false,
"creatinine_mg_dl": 1,
"creatinine_umol_l": 88.42,
"elevated_enzymes": false,
"heart_rate_bpm": 80,
"killip_class": 1,
"sbp_mm_hg": 130,
"st_deviation": false
}
]
}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, 148 lines
{
"count": 2,
"items": [
{
"age_years": 65,
"cardiac_arrest": false,
"citation": {
"authors": "Granger CB, Goldberg RJ, Dabbous O, Pieper KS, Eagle KA, Cannon CP, Van De Werf F, Avezum A, Goodman SG, Flather MD, Fox KA; Global Registry of Acute Coronary Events Investigators",
"doi": "10.1001/archinte.163.19.2345",
"id": "granger-2003-grace",
"pmid": "14581255",
"source": "Arch Intern Med. 2003;163(19):2345-2353",
"title": "Predictors of hospital mortality in the global registry of acute coronary events"
},
"components": [
{
"factor": "age",
"points": 58,
"present": true,
"value": 65
},
{
"factor": "heart_rate_bpm",
"points": 9,
"present": true,
"value": 80
},
{
"factor": "sbp_mm_hg",
"points": 34,
"present": true,
"value": 130
},
{
"factor": "creatinine_mg_dl",
"points": 7,
"present": true,
"value": 1
},
{
"factor": "killip_class",
"points": 0,
"present": false,
"value": 1
},
{
"factor": "cardiac_arrest",
"points": 0,
"present": false
},
{
"factor": "st_deviation",
"points": 0,
"present": false
},
{
"factor": "elevated_enzymes",
"points": 0,
"present": false
}
],
"creatinine_mg_dl": 1,
"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.",
"elevated_enzymes": false,
"formula": "grace",
"formula_expression": "GRACE = age_points(<30:0, 30-39:8, 40-49:25, 50-59:41, 60-69:58, 70-79:75, 80-89:91, >=90:100) + heart_rate_points(<50:0, 50-69:3, 70-89:9, 90-109:15, 110-149:24, 150-199:38, >=200:46) + sbp_points(<80:58, 80-99:53, 100-119:43, 120-139:34, 140-159:24, 160-199:10, >=200:0) + creatinine_mg_dl_points(0-0.39:1, 0.4-0.79:4, 0.8-1.19:7, 1.2-1.59:10, 1.6-1.99:13, 2.0-3.99:21, >=4:28) + killip(1:0, 2:20, 3:39, 4:59) + 39 if cardiac_arrest + 28 if st_deviation + 14 if elevated_enzymes; Granger 2003 in-hospital GRACE 1.0 nomogram; max 372; in_hospital_mortality_percent is that paper's printed score readout (score<=60 → 0.2; then the labeled 70-240 percents at or below the total; score>=250 → 52); not ESC 108/140 cutoffs, not GRACE 2.0, not Fox 2006 6-month",
"heart_rate_bpm": 80,
"in_hospital_mortality_percent": 0.8,
"killip_class": 1,
"max_score": 372,
"sbp_mm_hg": 130,
"score": 108,
"st_deviation": false
},
{
"age_years": 65,
"cardiac_arrest": false,
"citation": {
"authors": "Granger CB, Goldberg RJ, Dabbous O, Pieper KS, Eagle KA, Cannon CP, Van De Werf F, Avezum A, Goodman SG, Flather MD, Fox KA; Global Registry of Acute Coronary Events Investigators",
"doi": "10.1001/archinte.163.19.2345",
"id": "granger-2003-grace",
"pmid": "14581255",
"source": "Arch Intern Med. 2003;163(19):2345-2353",
"title": "Predictors of hospital mortality in the global registry of acute coronary events"
},
"components": [
{
"factor": "age",
"points": 58,
"present": true,
"value": 65
},
{
"factor": "heart_rate_bpm",
"points": 9,
"present": true,
"value": 80
},
{
"factor": "sbp_mm_hg",
"points": 34,
"present": true,
"value": 130
},
{
"factor": "creatinine_mg_dl",
"points": 7,
"present": true,
"value": 1
},
{
"factor": "killip_class",
"points": 0,
"present": false,
"value": 1
},
{
"factor": "cardiac_arrest",
"points": 0,
"present": false
},
{
"factor": "st_deviation",
"points": 0,
"present": false
},
{
"factor": "elevated_enzymes",
"points": 0,
"present": false
}
],
"creatinine_mg_dl": 1,
"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.",
"elevated_enzymes": false,
"formula": "grace",
"formula_expression": "GRACE = age_points(<30:0, 30-39:8, 40-49:25, 50-59:41, 60-69:58, 70-79:75, 80-89:91, >=90:100) + heart_rate_points(<50:0, 50-69:3, 70-89:9, 90-109:15, 110-149:24, 150-199:38, >=200:46) + sbp_points(<80:58, 80-99:53, 100-119:43, 120-139:34, 140-159:24, 160-199:10, >=200:0) + creatinine_mg_dl_points(0-0.39:1, 0.4-0.79:4, 0.8-1.19:7, 1.2-1.59:10, 1.6-1.99:13, 2.0-3.99:21, >=4:28) + killip(1:0, 2:20, 3:39, 4:59) + 39 if cardiac_arrest + 28 if st_deviation + 14 if elevated_enzymes; Granger 2003 in-hospital GRACE 1.0 nomogram; max 372; in_hospital_mortality_percent is that paper's printed score readout (score<=60 → 0.2; then the labeled 70-240 percents at or below the total; score>=250 → 52); not ESC 108/140 cutoffs, not GRACE 2.0, not Fox 2006 6-month",
"heart_rate_bpm": 80,
"in_hospital_mortality_percent": 0.8,
"killip_class": 1,
"max_score": 372,
"sbp_mm_hg": 130,
"score": 108,
"st_deviation": false
}
],
"path": "/api/calc/grace"
}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/grace' \
-H 'content-type: application/json' \
--data-raw '{"items":[{"age":65,"cardiac_arrest":false,"creatinine_mg_dl":1,"creatinine_umol_l":88.42,"elevated_enzymes":false,"heart_rate_bpm":80,"killip_class":1,"sbp_mm_hg":130,"st_deviation":false},{"age":65,"cardiac_arrest":false,"creatinine_mg_dl":1,"creatinine_umol_l":88.42,"elevated_enzymes":false,"heart_rate_bpm":80,"killip_class":1,"sbp_mm_hg":130,"st_deviation":false}]}'
# 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/grace' \
-H 'content-type: application/json' \
--data-raw '{"items":[{"age":65,"cardiac_arrest":false,"creatinine_mg_dl":1,"creatinine_umol_l":88.42,"elevated_enzymes":false,"heart_rate_bpm":80,"killip_class":1,"sbp_mm_hg":130,"st_deviation":false},{"age":65,"cardiac_arrest":false,"creatinine_mg_dl":1,"creatinine_umol_l":88.42,"elevated_enzymes":false,"heart_rate_bpm":80,"killip_class":1,"sbp_mm_hg":130,"st_deviation":false}]}' \
| 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%2Fgrace&method=POST
const res = await pay("https://api.magentlab.com/api/calc/grace", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({
"items": [
{
"age": 65,
"cardiac_arrest": false,
"creatinine_mg_dl": 1,
"creatinine_umol_l": 88.42,
"elevated_enzymes": false,
"heart_rate_bpm": 80,
"killip_class": 1,
"sbp_mm_hg": 130,
"st_deviation": false
},
{
"age": 65,
"cardiac_arrest": false,
"creatinine_mg_dl": 1,
"creatinine_umol_l": 88.42,
"elevated_enzymes": false,
"heart_rate_bpm": 80,
"killip_class": 1,
"sbp_mm_hg": 130,
"st_deviation": false
}
]
}),
});
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/grace",
json={
"items": [
{
"age": 65,
"cardiac_arrest": False,
"creatinine_mg_dl": 1,
"creatinine_umol_l": 88.42,
"elevated_enzymes": False,
"heart_rate_bpm": 80,
"killip_class": 1,
"sbp_mm_hg": 130,
"st_deviation": False,
},
{
"age": 65,
"cardiac_arrest": False,
"creatinine_mg_dl": 1,
"creatinine_umol_l": 88.42,
"elevated_enzymes": False,
"heart_rate_bpm": 80,
"killip_class": 1,
"sbp_mm_hg": 130,
"st_deviation": False,
},
],
},
)
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 |
|---|---|---|---|---|
| 4 h ago | Timed out | - | - | - |
| 9 h ago | Timed out | - | - | - |
| 14 h ago | Passed | 402 | 314 ms | $0.007 |
| 19 h ago | Passed | 402 | 189 ms | $0.007 |
| 24 h ago | Passed | 402 | 249 ms | $0.007 |
Show 10 older checks
| 28 h ago | Passed | 402 | 148 ms | $0.007 |
| 33 h ago | Passed | 402 | 153 ms | $0.007 |
| 37 h ago | Passed | 402 | 250 ms | $0.007 |
| 42 h ago | Passed | 402 | 237 ms | $0.007 |
| 45 h ago | Passed | 402 | 144 ms | $0.007 |
| 2 days ago | Passed | 402 | 166 ms | $0.007 |
| 2 days ago | Passed | 402 | 155 ms | $0.007 |
| 2 days ago | Passed | 402 | 170 ms | $0.007 |
| 3 days ago | Passed | 402 | 181 ms | $0.007 |
| 3 days ago | Passed | 402 | 310 ms | $0.007 |
History
| 11 Oct 2026 | Price changed from $0.005 to $0.007 |