Calc Canrisk
by magent in Security & trust
Robinson 2011 Table 3 pCANRISK (not eCANRISK). Age 0/7/13/15; male 6; BMI 0/4/9/14; waist 0/4/6 by sex; inactivity 1; no daily fruit/veg 2; high BP 4; high glucose 14; macrosomia 1 (women); family first-degree categories ×2; caller-assigned ethnicity White 0 Aboriginal 3 Black 5 East Asian 10 South Asian 11; education 5/1/0. Max 81 F/86 M. Cutoffs 21, 29, 32, 33, 43. Not a diagnosis.
https://api.magentlab.com/api/calc/canrisk- Price
- $0.007
- per call in USDC
- Uptime
- 100%
- last 30 days
- Response time
- 288 ms
- 895 ms slowest 5%
- Last check
- Passed
- 1 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/canrisk
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/canrisk
content-type: application/json
{
"items": [
{
"activity_30min": true,
"age": 40,
"bmi_kg_m2": 22,
"daily_fruit_veg": true,
"education": "university",
"ethnicity": "white",
"family_history_count": 0,
"high_bp": false,
"high_glucose": false,
"macrosomia": false,
"sex": "female",
"waist_cm": 80
},
{
"activity_30min": true,
"age": 40,
"bmi_kg_m2": 22,
"daily_fruit_veg": true,
"education": "university",
"ethnicity": "white",
"family_history_count": 0,
"high_bp": false,
"high_glucose": false,
"macrosomia": false,
"sex": "female",
"waist_cm": 80
}
]
}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, 198 lines
{
"count": 2,
"items": [
{
"age_years": 40,
"bmi_kg_m2": 22,
"citation": {
"authors": "Robinson CA, Agarwal G, Nerenberg K",
"doi": "10.24095/hpcdp.32.1.04",
"id": "robinson-2011-canrisk",
"pmid": "22153173",
"source": "Chronic Dis Inj Can. 2011;32(1):19-31",
"title": "Validating the CANRISK prognostic model for assessing diabetes risk in Canada's multi-ethnic population"
},
"components": [
{
"factor": "age",
"points": 0,
"present": false,
"value": 40
},
{
"factor": "sex",
"points": 0,
"present": false,
"value": "female"
},
{
"factor": "bmi",
"points": 0,
"present": false,
"value": 22
},
{
"factor": "waist",
"points": 4,
"present": true,
"value": 80
},
{
"factor": "inactivity",
"points": 0,
"present": false
},
{
"factor": "no_daily_fruit_veg",
"points": 0,
"present": false
},
{
"factor": "high_bp",
"points": 0,
"present": false
},
{
"factor": "high_glucose",
"points": 0,
"present": false
},
{
"factor": "macrosomia",
"points": 0,
"present": false
},
{
"factor": "family_history",
"points": 0,
"present": false,
"value": 0
},
{
"factor": "ethnicity",
"points": 0,
"present": false,
"value": "white"
},
{
"factor": "education",
"points": 0,
"present": false,
"value": "university"
}
],
"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.",
"education": "university",
"ethnicity": "white",
"family_history_count": 0,
"formula": "canrisk",
"formula_expression": "pCANRISK = age + sex + bmi + waist + inactivity + no_daily_fruit_veg + high_bp + high_glucose + macrosomia + family_history + ethnicity + education; age <45 -> 0, 45-54 -> 7, 55-64 -> 13, >=65 -> 15; male 6; BMI <25 -> 0, 25-29.9 -> 4, 30-34.9 -> 9, >=35 -> 14; waist men <94 -> 0, 94-102 -> 4, >102 -> 6; women <80 -> 0, 80-88 -> 4, >88 -> 6; inactivity 1; no daily fruit/veg 2; high_bp 4; high_glucose 14; macrosomia women 1 else N/A 0; family_history_count 0-4 first-degree categories * 2; ethnicity white 0 aboriginal 3 black 5 east_asian 10 south_asian 11 latin_american 0 other 0 (caller-assigned; Table 3 assigned no pCANRISK points to Latin American or Other); education less_than_high_school 5 high_school 1 some_college or university 0; max 81 female / 86 male; Robinson 2011 Table 3 pCANRISK not eCANRISK; published cutoffs score>=21 29 32 33 43",
"max_score": 81,
"score": 4,
"score_ge_21": false,
"score_ge_29": false,
"score_ge_32": false,
"score_ge_33": false,
"score_ge_43": false,
"sex": "female",
"waist_cm": 80
},
{
"age_years": 40,
"bmi_kg_m2": 22,
"citation": {
"authors": "Robinson CA, Agarwal G, Nerenberg K",
"doi": "10.24095/hpcdp.32.1.04",
"id": "robinson-2011-canrisk",
"pmid": "22153173",
"source": "Chronic Dis Inj Can. 2011;32(1):19-31",
"title": "Validating the CANRISK prognostic model for assessing diabetes risk in Canada's multi-ethnic population"
},
"components": [
{
"factor": "age",
"points": 0,
"present": false,
"value": 40
},
{
"factor": "sex",
"points": 0,
"present": false,
"value": "female"
},
{
"factor": "bmi",
"points": 0,
"present": false,
"value": 22
},
{
"factor": "waist",
"points": 4,
"present": true,
"value": 80
},
{
"factor": "inactivity",
"points": 0,
"present": false
},
{
"factor": "no_daily_fruit_veg",
"points": 0,
"present": false
},
{
"factor": "high_bp",
"points": 0,
"present": false
},
{
"factor": "high_glucose",
"points": 0,
"present": false
},
{
"factor": "macrosomia",
"points": 0,
"present": false
},
{
"factor": "family_history",
"points": 0,
"present": false,
"value": 0
},
{
"factor": "ethnicity",
"points": 0,
"present": false,
"value": "white"
},
{
"factor": "education",
"points": 0,
"present": false,
"value": "university"
}
],
"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.",
"education": "university",
"ethnicity": "white",
"family_history_count": 0,
"formula": "canrisk",
"formula_expression": "pCANRISK = age + sex + bmi + waist + inactivity + no_daily_fruit_veg + high_bp + high_glucose + macrosomia + family_history + ethnicity + education; age <45 -> 0, 45-54 -> 7, 55-64 -> 13, >=65 -> 15; male 6; BMI <25 -> 0, 25-29.9 -> 4, 30-34.9 -> 9, >=35 -> 14; waist men <94 -> 0, 94-102 -> 4, >102 -> 6; women <80 -> 0, 80-88 -> 4, >88 -> 6; inactivity 1; no daily fruit/veg 2; high_bp 4; high_glucose 14; macrosomia women 1 else N/A 0; family_history_count 0-4 first-degree categories * 2; ethnicity white 0 aboriginal 3 black 5 east_asian 10 south_asian 11 latin_american 0 other 0 (caller-assigned; Table 3 assigned no pCANRISK points to Latin American or Other); education less_than_high_school 5 high_school 1 some_college or university 0; max 81 female / 86 male; Robinson 2011 Table 3 pCANRISK not eCANRISK; published cutoffs score>=21 29 32 33 43",
"max_score": 81,
"score": 4,
"score_ge_21": false,
"score_ge_29": false,
"score_ge_32": false,
"score_ge_33": false,
"score_ge_43": false,
"sex": "female",
"waist_cm": 80
}
],
"path": "/api/calc/canrisk"
}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/canrisk' \
-H 'content-type: application/json' \
--data-raw '{"items":[{"activity_30min":true,"age":40,"bmi_kg_m2":22,"daily_fruit_veg":true,"education":"university","ethnicity":"white","family_history_count":0,"high_bp":false,"high_glucose":false,"macrosomia":false,"sex":"female","waist_cm":80},{"activity_30min":true,"age":40,"bmi_kg_m2":22,"daily_fruit_veg":true,"education":"university","ethnicity":"white","family_history_count":0,"high_bp":false,"high_glucose":false,"macrosomia":false,"sex":"female","waist_cm":80}]}'
# 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/canrisk' \
-H 'content-type: application/json' \
--data-raw '{"items":[{"activity_30min":true,"age":40,"bmi_kg_m2":22,"daily_fruit_veg":true,"education":"university","ethnicity":"white","family_history_count":0,"high_bp":false,"high_glucose":false,"macrosomia":false,"sex":"female","waist_cm":80},{"activity_30min":true,"age":40,"bmi_kg_m2":22,"daily_fruit_veg":true,"education":"university","ethnicity":"white","family_history_count":0,"high_bp":false,"high_glucose":false,"macrosomia":false,"sex":"female","waist_cm":80}]}' \
| 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%2Fcanrisk&method=POST
const res = await pay("https://api.magentlab.com/api/calc/canrisk", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({
"items": [
{
"activity_30min": true,
"age": 40,
"bmi_kg_m2": 22,
"daily_fruit_veg": true,
"education": "university",
"ethnicity": "white",
"family_history_count": 0,
"high_bp": false,
"high_glucose": false,
"macrosomia": false,
"sex": "female",
"waist_cm": 80
},
{
"activity_30min": true,
"age": 40,
"bmi_kg_m2": 22,
"daily_fruit_veg": true,
"education": "university",
"ethnicity": "white",
"family_history_count": 0,
"high_bp": false,
"high_glucose": false,
"macrosomia": false,
"sex": "female",
"waist_cm": 80
}
]
}),
});
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/canrisk",
json={
"items": [
{
"activity_30min": True,
"age": 40,
"bmi_kg_m2": 22,
"daily_fruit_veg": True,
"education": "university",
"ethnicity": "white",
"family_history_count": 0,
"high_bp": False,
"high_glucose": False,
"macrosomia": False,
"sex": "female",
"waist_cm": 80,
},
{
"activity_30min": True,
"age": 40,
"bmi_kg_m2": 22,
"daily_fruit_veg": True,
"education": "university",
"ethnicity": "white",
"family_history_count": 0,
"high_bp": False,
"high_glucose": False,
"macrosomia": False,
"sex": "female",
"waist_cm": 80,
},
],
},
)
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 |
|---|---|---|---|---|
| 1 h ago | Passed | 402 | 152 ms | $0.007 |
| 6 h ago | Passed | 402 | 154 ms | $0.007 |
| 11 h ago | Passed | 402 | 228 ms | $0.007 |
| 15 h ago | Passed | 402 | 383 ms | $0.007 |
| 20 h ago | Passed | 402 | 150 ms | $0.007 |
Show 10 older checks
| 24 h ago | Passed | 402 | 325 ms | $0.007 |
| 28 h ago | Passed | 402 | 196 ms | $0.007 |
| 32 h ago | Passed | 402 | 297 ms | $0.007 |
| 37 h ago | Passed | 402 | 150 ms | $0.007 |
| 41 h ago | Passed | 402 | 389 ms | $0.007 |
| 45 h ago | Passed | 402 | 422 ms | $0.007 |
| 2 days ago | Passed | 402 | 496 ms | $0.007 |
| 2 days ago | Passed | 402 | 170 ms | $0.007 |
| 2 days ago | Passed | 402 | 163 ms | $0.007 |
| 3 days ago | Passed | 402 | 308 ms | $0.007 |
History
| 11 Oct 2026 | Price changed from $0.005 to $0.007 |