Skip to content

OPI CLI 🤓

A new way to interact with OPI's data

OPI CLI 🤓

Opioid settlement money is supposed to help people. But sometimes it gets wasted or misused…For years, our team at OPI and people like you have tracked these cases in our waste, fraud, abuse, and mismanagement database (WFAM).

Until now, you had to click around on our website to see this data or download it and deal with a massive CSV. This has all worked pretty well (we think!). And you can still do that, if you prefer, but there's an old-school techie way to quickly access and interact with large amounts of data. With our CLI tool, you can, for example, regularly check on your state's WFAM with a simple command. Or check out the unallowable spending list in your state (if it has one!). All our data is up there. We'll keep improving the tool over time, but know that the data is always up-to-date in between new features, and it's got a lot of cool stuff to start.

Admittedly, this is all super nerdy…but as part of the website redesign, we realized we have a lot of data sloshing around, and it's a good opportunity to roll out some new features.

And we're nerds…so, ya.

Here is how to start with the OPI CLI tool, even if you have never done this before.

Try the OPI CLI on your computer in 3 steps

Step 1: Install Node. It is free.

Node is a small, free program that runs the tool in your terminal.
Open the link below to find your installer. Pick the button that says “LTS.”
Install it like any other app.
Download Node.js (v18+).

Or

Run one of these commands in your terminal:

  • Windows: winget install OpenJS.NodeJS.LTS
  • Apple: brew install node
  • Linux: sudo apt install nodejs npm

Step 2: Open your terminal (or keep it open if you used it to install Node).

Open your terminal:
- Windows: click Start, type PowerShell, and press Enter.
- Apple: press Command and the spacebar, type Terminal, and press Enter.

A plain window opens. That's your terminal! It's where you type commands!

Step 3: Type one line and press Enter.

npx opioidpolicy

The first time, your computer downloads the tool.
Then it shows a menu of everything you can do.
That is it.
You are in!
Now you just need to type commands to get access to various pieces of OPI data!
Try opi help

Jacking into the matrix

What does “type a command” mean?

If you're still reading, we got you!

A command is a short instruction you type into the terminal on your computer.

You do not need to be a coder. You can copy a line, paste it, and press Enter. Many terminals save commands, so if you hit the up arrow, you can find old commands that you used.

We use Warp for terminal commands, but you don't need special software (and we don't pay for it). Every computer has a terminal!

Want to try the CLI with zero setup?
Visit our browser version and type help to start exploring.

Fun things to try

Copy any line below, paste it, and press Enter.

See the welcome screen:

opi

or

npx opioidpolicy

See the WFAM big picture:

opi wfam stats

or

npx opioidpolicy wfam stats

See flagged WFAM in your state.

opi wfam MI

or

npx opioidpolicy wfam MI

Change MI to your two-letter state code!

Read OPI's 8 simple rules for spending settlement money well:

opi opioid-settlement --quick-rules

or

npx opioidpolicy opioid-settlement --quick-rules

Walk through the F.I.T. test Tony developed. This is a quick way to judge whether a spending idea is a good one:

opi opioid-settlement --fit-test

or

npx opioidpolicy opioid-settlement --fit-test

Tired of typing npx opioidpolicy every time?
Install the OPI CLI with npm i -g opioidpolicy.
After that you can just type opi. For example: opi wfam stats.

Need help? The tool can explain itself.

opi help
opi help wfam

or

npx opioidpolicy help
npx opioidpolicy help wfam

help lists every command. help wfam, or help plus any command name, shows what that one does, with examples.

A Full Cheat Sheet

Get help

opi help                  list every command
opi help wfam             details for one command (works for any)
opi examples              example commands to copy

Settlement guidance

opi opioid-settlement --quick-rules                  OPI's 8 spending rules
opi opioid-settlement --fit-test                     the F.I.T. test
opi opioid-settlement --decision-matrix              decision grids
opi opioid-settlement --transparency-best-practices  8 transparency standards
opi opioid-settlement --policy-briefs                where to read briefs

OPI projects and research

opi projects              every OPI project
opi whitepapers           research papers (PDFs)

WFAM database (waste, fraud, abuse, mismanagement)

opi wfam stats            totals: dollars documented and record count
opi wfam MI               one state (use your 2 letter code)
opi wfam all              every record
opi wfam --search "drone" search the records

Unallowable spending

opi unallowable-spending MI                  flagged spending in a state
opi unallowable-spending MI law-enforcement  police spending only
opi unallowable-spending all                 everything flagged

AG accountability

opi accountability MI     your state's reporting path

Tip: If you have not installed the tool, start any command with npx opioidpolicy. For example: npx opioidpolicy wfam stats. Or install it once with npm i -g opioidpolicy and just type opi when you open your terminal.

Enjoy!

Support Us

Watchdog Research and Advocacy Work

Contribute ❤️

Why Trust Us?

Jonathan Stoltman, PhD
Jonathan has worked as a researcher and advocate focusing on opioid addiction treatment and recovery since 2013. He completed his PhD in Lifespan Developmental Psychology from West Virginia University in 2019. Jonathan’s academic work has appeared in leading journals, conferences, and media outlets. He has been working on opioid settlement-related topics since 2020.

Why You Can Trust OPI

The Opioid Policy Institute exists to help communities improve their response to opioid-related death and disease. We provide evidence-based research and analysis that translates complex legal guidance and public health research into practical, usable insights. Our focus is on transparency, accountability, and community healing by increasing access to evidence-based prevention, harm reduction, treatment, and recovery supports.

OPI’s analysis reflects a collaborative, team-based approach. We blend real-world and academic experience to help ensure our work is methodologically sound, grounded in evidence, and attentive to real-world implementation challenges. We focus on asking the right questions, surfacing tradeoffs, and helping communities build robust responses to addiction.

Opioid Policy Institute by Jonathan JK Stoltman, PhD is licensed under CC BY-NC-SA 4.0

Jonathan JK Stoltman (PhD)

Jonathan JK Stoltman (PhD)

Jonathan JK Stoltman, PhD is Director of the Opioid Policy Institute. They have been an addiction scientist since 2013. Their work has appeared in leading academic journals and in the media.

All articles