---
type: Reference
title: CLI reference
description: Subcommands, flags, input formats, and exit codes for the what-if binary.
status: stable
tags: [reference, cli, flags]
---

# CLI reference

## Persistent flags

| Flag | Purpose |
|---|---|
| `--config <path>` | Explicit TOML config file path |
| `--base-url <url>` | Override upstream endpoint base URL |
| `--wire <mode>` | Override wire (`auto`, `systemone`, `openai`, `openrouter`, `liquid`) |
| `--model <id-or-tier>` | Override model or semantic tier |
| `--media-root <dir>` | Allowed media root directory (repeatable) |

## Subcommands

| Command | Purpose | Notable flags |
|---|---|---|
| `what-if mcp` | Run MCP server over `stdio` | Zero stdout logging; logs go to `stderr` |
| `what-if serve` | Run Streamable HTTP MCP server at `/_/mcp` | `--listen` (default `127.0.0.1:8790`) |
| `what-if ask` | Evaluate one state and optional media files | `--state` (`@file` or `-`), `--media`, `--noul`, `--choice`, `--score`, `--questions-file`, `--min-confidence`, `--fail-uncertain`, `--json` |
| `what-if compare` | Compare 2 to 16 counterfactual scenarios | `--base-state`, `--scenario name=@file`, `--noul`, `--choice`, `--score`, `--questions-file`, `--min-confidence`, `--fail-uncertain`, `--json` |
| `what-if rerank` | Rank documents against a query | `--query`, `--doc`, `--docs-file`, `--top-n`, `--return-documents`, `--json` |
| `what-if models` | Show configured tiers and live upstream models | `--no-upstream`, `--json` |
| `what-if doctor` | Validate config, media roots, `ffmpeg`, and upstream connectivity | `--json` |
| `what-if version` | Print build version, commit, and timestamp | None |

`ask` and `compare` exit with status `2` when `--fail-uncertain` is set and any returned answer has `uncertain: true`.
