Metadata-Version: 2.4
Name: 2nd-opinion-cli
Version: 0.1.0
Summary: Second Opinion: a cross-referencing debate CLI where two frontier models debate, a cheaper judge rules, orchestrates, and synthesizes.
Project-URL: Homepage, https://github.com/Meaetin/2nd-opinion
Project-URL: Repository, https://github.com/Meaetin/2nd-opinion
Project-URL: Issues, https://github.com/Meaetin/2nd-opinion/issues
Author: Meaetin
License-Expression: MIT
License-File: LICENSE
Keywords: agents,anthropic,claude,cli,debate,llm,openai
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Utilities
Requires-Python: >=3.12
Requires-Dist: anthropic>=0.69
Requires-Dist: openai>=1.60
Requires-Dist: pydantic>=2.7
Requires-Dist: python-dotenv>=1.0
Requires-Dist: questionary>=2.0
Requires-Dist: rich>=13.7
Requires-Dist: typer>=0.12
Provides-Extra: dev
Requires-Dist: pytest>=8.0; extra == 'dev'
Description-Content-Type: text/markdown

# Second Opinion

A cross-referencing debate CLI. Two frontier **debater** models (e.g. Opus 4.8,
GPT 5.2) independently answer your question, then debate it — critiquing and
rebutting each other with evidence and live web search. A separate, cheaper
**judge** model (e.g. Sonnet 4.6) rules on each round, asks clarifying questions
when needed, and synthesizes the final answer with a stated confidence and any
unresolved disagreement.

Every question debates by default. For a simple lookup where you don't need a
second opinion, prefix it with `!` (or pass `--direct`) to get a single direct
answer from the judge — one cheap call, no debate.

> Agreement is the stop condition, **not** a correctness proof. Two models can
> be confidently and identically wrong, and the judge is a single point of bias
> — so every ruling is rationale-backed and the final answer states its
> confidence.

## Install

Requires Python 3.12+.

```bash
uv tool install 2nd-opinion-cli   # recommended — isolated, global `2op`
pipx install 2nd-opinion-cli      # same idea, via pipx
uvx --from 2nd-opinion-cli 2op    # run once without installing
```

Set your keys (`ANTHROPIC_API_KEY` / `OPENAI_API_KEY`) in the environment, or run
`2op apikey` to store them.

## Usage

Run `2op` to open an interactive session. Type a question to run a full debate,
prefix it with `!` for a direct single-judge answer (no debate), or use a slash
command — type `/` for an autocompleting palette:

| Command   | Description |
|-----------|-------------|
| `/help`   | List commands |
| `/models` | Choose the debater/judge models and save them |
| `/apikey` | View (masked) and add/update API keys |
| `/status` | Show current models, keys, and flags |
| `/clear`  | Clear the screen |
| `/exit`   | Leave the session (or Ctrl-D) |

For scripting, `2op -q "your question"` runs a single debate and exits (as does
any piped/non-TTY run). Set slots inline:

```bash
2op --debater-a opus-4.8 --debater-b gpt-5.2 --judge sonnet-4.6 -v -q "…"
```

## Configuration

Model selection is saved after the first run to `~/.config/secondop/config.json`
and reused silently. Re-choose with `/models` (or `-m` at launch), or override a
single slot with `--debater-a` / `--debater-b` / `--judge`.

API keys are read from the environment or a `.env` file first, then from the
config file (set via `/apikey`). Environment/`.env` values take precedence.

## Develop

```bash
python3 -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
cp .env.example .env   # then add your keys
pytest
```

## Pricing note

Model rates live in `src/secondop/config.py` and are verified against the 2026
catalog captured in `pricing/*.json`. Provider prices change — re-confirm
against the live pricing pages before relying on cost figures.
