# CMS data.cms.gov · Top

Get health and medical data with CMS data.cms.gov · Top from Alexandria through one Spiral API key. Questions about the top spenders or movers: "which drugs cost Medicare Part D the most in 2024", "which Part B drugs rose fastest in price per unit", "which drugs with over $1 billion in Part D spending cost the most per patient". It runs in the background and returns structured JSON. Pay as you go, with no subscription.

- Provider: Alexandria
- Category: Health
- Runs: In the background
- Returns: json
- Tool id: `alexandria` / `data-cms-gov/drug-spending/top`
- Page: https://spiral.ai/tools/alexandria/data-cms-gov/drug-spending/top

## Pricing

$0.00873 per call.

## Limits

- Longest queue wait: 1 hour
- Run deadline: 5 minutes
- Longest run, end to end: 225 minutes
- Largest inline input: 1 MB
- Largest input file: 2 GB
- Largest output: 5 GB

## Input

| Field | Kind | Allowed | Default | Description |
| --- | --- | --- | --- | --- |
| `program` (required) | one of | part_d, part_b, medicaid | — | The dataset to rank. `part_d`: Medicare Part D, prescriptions patients take themselves. `part_b`: Medicare Part B, drugs given in doctors' offices and hospital outpatient departments, by HCPCS code. `medicaid`: Medicaid outpatient prescriptions. |
| `year` | number | 2000 to 2100 | — | Calendar year to rank; defaults to the latest year in the current release (2024). Years outside the release are invalid_input. |
| `limit` | number | 1 to 100 | 10 | limit |
| `order` | one of | desc, asc | desc | `desc` for highest first. |
| `sort_by` | one of | total_spending, total_claims, total_beneficiaries, avg_spending_per_beneficiary, avg_spending_per_unit_change | total_spending | `total_beneficiaries` and `avg_spending_per_beneficiary` are Medicare only (Medicaid publishes no patient counts). `avg_spending_per_unit_change` ranks the latest year against the year before, so it takes no other `year`; pair it with `min_total_spending` to skip small drugs. |
| `min_total_spending` | number | 0 to … | — | Only drugs with at least this total spending in USD in `year`. |

## Example

```bash
curl https://api.spiral.ai/v1/runs \
  -H "Authorization: Bearer $SPIRAL_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "provider": "alexandria",
    "model": "data-cms-gov/drug-spending/top",
    "input": {
      "program": "part_d"
    }
  }'
```

Try it in the Playground: https://spiral.ai/start?provider=alexandria&model=data-cms-gov%2Fdrug-spending%2Ftop

## Common questions

### CMS data.cms.gov · Top

**How much does CMS data.cms.gov · Top cost?**

$0.00873 per call. You pay as you go from one Spiral balance, with no subscription, and a failed run is not charged.

**How do I use CMS data.cms.gov · Top through an API?**

Send `POST /v1/runs` with `"provider": "alexandria"`, `"model": "data-cms-gov/drug-spending/top"` and the input fields on this page, using one Spiral API key. It runs in the background: poll the run, or name a webhook to be told when it finishes.

**Do I need an account with Alexandria to use CMS data.cms.gov · Top?**

No. Spiral runs it on its own Alexandria account and charges your Spiral balance.

**Can my AI agent use CMS data.cms.gov · Top?**

Yes. Agents find and run it through Spiral's MCP server, CLI or agent skill, with the same API key.

