Calc Bam
by magent in Developer tools
Cacciola 2013 Brief Addiction Monitor (BAM; public-domain VA instrument). Three subscales only: Use (items 4+5+6, 0-90), Risk (items 1+2+3+8+11+15, 0-102 on Table 1 0-4 Likert plus 0-30 days), Protective (items 9+10+12+13+14+16, 0-98; income No=0 Yes=30). Items 7a-g and 17 collected, not summed. No total BAM score. magent does not interview the patient. Not a diagnosis, level-of-care order, or medical device.
https://api.magentlab.com/api/calc/bam- Price
- $0.007
- per call in USDC
- Uptime
- 91.4%
- last 30 days
- Response time
- 330 ms
- 610 ms slowest 5%
- Last check
- Failed
- 6 h ago, next any minute now
Reliability
Latest check failed 6 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/bam
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/bam
content-type: application/json
{
"items": [
{
"abstinence_confidence": 0,
"adequate_income": false,
"craving": 0,
"days_alcohol": 0,
"days_drug": 0,
"days_heavy_alcohol": 0,
"days_psychological": 0,
"days_risky": 0,
"days_self_help": 0,
"days_sleep": 0,
"days_structured": 0,
"days_supportive": 0,
"drug_cocaine": false,
"drug_inhalants": false,
"drug_marijuana": false,
"drug_opiates": false,
"drug_other": false,
"drug_sedatives": false,
"drug_stimulants": false,
"family_arguments": 0,
"physical_health": 0,
"recovery_satisfaction": 0,
"religion_support": 0
},
{
"abstinence_confidence": 0,
"adequate_income": false,
"craving": 0,
"days_alcohol": 0,
"days_drug": 0,
"days_heavy_alcohol": 0,
"days_psychological": 0,
"days_risky": 0,
"days_self_help": 0,
"days_sleep": 0,
"days_structured": 0,
"days_supportive": 0,
"drug_cocaine": false,
"drug_inhalants": false,
"drug_marijuana": false,
"drug_opiates": false,
"drug_other": false,
"drug_sedatives": false,
"drug_stimulants": false,
"family_arguments": 0,
"physical_health": 0,
"recovery_satisfaction": 0,
"religion_support": 0
}
]
}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, 301 lines
{
"count": 2,
"items": [
{
"citation": {
"authors": "Cacciola JS, Alterman AI, DePhilippis D, et al.",
"doi": "10.1016/j.jsat.2012.07.013",
"id": "cacciola-2013",
"pmid": "22898042",
"source": "J Subst Abuse Treat. 2013;44(5):492-499",
"title": "Development and initial evaluation of the Brief Addiction Monitor (BAM)"
},
"components": [
{
"factor": "physical_health",
"points": 0,
"present": true,
"subscale": "risk",
"value": 0
},
{
"factor": "days_sleep",
"points": 0,
"present": true,
"subscale": "risk",
"value": 0
},
{
"factor": "days_psychological",
"points": 0,
"present": true,
"subscale": "risk",
"value": 0
},
{
"factor": "days_alcohol",
"points": 0,
"present": true,
"subscale": "use",
"value": 0
},
{
"factor": "days_heavy_alcohol",
"points": 0,
"present": true,
"subscale": "use",
"value": 0
},
{
"factor": "days_drug",
"points": 0,
"present": true,
"subscale": "use",
"value": 0
},
{
"factor": "drug_marijuana",
"points": 0,
"present": false,
"subscale": "collected",
"value": false
},
{
"factor": "drug_sedatives",
"points": 0,
"present": false,
"subscale": "collected",
"value": false
},
{
"factor": "drug_cocaine",
"points": 0,
"present": false,
"subscale": "collected",
"value": false
},
{
"factor": "drug_stimulants",
"points": 0,
"present": false,
"subscale": "collected",
"value": false
},
{
"factor": "drug_opiates",
"points": 0,
"present": false,
"subscale": "collected",
"value": false
},
{
"factor": "drug_inhalants",
"points": 0,
"present": false,
"subscale": "collected",
"value": false
},
{
"factor": "drug_other",
"points": 0,
"present": false,
"subscale": "collected",
"value": false
},
{
"factor": "craving",
"points": 0,
"present": true,
"subscale": "risk",
"value": 0
},
{
"factor": "abstinence_confidence",
"points": 0,
"present": true,
"subscale": "protective",
"value": 0
},
{
"factor": "days_self_help",
"points": 0,
"present": true,
"subscale": "protective",
"value": 0
},
{
"factor": "days_risky",
"points": 0,
"present": true,
"subscale": "risk",
"value": 0
},
{
"factor": "religion_support",
"points": 0,
"present": true,
"subscale": "protective",
"value": 0
},
{
"factor": "days_structured",
"points": 0,
"present": true,
"subscale": "protective",
"value": 0
},
{
"factor": "adequate_income",
"points": 0,
"present": false,
"subscale": "protective",
"value": 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": "bam",
"formula_expression": "Use = days_alcohol + days_heavy_alcohol + days_drug (Cacciola 2013 Table 1 items 4+5+6; each 0-30; max 90); Risk = physical_health + days_sleep + days_psychological + craving + days_risky + family_arguments (items 1+2+3+8+11+15; Table 1 Likert 0-4 kept on Table 1's own scale, day-counts 0-30; max 102); Protective = abstinence_confidence + days_self_help + religion_support + days_structured + adequate_income + days_supportive (items 9+10+12+13+14+16; Table 1 Likert 0-4, day-counts 0-30, income No=0 Yes=30; max 98); items 7a-g and 17 collected and not summed. No single total BAM score. magent does not interview the patient. Not a diagnosis or level-of-care order.",
"protective": 0,
"protective_max": 98,
"risk": 0,
"risk_max": 102,
"use": 0,
"use_max": 90
},
{
"citation": {
"authors": "Cacciola JS, Alterman AI, DePhilippis D, et al.",
"doi": "10.1016/j.jsat.2012.07.013",
"id": "cacciola-2013",
"pmid": "22898042",
"source": "J Subst Abuse Treat. 2013;44(5):492-499",
"title": "Development and initial evaluation of the Brief Addiction Monitor (BAM)"
},
"components": [
{
"factor": "physical_health",
"points": 0,
"present": true,
"subscale": "risk",
"value": 0
},
{
"factor": "days_sleep",
"points": 0,
"present": true,
"subscale": "risk",
"value": 0
},
{
"factor": "days_psychological",
"points": 0,
"present": true,
"subscale": "risk",
"value": 0
},
{
"factor": "days_alcohol",
"points": 0,
"present": true,
"subscale": "use",
"value": 0
},
{
"factor": "days_heavy_alcohol",
"points": 0,
"present": true,
"subscale": "use",
"value": 0
},
{
"factor": "days_drug",
"points": 0,
"present": true,
"subscale": "use",
"value": 0
},
{
"factor": "drug_marijuana",
"points": 0,
"present": false,
"subscale": "collected",
"value": false
},
{
"factor": "drug_sedatives",
"points": 0,
"present": false,
"subscale": "collected",
"value": false
},
{
"factor": "drug_cocaine",
"points": 0,
"present": false,
"subscale": "collected",
"value": false
},
{
"factor": "drug_stimulants",
"points": 0,
"present": false,
"subscale": "collected",
"value": false
},
{
"factor": "drug_opiates",
"points": 0,
"present": false,
"subscale": "collected",
"value": false
},
{
"factor": "drug_inhalants",
"points": 0,
"present": false,
"subscale": "collected",
"value": false
},
{
"factor": "drug_other",
"points": 0,
"present": false,
"subscale": "collected",
"value": false
},
{
"factor": "craving",
"points": 0,
"present": true,
"subscale": "risk",
"value": 0
},
{
"factor": "abstinence_confidence",
"points": 0,
"present": true,
"subscale": "protective",
"value": 0
},
{
"factor": "days_self_help",
"points": 0,
"present": true,
"subscale": "protective",
"value": 0
},
{
"factor": "days_risky",
"points": 0,
"present": true,
"subscale": "risk",
"value": 0
},
{
"factor": "religion_support",
"points": 0,
"present": true,
"subscale": "protective",
"value": 0
},
…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/bam' \
-H 'content-type: application/json' \
--data-raw '{"items":[{"abstinence_confidence":0,"adequate_income":false,"craving":0,"days_alcohol":0,"days_drug":0,"days_heavy_alcohol":0,"days_psychological":0,"days_risky":0,"days_self_help":0,"days_sleep":0,"days_structured":0,"days_supportive":0,"drug_cocaine":false,"drug_inhalants":false,"drug_marijuana":false,"drug_opiates":false,"drug_other":false,"drug_sedatives":false,"drug_stimulants":false,"family_arguments":0,"physical_health":0,"recovery_satisfaction":0,"religion_support":0},{"abstinence_confidence":0,"adequate_income":false,"craving":0,"days_alcohol":0,"days_drug":0,"days_heavy_alcohol":0,"days_psychological":0,"days_risky":0,"days_self_help":0,"days_sleep":0,"days_structured":0,"days_supportive":0,"drug_cocaine":false,"drug_inhalants":false,"drug_marijuana":false,"drug_opiates":false,"drug_other":false,"drug_sedatives":false,"drug_stimulants":false,"family_arguments":0,"physical_health":0,"recovery_satisfaction":0,"religion_support":0}]}'
# 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/bam' \
-H 'content-type: application/json' \
--data-raw '{"items":[{"abstinence_confidence":0,"adequate_income":false,"craving":0,"days_alcohol":0,"days_drug":0,"days_heavy_alcohol":0,"days_psychological":0,"days_risky":0,"days_self_help":0,"days_sleep":0,"days_structured":0,"days_supportive":0,"drug_cocaine":false,"drug_inhalants":false,"drug_marijuana":false,"drug_opiates":false,"drug_other":false,"drug_sedatives":false,"drug_stimulants":false,"family_arguments":0,"physical_health":0,"recovery_satisfaction":0,"religion_support":0},{"abstinence_confidence":0,"adequate_income":false,"craving":0,"days_alcohol":0,"days_drug":0,"days_heavy_alcohol":0,"days_psychological":0,"days_risky":0,"days_self_help":0,"days_sleep":0,"days_structured":0,"days_supportive":0,"drug_cocaine":false,"drug_inhalants":false,"drug_marijuana":false,"drug_opiates":false,"drug_other":false,"drug_sedatives":false,"drug_stimulants":false,"family_arguments":0,"physical_health":0,"recovery_satisfaction":0,"religion_support":0}]}' \
| 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%2Fbam&method=POST
const res = await pay("https://api.magentlab.com/api/calc/bam", {
method: "POST",
headers: { "content-type": "application/json" },
body: JSON.stringify({
"items": [
{
"abstinence_confidence": 0,
"adequate_income": false,
"craving": 0,
"days_alcohol": 0,
"days_drug": 0,
"days_heavy_alcohol": 0,
"days_psychological": 0,
"days_risky": 0,
"days_self_help": 0,
"days_sleep": 0,
"days_structured": 0,
"days_supportive": 0,
"drug_cocaine": false,
"drug_inhalants": false,
"drug_marijuana": false,
"drug_opiates": false,
"drug_other": false,
"drug_sedatives": false,
"drug_stimulants": false,
"family_arguments": 0,
"physical_health": 0,
"recovery_satisfaction": 0,
"religion_support": 0
},
{
"abstinence_confidence": 0,
"adequate_income": false,
"craving": 0,
"days_alcohol": 0,
"days_drug": 0,
"days_heavy_alcohol": 0,
"days_psychological": 0,
"days_risky": 0,
"days_self_help": 0,
"days_sleep": 0,
"days_structured": 0,
"days_supportive": 0,
"drug_cocaine": false,
"drug_inhalants": false,
"drug_marijuana": false,
"drug_opiates": false,
"drug_other": false,
"drug_sedatives": false,
"drug_stimulants": false,
"family_arguments": 0,
"physical_health": 0,
"recovery_satisfaction": 0,
"religion_support": 0
}
]
}),
});
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/bam",
json={
"items": [
{
"abstinence_confidence": 0,
"adequate_income": False,
"craving": 0,
"days_alcohol": 0,
"days_drug": 0,
"days_heavy_alcohol": 0,
"days_psychological": 0,
"days_risky": 0,
"days_self_help": 0,
"days_sleep": 0,
"days_structured": 0,
"days_supportive": 0,
"drug_cocaine": False,
"drug_inhalants": False,
"drug_marijuana": False,
"drug_opiates": False,
"drug_other": False,
"drug_sedatives": False,
"drug_stimulants": False,
"family_arguments": 0,
"physical_health": 0,
"recovery_satisfaction": 0,
"religion_support": 0,
},
{
"abstinence_confidence": 0,
"adequate_income": False,
"craving": 0,
"days_alcohol": 0,
"days_drug": 0,
"days_heavy_alcohol": 0,
"days_psychological": 0,
"days_risky": 0,
"days_self_help": 0,
"days_sleep": 0,
"days_structured": 0,
"days_supportive": 0,
"drug_cocaine": False,
"drug_inhalants": False,
"drug_marijuana": False,
"drug_opiates": False,
"drug_other": False,
"drug_sedatives": False,
"drug_stimulants": False,
"family_arguments": 0,
"physical_health": 0,
"recovery_satisfaction": 0,
"religion_support": 0,
},
],
},
)
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 |
|---|---|---|---|---|
| 6 h ago | Timed out | - | - | - |
| 10 h ago | Timed out | - | - | - |
| 15 h ago | Timed out | - | - | - |
| 20 h ago | Passed | 402 | 318 ms | $0.007 |
| 25 h ago | Passed | 402 | 435 ms | $0.007 |
Show 10 older checks
| 30 h ago | Passed | 402 | 268 ms | $0.007 |
| 34 h ago | Passed | 402 | 347 ms | $0.007 |
| 39 h ago | Passed | 402 | 303 ms | $0.007 |
| 44 h ago | Passed | 402 | 417 ms | $0.007 |
| 2 days ago | Passed | 402 | 152 ms | $0.007 |
| 2 days ago | Passed | 402 | 319 ms | $0.007 |
| 2 days ago | Passed | 402 | 519 ms | $0.007 |
| 3 days ago | Passed | 402 | 284 ms | $0.007 |
| 3 days ago | Passed | 402 | 179 ms | $0.007 |
| 3 days ago | Passed | 402 | 469 ms | $0.007 |
History
| 11 Oct 2026 | Price changed from $0.005 to $0.007 |