Calc Psi Port
by magent in Weather & location
Fine 1997 Pneumonia Severity Index (PSI/PORT): Class I if age ≤50 and no neoplastic, liver, CHF, cerebrovascular, or renal disease, no AMS, HR <125, RR <30, SBP >=90, and temperature 35 to <40 C. Otherwise Table 2 points (age, or age-10 if female, plus comorbidity, vital-sign, and laboratory weights) map to classes II-V. Always returns the Table 2 total. Not a medical device and not a site-of-care decision.
https://api.magentlab.com/api/calc/psi_port- Price
- $0.007
- per call in USDC
- Uptime
- 100%
- last 30 days
- Response time
- 175 ms
- 521 ms slowest 5%
- Last check
- Passed
- 4 h ago, next any minute now
Reliability
Status and outage history · Atom feed · Watch with other listings
How to call it
POST https://api.magentlab.com/api/calc/psi_port
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/psi_port
content-type: application/json
{
"items": [
{
"age": 45,
"altered_mental_status": false,
"arterial_ph": 7.4,
"bun_mg_dl": 14,
"cerebrovascular": false,
"chf": false,
"glucose_mg_dl": 90,
"heart_rate_bpm": 80,
"hematocrit_percent": 42,
"liver_disease": false,
"neoplastic": false,
"nursing_home": false,
"pao2_mm_hg": 90,
"pleural_effusion": false,
"renal_disease": false,
"respiratory_rate": 16,
"sex": "male",
"sodium_mmol_l": 140,
"systolic_mm_hg": 120,
"temperature_c": 37
},
{
"age": 45,
"altered_mental_status": false,
"arterial_ph": 7.4,
"bun_mg_dl": 14,
"cerebrovascular": false,
"chf": false,
"glucose_mg_dl": 90,
"heart_rate_bpm": 80,
"hematocrit_percent": 42,
"liver_disease": false,
"neoplastic": false,
"nursing_home": false,
"pao2_mm_hg": 90,
"pleural_effusion": false,
"renal_disease": false,
"respiratory_rate": 16,
"sex": "male",
"sodium_mmol_l": 140,
"systolic_mm_hg": 120,
"temperature_c": 37
}
]
}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, 254 lines
{
"count": 2,
"items": [
{
"age_years": 45,
"citation": {
"authors": "Fine MJ, Auble TE, Yealy DM, et al.",
"doi": "10.1056/NEJM199701233360402",
"id": "fine-1997",
"pmid": "8995086",
"source": "N Engl J Med. 1997;336(4):243-250",
"title": "A prediction rule to identify low-risk patients with community-acquired pneumonia"
},
"components": [
{
"factor": "age",
"points": 45,
"present": true,
"value": 45
},
{
"factor": "nursing_home",
"points": 0,
"present": false
},
{
"factor": "neoplastic",
"points": 0,
"present": false
},
{
"factor": "liver_disease",
"points": 0,
"present": false
},
{
"factor": "chf",
"points": 0,
"present": false
},
{
"factor": "cerebrovascular",
"points": 0,
"present": false
},
{
"factor": "renal_disease",
"points": 0,
"present": false
},
{
"factor": "altered_mental_status",
"points": 0,
"present": false
},
{
"factor": "respiratory_rate_ge_30",
"points": 0,
"present": false,
"value": 16
},
{
"factor": "systolic_mm_hg_lt_90",
"points": 0,
"present": false,
"value": 120
},
{
"factor": "temperature_extreme",
"points": 0,
"present": false,
"value": 37
},
{
"factor": "heart_rate_ge_125",
"points": 0,
"present": false,
"value": 80
},
{
"factor": "arterial_ph_lt_7_35",
"points": 0,
"present": false,
"value": 7.4
},
{
"factor": "bun_ge_30",
"points": 0,
"present": false,
"value": 14
},
{
"factor": "sodium_lt_130",
"points": 0,
"present": false,
"value": 140
},
{
"factor": "glucose_ge_250",
"points": 0,
"present": false,
"value": 90
},
{
"factor": "hematocrit_lt_30",
"points": 0,
"present": false,
"value": 42
},
{
"factor": "pao2_lt_60",
"points": 0,
"present": false,
"value": 90
},
{
"factor": "pleural_effusion",
"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": "psi_port",
"formula_expression": "PSI/PORT two-step (Fine 1997): Class I if age<=50 and no neoplastic, liver, CHF, cerebrovascular, renal, AMS and HR<125, RR<30, SBP>=90, temp>=35 and <40; else Table 2 points: age (men) or age-10 (women) + nursing_home 10 + neoplastic 30 + liver 20 + CHF 10 + cerebrovascular 10 + renal 10 + AMS 20 + RR>=30 20 + SBP<90 20 + (temp<35 or >=40) 15 + HR>=125 10 + pH<7.35 30 + BUN>=30 20 + Na<130 20 + glucose>=250 10 + Hct<30 10 + PaO2<60 10 + pleural_effusion 10; class I from step 1 else 2 if <=70, 3 if 71-90, 4 if 91-130, 5 if >130",
"risk_class": 1,
"score": 45
},
{
"age_years": 45,
"citation": {
"authors": "Fine MJ, Auble TE, Yealy DM, et al.",
"doi": "10.1056/NEJM199701233360402",
"id": "fine-1997",
"pmid": "8995086",
"source": "N Engl J Med. 1997;336(4):243-250",
"title": "A prediction rule to identify low-risk patients with community-acquired pneumonia"
},
"components": [
{
"factor": "age",
"points": 45,
"present": true,
"value": 45
},
{
"factor": "nursing_home",
"points": 0,
"present": false
},
{
"factor": "neoplastic",
"points": 0,
"present": false
},
{
"factor": "liver_disease",
"points": 0,
"present": false
},
{
"factor": "chf",
"points": 0,
"present": false
},
{
"factor": "cerebrovascular",
"points": 0,
"present": false
},
{
"factor": "renal_disease",
"points": 0,
"present": false
},
{
"factor": "altered_mental_status",
"points": 0,
"present": false
},
{
"factor": "respiratory_rate_ge_30",
"points": 0,
"present": false,
"value": 16
},
{
"factor": "systolic_mm_hg_lt_90",
"points": 0,
"present": false,
"value": 120
},
{
"factor": "temperature_extreme",
"points": 0,
"present": false,
"value": 37
},
{
"factor": "heart_rate_ge_125",
"points": 0,
"present": false,
"value": 80
},
{
"factor": "arterial_ph_lt_7_35",
"points": 0,
"present": false,
"value": 7.4
},
{
"factor": "bun_ge_30",
"points": 0,
"present": false,
"value": 14
},
{
"factor": "sodium_lt_130",
"points": 0,
"present": false,
"value": 140
},
{
"factor": "glucose_ge_250",
"points": 0,
"present": false,
"value": 90
},
{
"factor": "hematocrit_lt_30",
"points": 0,
"present": false,
"value": 42
},
{
"factor": "pao2_lt_60",
"points": 0,
"present": false,
"value": 90
},
{
"factor": "pleural_effusion",
"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": "psi_port",
"formula_expression": "PSI/PORT two-step (Fine 1997): Class I if age<=50 and no neoplastic, liver, CHF, cerebrovascular, renal, AMS and HR<125, RR<30, SBP>=90, temp>=35 and <40; else Table 2 points: age (men) or age-10 (women) + nursing_home 10 + neoplastic 30 + liver 20 + CHF 10 + cerebrovascular 10 + renal 10 + AMS 20 + RR>=30 20 + SBP<90 20 + (temp<35 or >=40) 15 + HR>=125 10 + pH<7.35 30 + BUN>=30 20 + Na<130 20 + glucose>=250 10 + Hct<30 10 + PaO2<60 10 + pleural_effusion 10; class I from step 1 else 2 if <=70, 3 if 71-90, 4 if 91-130, 5 if >130",
"risk_class": 1,
"score": 45
}
],
"path": "/api/calc/psi_port"
}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/psi_port' \
-H 'content-type: application/json' \
--data-raw '{"items":[{"age":45,"altered_mental_status":false,"arterial_ph":7.4,"bun_mg_dl":14,"cerebrovascular":false,"chf":false,"glucose_mg_dl":90,"heart_rate_bpm":80,"hematocrit_percent":42,"liver_disease":false,"neoplastic":false,"nursing_home":false,"pao2_mm_hg":90,"pleural_effusion":false,"renal_disease":false,"respiratory_rate":16,"sex":"male","sodium_mmol_l":140,"systolic_mm_hg":120,"temperature_c":37},{"age":45,"altered_mental_status":false,"arterial_ph":7.4,"bun_mg_dl":14,"cerebrovascular":false,"chf":false,"glucose_mg_dl":90,"heart_rate_bpm":80,"hematocrit_percent":42,"liver_disease":false,"neoplastic":false,"nursing_home":false,"pao2_mm_hg":90,"pleural_effusion":false,"renal_disease":false,"respiratory_rate":16,"sex":"male","sodium_mmol_l":140,"systolic_mm_hg":120,"temperature_c":37}]}'
# 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/psi_port' \
-H 'content-type: application/json' \
--data-raw '{"items":[{"age":45,"altered_mental_status":false,"arterial_ph":7.4,"bun_mg_dl":14,"cerebrovascular":false,"chf":false,"glucose_mg_dl":90,"heart_rate_bpm":80,"hematocrit_percent":42,"liver_disease":false,"neoplastic":false,"nursing_home":false,"pao2_mm_hg":90,"pleural_effusion":false,"renal_disease":false,"respiratory_rate":16,"sex":"male","sodium_mmol_l":140,"systolic_mm_hg":120,"temperature_c":37},{"age":45,"altered_mental_status":false,"arterial_ph":7.4,"bun_mg_dl":14,"cerebrovascular":false,"chf":false,"glucose_mg_dl":90,"heart_rate_bpm":80,"hematocrit_percent":42,"liver_disease":false,"neoplastic":false,"nursing_home":false,"pao2_mm_hg":90,"pleural_effusion":false,"renal_disease":false,"respiratory_rate":16,"sex":"male","sodium_mmol_l":140,"systolic_mm_hg":120,"temperature_c":37}]}' \
| 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%2Fpsi_port&method=POST
const res = await pay("https://api.magentlab.com/api/calc/psi_port", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({
"items": [
{
"age": 45,
"altered_mental_status": false,
"arterial_ph": 7.4,
"bun_mg_dl": 14,
"cerebrovascular": false,
"chf": false,
"glucose_mg_dl": 90,
"heart_rate_bpm": 80,
"hematocrit_percent": 42,
"liver_disease": false,
"neoplastic": false,
"nursing_home": false,
"pao2_mm_hg": 90,
"pleural_effusion": false,
"renal_disease": false,
"respiratory_rate": 16,
"sex": "male",
"sodium_mmol_l": 140,
"systolic_mm_hg": 120,
"temperature_c": 37
},
{
"age": 45,
"altered_mental_status": false,
"arterial_ph": 7.4,
"bun_mg_dl": 14,
"cerebrovascular": false,
"chf": false,
"glucose_mg_dl": 90,
"heart_rate_bpm": 80,
"hematocrit_percent": 42,
"liver_disease": false,
"neoplastic": false,
"nursing_home": false,
"pao2_mm_hg": 90,
"pleural_effusion": false,
"renal_disease": false,
"respiratory_rate": 16,
"sex": "male",
"sodium_mmol_l": 140,
"systolic_mm_hg": 120,
"temperature_c": 37
}
]
}),
});
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/psi_port",
json={
"items": [
{
"age": 45,
"altered_mental_status": False,
"arterial_ph": 7.4,
"bun_mg_dl": 14,
"cerebrovascular": False,
"chf": False,
"glucose_mg_dl": 90,
"heart_rate_bpm": 80,
"hematocrit_percent": 42,
"liver_disease": False,
"neoplastic": False,
"nursing_home": False,
"pao2_mm_hg": 90,
"pleural_effusion": False,
"renal_disease": False,
"respiratory_rate": 16,
"sex": "male",
"sodium_mmol_l": 140,
"systolic_mm_hg": 120,
"temperature_c": 37,
},
{
"age": 45,
"altered_mental_status": False,
"arterial_ph": 7.4,
"bun_mg_dl": 14,
"cerebrovascular": False,
"chf": False,
"glucose_mg_dl": 90,
"heart_rate_bpm": 80,
"hematocrit_percent": 42,
"liver_disease": False,
"neoplastic": False,
"nursing_home": False,
"pao2_mm_hg": 90,
"pleural_effusion": False,
"renal_disease": False,
"respiratory_rate": 16,
"sex": "male",
"sodium_mmol_l": 140,
"systolic_mm_hg": 120,
"temperature_c": 37,
},
],
},
)
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 | Passed | 402 | 146 ms | $0.007 |
| 9 h ago | Passed | 402 | 383 ms | $0.007 |
| 14 h ago | Passed | 402 | 459 ms | $0.007 |
| 18 h ago | Passed | 402 | 158 ms | $0.007 |
| 23 h ago | Passed | 402 | 183 ms | $0.007 |
Show 10 older checks
| 27 h ago | Passed | 402 | 188 ms | $0.007 |
| 32 h ago | Passed | 402 | 318 ms | $0.007 |
| 36 h ago | Passed | 402 | 446 ms | $0.007 |
| 40 h ago | Passed | 402 | 176 ms | $0.007 |
| 44 h ago | Passed | 402 | 288 ms | $0.007 |
| 2 days ago | Passed | 402 | 289 ms | $0.007 |
| 2 days ago | Passed | 402 | 344 ms | $0.007 |
| 2 days ago | Passed | 402 | 163 ms | $0.007 |
| 3 days ago | Passed | 402 | 187 ms | $0.007 |
| 3 days ago | Passed | 402 | 171 ms | $0.007 |
History
| 11 Oct 2026 | Price changed from $0.005 to $0.007 |