# magent Pack-Years Calculator

> magent Pack-Years Calculator is a paid API for AI agents from api.magentlab.com, paid per call via x402, $0.005/call, status unknown (last checked 2026-09-15).

Calculates NCI-defined pack-year smoking exposure from daily cigarette or pack consumption and years smoked

## Facts

- Endpoint: GET https://api.magentlab.com/api/calc/pack_years
- Price: $0.005/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-15
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/magent-pack-years-calculator-2b178ca4
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_8s2vvzaqjR3J_ROvqGaFJ

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability magent-pack-years-calculator-2b178ca4
```

Example prompt: Calculate the pack years for a patient who smoked 1.5 packs per day for 25 years.

## When to prefer this

Use this endpoint when you need a fast, programmatic NCI-standard pack-year computation from structured inputs (daily consumption + duration). It is not a lung cancer screening tool, COPD diagnostic, or medical interview — choose it for EHR enrichment, research scoring, or clinical documentation automation where you already have the two required numeric inputs.

## Known failure modes

- Both packs_per_day and cigarettes_per_day supplied simultaneously — only one is accepted
- years_smoked missing from query params — required field
- Values outside clamped ranges (packs_per_day >10, cigarettes_per_day >200, years_smoked >80) may be clamped or rejected
- Payment not provided or x402 payment failure resulting in 402 response
- Invalid numeric types for parameters

## How this service works

NCI pack-year smoking exposure: pack_years = packs_per_day x years_smoked. One pack per day for one year is one pack-year; two packs per day for 0.5 year is the same. Provide packs_per_day (0-10) or cigarettes_per_day (0-200; 20 cigarettes = 1 pack), not both, plus years_smoked (0-80). magent does not take a smoking history interview. Not a lung-cancer screening order, COPD diagnosis, or medical device.

## Output

Returns a numeric pack-years value computed as (packs_per_day × years_smoked), following the NCI definition where 1 pack/day for 1 year equals 1 pack-year. If cigarettes_per_day is provided, it is first divided by 20 to convert to packs.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "required": [
  "input"
 ],
 "properties": {
  "input": {
   "type": "object",
   "required": [
    "type",
    "method"
   ],
   "properties": {
    "type": {
     "type": "string",
     "const": "http"
    },
    "method": {
     "enum": [
      "GET",
      "HEAD",
      "DELETE"
     ],
     "type": "string"
    },
    "headers": {
     "type": "object",
     "additionalProperties": {
      "type": "string"
     }
    },
    "queryParams": {
     "type": "object",
     "required": [
      "years_smoked"
     ],
     "properties": {
      "years_smoked": {
       "type": "number",
       "description": "Years smoked (0-80, magent clamp; NCI does not publish an input band). NCI: 2 packs/day for 0.5 year = 1 pack-year. magent does not take a smoking history interview."
      },
      "packs_per_day": {
       "type": "number",
       "description": "Cigarette packs smoked per day (0-10, magent clamp; NCI does not publish an input band). Provide this or cigarettes_per_day, not both. NCI: 1 pack/day for 1 year = 1 pack-year."
      },
      "cigarettes_per_day": {
       "type": "number",
       "description": "Cigarettes smoked per day (0-200, magent clamp). Converted as packs_per_day = cigarettes_per_day / 20. Provide this or packs_per_day, not both."
      }
     }
    }
   },
   "additionalProperties": false
  },
  "output": {
   "type": "object",
   "required": [
    "type"
   ],
   "properties": {
    "type": {
     "type": "string"
    },
    "example": {
     "type": "object"
    }
   }
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/magent-pack-years-calculator-2b178ca4/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.magentlab.com](https://www.zero.xyz/host/api.magentlab.com/llms.txt)
