Credentials. Keep provider API keys in environment variables and out of committed config files.
Who it is forA developer choosing between two prompts or two models for a feature.
The problemPicking a prompt by eyeballing a few outputs is slow and misses regressions.
The outcomeA side-by-side table of outputs and pass or fail results for each prompt and model.
What you need first
- Node.js for npm, or Homebrew, or pip; npx works without installing
- API keys for the LLM providers you test, set as environment variables
- Only run red teaming against apps you own or are authorised to test
Steps
- Install with
npm install -g promptfoo, orbrew install promptfoo, or usenpx promptfoo@latest - Create a starter project with
promptfoo init --example getting-started - Set your provider key, for example
export OPENAI_API_KEY=sk-abc123with your real key - Run
cd getting-startedthenpromptfoo eval - Open the results with
promptfoo view
Prompt for your agent
Install promptfoo/promptfoo, set up an eval comparing <prompt A> and <prompt B> on <model A> and <model B> with <test cases>, run it and open the viewer. Tell me which combination passes the most tests.
Caveat. Evals run locally, but each test still calls the model provider you configure, which may cost money.
Use this in your AI agent
Ask your agent
Using the Deduped MCP, get the setup steps for promptfoo/promptfoo and "Compare prompts and models with automated evals"
Add Deduped to Claude Code once
claude mcp add --transport http deduped https://dedupedai.com/mcp
Every Monday: the 5 hottest repos and exactly how to use them. Free, one email a week, unsubscribe anytime.
Get them freeShare: X LinkedIn Hacker News Email Copy link
Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer