llm-preflight 2.0.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. llm_preflight-2.0.0/.env.example +8 -0
  2. llm_preflight-2.0.0/CHANGELOG.md +141 -0
  3. llm_preflight-2.0.0/LICENSE +21 -0
  4. llm_preflight-2.0.0/MANIFEST.in +18 -0
  5. llm_preflight-2.0.0/PKG-INFO +228 -0
  6. llm_preflight-2.0.0/README.md +196 -0
  7. llm_preflight-2.0.0/SECURITY.md +30 -0
  8. llm_preflight-2.0.0/benchmark.auto.example.json +80 -0
  9. llm_preflight-2.0.0/benchmark.example.json +76 -0
  10. llm_preflight-2.0.0/examples/custom-contracts/content-rule.json +26 -0
  11. llm_preflight-2.0.0/examples/custom-contracts/intent-routing.json +27 -0
  12. llm_preflight-2.0.0/examples/custom-contracts/ticket-extraction.json +37 -0
  13. llm_preflight-2.0.0/llm_bench/__init__.py +3 -0
  14. llm_preflight-2.0.0/llm_bench/capability_ledger.py +98 -0
  15. llm_preflight-2.0.0/llm_bench/catalog.py +424 -0
  16. llm_preflight-2.0.0/llm_bench/catalog_probe.py +40 -0
  17. llm_preflight-2.0.0/llm_bench/catalog_watch.py +137 -0
  18. llm_preflight-2.0.0/llm_bench/cli.py +1806 -0
  19. llm_preflight-2.0.0/llm_bench/client.py +600 -0
  20. llm_preflight-2.0.0/llm_bench/env.py +29 -0
  21. llm_preflight-2.0.0/llm_bench/features.py +449 -0
  22. llm_preflight-2.0.0/llm_bench/metrics.py +137 -0
  23. llm_preflight-2.0.0/llm_bench/presets.py +66 -0
  24. llm_preflight-2.0.0/llm_bench/pricing.py +99 -0
  25. llm_preflight-2.0.0/llm_bench/profiles.py +319 -0
  26. llm_preflight-2.0.0/llm_bench/redaction.py +79 -0
  27. llm_preflight-2.0.0/llm_bench/runner.py +1203 -0
  28. llm_preflight-2.0.0/llm_bench/security.py +34 -0
  29. llm_preflight-2.0.0/llm_preflight.egg-info/PKG-INFO +228 -0
  30. llm_preflight-2.0.0/llm_preflight.egg-info/SOURCES.txt +35 -0
  31. llm_preflight-2.0.0/llm_preflight.egg-info/dependency_links.txt +1 -0
  32. llm_preflight-2.0.0/llm_preflight.egg-info/entry_points.txt +3 -0
  33. llm_preflight-2.0.0/llm_preflight.egg-info/requires.txt +14 -0
  34. llm_preflight-2.0.0/llm_preflight.egg-info/top_level.txt +1 -0
  35. llm_preflight-2.0.0/pyproject.toml +51 -0
  36. llm_preflight-2.0.0/setup.cfg +4 -0
  37. llm_preflight-2.0.0/setup.py +18 -0
@@ -0,0 +1,8 @@
1
+ # Copy this file to .env.production beside your benchmark configuration.
2
+ # Fill only the providers you use. Never commit .env.production.
3
+
4
+ OPENAI_API_KEY=""
5
+ ANTHROPIC_API_KEY=""
6
+ GEMINI_API_KEY=""
7
+ OPENROUTER_API_KEY=""
8
+ XAI_API_KEY=""
@@ -0,0 +1,141 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project are documented here.
4
+
5
+ ## 2.0.0 - 2026-07-16
6
+
7
+ ### Changed
8
+
9
+ - Rename the project and primary PyPI distribution to **LLM Preflight**
10
+ (`llm-preflight`): a local, cross-provider preflight for a model switch.
11
+ - Make `llm-preflight` the primary command while retaining `llm-bench` and the
12
+ `llm_bench` Python import namespace as supported compatibility interfaces.
13
+ - Update public documentation, examples, package artifacts, and release
14
+ automation to use the new product name and primary command.
15
+
16
+ ## 1.2.2 - 2026-07-16
17
+
18
+ ### Fixed
19
+
20
+ - Keep plain-prompt validation results in model summaries, quality gates, and
21
+ recommendation ranking so an invalid output can never pass or be recommended.
22
+ - Reject unknown validation keys and support explicit exact-match validation in
23
+ ordinary and starter configurations.
24
+ - Calculate request and retry-expanded cost limits from every profile case,
25
+ warmup, prompt override, and output limit.
26
+ - Preserve per-model results when client setup, runtime URL validation, or a
27
+ request worker fails instead of aborting the benchmark.
28
+ - Keep transient catalogue probe failures retryable; only structured stable
29
+ incompatibility evidence changes a model's catalogue classification.
30
+ - Measure successful request latency and time-to-first-token per final attempt,
31
+ excluding retry backoff, and apply the same retry policy to Responses API
32
+ requests.
33
+ - Gate CI comparisons on configured cost regressions, reject ambiguous custom
34
+ prompt names and empty `contains` rules, and make numeric-only checks reject
35
+ explanatory or contradictory output.
36
+ - Keep interactive catalogue comparisons head-to-head with selected approved
37
+ models; require a distinct paid-run confirmation even after a stray `y` at
38
+ the stop-mode prompt; preserve discovery deltas when a candidate run fails.
39
+ - Prefer authoritative ready-text catalogue evidence over model-name heuristics
40
+ and redact Gemini and xAI key formats from all terminal, JSON, candidate-plan,
41
+ and result output.
42
+ - Preserve transport retries by classifying socket failures by exception type;
43
+ bootstrap a catalogue snapshot only after a successful first candidate run.
44
+ - Gate CI comparisons on validation-rate regressions as well as latency,
45
+ request success, and cost; reject legacy built-in test aliases as custom
46
+ prompt names.
47
+ - Keep `all` in catalogue review to the four inexpensive functional checks,
48
+ protect invalid-scheme URL errors from credential echoes, and harden local
49
+ workspace, exact-model-selection, approval-file, and query-encoding edges.
50
+
51
+ ## 1.2.1 - 2026-07-16
52
+
53
+ ### Fixed
54
+
55
+ - Keep the credential-free `.env.production` template created by `catalog init`
56
+ identical to the checked-in `.env.example` template.
57
+
58
+ ## 1.2.0 - 2026-07-16
59
+
60
+ ### Added
61
+
62
+ - Add the local model lifecycle: `catalog init`, `catalog refresh`, and
63
+ `catalog prepare`, followed by the normal interactive benchmark flow and
64
+ explicit `models approve` promotion.
65
+ - Add local catalogue snapshots and model-change diffs; retain `watch-new` and
66
+ `approve-model` as compatibility aliases.
67
+ - Add interactive `--approve-to` promotion, explicit retry-risk acceptance,
68
+ and candidate-plan `--replace` protection.
69
+ - Classify catalogue entries as ready text benchmarks, text candidates needing
70
+ one explicit probe, or incompatible generic-text endpoints using provider and
71
+ OpenRouter capability evidence.
72
+ - Add `catalog probe` and a local, permission-restricted capability ledger that
73
+ records only safe compatibility evidence, never response text or credentials.
74
+ - Add `--migration-check`: a one-repetition, no-warmup three-case response and
75
+ basic-contract preflight for comparing a candidate model with an incumbent.
76
+ - Add a custom-contract tutorial and runnable mock examples for JSON extraction,
77
+ exact intent routing, and required-content validation.
78
+ - Rename default test packs around their user value: quick migration, exact
79
+ routing, structured output, numeric instruction, and concurrency health.
80
+ Keep the former selectors as compatibility aliases.
81
+
82
+ ### Fixed
83
+
84
+ - Refuse a concurrent benchmark targeting the same results directory before it
85
+ can issue duplicate paid requests.
86
+ - Migrate legacy catalogue snapshots without reporting every model as changed
87
+ solely because richer capability metadata was introduced.
88
+
89
+ ## 1.0.3 - 2026-07-13
90
+
91
+ ### Changed
92
+
93
+ - Keep internal agent, roadmap, launch, and release-runbook material out of
94
+ public source distributions.
95
+ - Restrict source artifacts to runtime code, package metadata, user-facing
96
+ documentation, and example configuration files.
97
+
98
+ ## 1.0.2 - 2026-07-13
99
+
100
+ ### Added
101
+
102
+ - Add `llm-bench --init` to create a safe, deterministic no-key mock benchmark
103
+ without overwriting an existing configuration.
104
+ - Visually separate interactive setup stages and final terminal results,
105
+ quality-gate, and decision sections.
106
+ - Render `--dry-run` as a readable terminal plan by default; retain JSON output
107
+ with `--json` for automation.
108
+ - State the qualified recommendation explicitly and show the interactive
109
+ command after `--init` creates a mock configuration.
110
+
111
+ ### Fixed
112
+
113
+ - Exclude models that fail any selected test from fastest, cheapest, and
114
+ best-value recommendations; list them with their failed test instead.
115
+ - Correct smoke-mode documentation: it reduces repetitions and warmups, but
116
+ does not suppress selected profile-case or load-test expansion.
117
+
118
+ ## 1.0.1 - 2026-07-13
119
+
120
+ ### Fixed
121
+
122
+ - Handle Ctrl-C cleanly with exit code `130` and without writing artifacts.
123
+
124
+ ## 1.0.0 - 2026-07-13
125
+
126
+ ### Added
127
+
128
+ - Cross-provider smoke testing, discovery, deterministic validators, reports,
129
+ pricing checks, retry diagnostics, and CI-oriented controls.
130
+ - A mock-provider quickstart and `--no-save` for no-key and CI workflows.
131
+ - Retry jitter plus nominal and retry-expanded request/cost planning.
132
+
133
+ ### Security
134
+
135
+ - Redact all custom request-header values from result artifacts and output.
136
+ - Enforce configured cost ceilings only when complete pricing is available.
137
+
138
+ ### Fixed
139
+
140
+ - Apply CLI `--tests` selections to budget enforcement.
141
+ - Keep the static type-check security gate green.
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 LLM Preflight contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,18 @@
1
+ include .env.example
2
+ include CHANGELOG.md
3
+ include LICENSE
4
+ include README.md
5
+ include SECURITY.md
6
+ include benchmark.auto.example.json
7
+ include benchmark.example.json
8
+ recursive-include examples *.json
9
+
10
+ exclude AGENTS.md
11
+ exclude CONTRIBUTING.md
12
+ exclude LAUNCH.md
13
+ exclude Makefile
14
+ exclude RELEASING.md
15
+ prune docs
16
+ prune .github
17
+ prune tests
18
+ prune legacy-pypi-shim
@@ -0,0 +1,228 @@
1
+ Metadata-Version: 2.4
2
+ Name: llm-preflight
3
+ Version: 2.0.0
4
+ Summary: Local, cross-provider preflight checks for an LLM model switch
5
+ License-Expression: MIT
6
+ Keywords: llm,preflight,model-switch,validation,openai,anthropic,gemini
7
+ Classifier: Development Status :: 3 - Alpha
8
+ Classifier: Environment :: Console
9
+ Classifier: Operating System :: OS Independent
10
+ Classifier: Programming Language :: Python :: 3
11
+ Classifier: Programming Language :: Python :: 3.10
12
+ Classifier: Programming Language :: Python :: 3.11
13
+ Classifier: Programming Language :: Python :: 3.12
14
+ Classifier: Programming Language :: Python :: 3.13
15
+ Classifier: Topic :: System :: Benchmark
16
+ Requires-Python: >=3.10
17
+ Description-Content-Type: text/markdown
18
+ License-File: LICENSE
19
+ Provides-Extra: dev
20
+ Requires-Dist: coverage>=7; extra == "dev"
21
+ Requires-Dist: pytest>=7; extra == "dev"
22
+ Requires-Dist: ruff>=0.15; extra == "dev"
23
+ Provides-Extra: audit
24
+ Requires-Dist: bandit>=1.9; extra == "audit"
25
+ Requires-Dist: detect-secrets>=1.5; extra == "audit"
26
+ Requires-Dist: mypy>=1.19; extra == "audit"
27
+ Provides-Extra: release
28
+ Requires-Dist: build>=1.2; extra == "release"
29
+ Requires-Dist: twine>=6; extra == "release"
30
+ Dynamic: license-file
31
+ Dynamic: requires-python
32
+
33
+ # LLM Preflight
34
+
35
+ Know whether a model change is safe before it reaches production. LLM Preflight
36
+ runs a small local preflight across providers and compares validated
37
+ output, response speed, tokens, and estimated cost.
38
+
39
+ It is a local preflight tool—not a hosted evaluation platform, tracing system,
40
+ RAG framework, or public leaderboard. Its results are evidence for your
41
+ account, network, prompts, and validation rules.
42
+
43
+ Formerly **LLM Speed Bench**. The primary command is `llm-preflight`;
44
+ `llm-bench` remains a supported compatibility command. See the
45
+ [migration guide](docs/migrating-to-llm-preflight.md).
46
+
47
+ > [!WARNING]
48
+ > Live benchmarks make paid API requests. Start with the no-key demo, preview
49
+ > the plan before a live run, and keep limits and repetitions small.
50
+
51
+ ## Try it in 60 seconds
52
+
53
+ Create and run a deterministic local benchmark—no API key or network request:
54
+
55
+ ```bash
56
+ llm-preflight --init
57
+ llm-preflight benchmark.json --no-save
58
+ ```
59
+
60
+ From a source checkout:
61
+
62
+ ```bash
63
+ python3 -m llm_bench.cli --init
64
+ python3 -m llm_bench.cli benchmark.json --no-save
65
+ ```
66
+
67
+ `--init` never overwrites an existing config. It creates a mock benchmark so
68
+ you can see the report and exit behavior before making a paid request.
69
+
70
+ ## Use it when
71
+
72
+ - You are switching models or providers.
73
+ - A provider publishes a new model or changes a `latest` alias.
74
+ - You need to compare your own prompt's validity, latency, and cost.
75
+ - You want local result artifacts instead of a hosted dashboard.
76
+
77
+ It measures deterministic test validity, end-to-end latency (p50/p95), time to
78
+ first token, throughput when usage is available, token totals, and estimated
79
+ cost. Result files retain request metadata and per-request observations for
80
+ reproducibility.
81
+
82
+ ## First live run
83
+
84
+ Python 3.10+ is required; there are no runtime dependencies.
85
+
86
+ ```bash
87
+ cp benchmark.example.json benchmark.json
88
+ cp .env.example .env.production
89
+ # Edit benchmark.json and add only the provider keys you use.
90
+ python3 -m llm_bench.cli benchmark.json --dry-run
91
+ python3 -m llm_bench.cli benchmark.json
92
+ ```
93
+
94
+ The CLI reads `.env.production` beside the config without overriding environment
95
+ variables already set by your shell. Use `--no-env-file` or `--env-file PATH`
96
+ when needed. Runs print a terminal report and, unless `--no-save` is used,
97
+ write JSON and Markdown results under `results/`.
98
+
99
+ Install the command globally in a virtual environment if preferred:
100
+
101
+ ```bash
102
+ python3 -m pip install llm-preflight
103
+ llm-preflight --init
104
+ ```
105
+
106
+ Run `--doctor` and `--dry-run` before the final command. They make no generation
107
+ requests; the final command is the paid work.
108
+
109
+ ## Change a model safely
110
+
111
+ This is the core workflow. Put your approved model and candidate model in one
112
+ config, then run the small response-and-contract preflight:
113
+
114
+ ```bash
115
+ llm-preflight benchmark.json --migration-check --dry-run
116
+ llm-preflight benchmark.json --migration-check
117
+ ```
118
+
119
+ It sends three short representative cases to each selected model, once each.
120
+ It answers: did the API work, did each response meet the basic contract, and
121
+ how quickly did the provider start and finish responding? It is a cheap
122
+ compatibility check, not a statistical performance conclusion.
123
+
124
+ When that passes, run the task-specific checks that match your application—for
125
+ example `exact-routing-check` or `structured-output-check`—before approving a
126
+ switch.
127
+ Use [custom contract tests](docs/custom-tests.md) to express the outputs your
128
+ own feature must preserve.
129
+
130
+ ## Choose your path
131
+
132
+ **I am new and want to see the tool safely.** Start with the
133
+ [Getting started guide](docs/getting-started.md). It uses a no-key local mock
134
+ before any provider request.
135
+
136
+ **I know the current and candidate model IDs.** Edit one config, run the
137
+ [migration check](#change-a-model-safely), then add a
138
+ [custom contract test](docs/custom-tests.md) for the output your feature must
139
+ preserve. You do not need the catalogue.
140
+
141
+ **I want to find and review provider releases.** Use the local catalogue
142
+ lifecycle below. It keeps broad provider metadata separate from the small set
143
+ of models you approve for ongoing testing.
144
+
145
+ ```bash
146
+ llm-preflight catalog init
147
+ llm-preflight catalog refresh benchmarks/watch.json
148
+ # If a model is shown as “Needs one probe”, review and confirm a minimal request:
149
+ llm-preflight catalog probe benchmarks/watch.json
150
+ llm-preflight catalog prepare benchmarks/watch.json \
151
+ --against benchmarks/approved.json --output benchmarks/candidates.json
152
+ llm-preflight benchmarks/candidates.json --interactive \
153
+ --approve-to benchmarks/approved.json
154
+ ```
155
+
156
+ Refresh reads metadata only. A probe sends one minimal request only for text
157
+ candidates you select and confirm. The interactive benchmark then lets you
158
+ approve passing models explicitly. Follow the complete
159
+ [catalogue tutorial](docs/model-watch.md) for the decision points.
160
+
161
+ **I am automating an established contract.** Use
162
+ [CI and JSON output](docs/ci.md), with a saved baseline and `--ci` where a
163
+ regression should fail the pipeline.
164
+
165
+ ## Useful commands once you know your path
166
+
167
+ ```bash
168
+ # Inspect configuration, credentials, and model selection without generation.
169
+ llm-preflight benchmark.json --doctor
170
+ llm-preflight benchmark.json --dry-run
171
+ llm-preflight benchmark.json --pricing-check
172
+
173
+ # Run a reduced live benchmark.
174
+ llm-preflight benchmark.json --smoke
175
+
176
+ # Run a single ad hoc prompt.
177
+ llm-preflight --quick "Return only valid JSON with a status field." \
178
+ --models openai:gpt-5.4-mini
179
+ ```
180
+
181
+ For advanced discovery, interactive runs, CI, baselines, replay, and stop
182
+ modes, see [workflows](docs/workflows.md). For models, environment files,
183
+ custom prompts, and provider-specific options, see
184
+ [configuration](docs/configuration.md).
185
+
186
+ ## What makes a comparison useful
187
+
188
+ - Keep prompts, system instructions, temperature, and output limits fixed.
189
+ - Validate outputs: a fast malformed response is a failed result.
190
+ - Run from the same host; network distance and provider load affect latency.
191
+ - Treat single-user latency and load testing as separate experiments.
192
+ - Prefer dated model IDs over moving aliases.
193
+
194
+ The CLI distinguishes `API FAIL` (transport, credentials, provider, or request
195
+ failure) from `API OK / TEST FAIL` (a response that fails your validator).
196
+ Recommendations only consider models that pass every selected test.
197
+
198
+ ## Documentation
199
+
200
+ - [Getting started](docs/getting-started.md) — safe demo, first paid run, and
201
+ choosing the right workflow.
202
+ - [Workflows](docs/workflows.md) — discovery, smoke mode, CI, replay, matrix,
203
+ baselines, and request safety.
204
+ - [Configuration](docs/configuration.md) — providers, custom prompts, presets,
205
+ aliases, and environment overlays.
206
+ - [Custom contract tests](docs/custom-tests.md) — copyable JSON extraction,
207
+ exact-routing, and content-rule migration tests.
208
+ - [CLI reference](docs/cli-reference.md) — every command-line option, default,
209
+ and incompatibility.
210
+ - [Interactive mode](docs/interactive.md) — selection, paid-run preview, and
211
+ live progress.
212
+ - [CI and JSON output](docs/ci.md) — machine-readable output and exit-code
213
+ gates.
214
+ - [Result JSON schema](docs/result-schema.md) — fields for integrations and
215
+ saved benchmark evidence.
216
+ - [Model watch and approval](docs/model-watch.md) — discover, compare, and
217
+ deliberately promote, re-test, and retire provider models.
218
+ - [Troubleshooting](docs/troubleshooting.md) — installation, credentials,
219
+ catalogue, and benchmark-result recovery.
220
+ - [Tests, pricing, and safety](docs/tests-pricing-safety.md) — built-in tests,
221
+ validators, pricing confidence, retries, and sensitive data.
222
+ - [Contributing](CONTRIBUTING.md) — development setup and the TDD workflow.
223
+ - [Security](SECURITY.md) — reporting vulnerabilities.
224
+
225
+ ## Contributing and license
226
+
227
+ Contributions are welcome; see [CONTRIBUTING.md](CONTRIBUTING.md). Released
228
+ under the [MIT License](LICENSE).
@@ -0,0 +1,196 @@
1
+ # LLM Preflight
2
+
3
+ Know whether a model change is safe before it reaches production. LLM Preflight
4
+ runs a small local preflight across providers and compares validated
5
+ output, response speed, tokens, and estimated cost.
6
+
7
+ It is a local preflight tool—not a hosted evaluation platform, tracing system,
8
+ RAG framework, or public leaderboard. Its results are evidence for your
9
+ account, network, prompts, and validation rules.
10
+
11
+ Formerly **LLM Speed Bench**. The primary command is `llm-preflight`;
12
+ `llm-bench` remains a supported compatibility command. See the
13
+ [migration guide](docs/migrating-to-llm-preflight.md).
14
+
15
+ > [!WARNING]
16
+ > Live benchmarks make paid API requests. Start with the no-key demo, preview
17
+ > the plan before a live run, and keep limits and repetitions small.
18
+
19
+ ## Try it in 60 seconds
20
+
21
+ Create and run a deterministic local benchmark—no API key or network request:
22
+
23
+ ```bash
24
+ llm-preflight --init
25
+ llm-preflight benchmark.json --no-save
26
+ ```
27
+
28
+ From a source checkout:
29
+
30
+ ```bash
31
+ python3 -m llm_bench.cli --init
32
+ python3 -m llm_bench.cli benchmark.json --no-save
33
+ ```
34
+
35
+ `--init` never overwrites an existing config. It creates a mock benchmark so
36
+ you can see the report and exit behavior before making a paid request.
37
+
38
+ ## Use it when
39
+
40
+ - You are switching models or providers.
41
+ - A provider publishes a new model or changes a `latest` alias.
42
+ - You need to compare your own prompt's validity, latency, and cost.
43
+ - You want local result artifacts instead of a hosted dashboard.
44
+
45
+ It measures deterministic test validity, end-to-end latency (p50/p95), time to
46
+ first token, throughput when usage is available, token totals, and estimated
47
+ cost. Result files retain request metadata and per-request observations for
48
+ reproducibility.
49
+
50
+ ## First live run
51
+
52
+ Python 3.10+ is required; there are no runtime dependencies.
53
+
54
+ ```bash
55
+ cp benchmark.example.json benchmark.json
56
+ cp .env.example .env.production
57
+ # Edit benchmark.json and add only the provider keys you use.
58
+ python3 -m llm_bench.cli benchmark.json --dry-run
59
+ python3 -m llm_bench.cli benchmark.json
60
+ ```
61
+
62
+ The CLI reads `.env.production` beside the config without overriding environment
63
+ variables already set by your shell. Use `--no-env-file` or `--env-file PATH`
64
+ when needed. Runs print a terminal report and, unless `--no-save` is used,
65
+ write JSON and Markdown results under `results/`.
66
+
67
+ Install the command globally in a virtual environment if preferred:
68
+
69
+ ```bash
70
+ python3 -m pip install llm-preflight
71
+ llm-preflight --init
72
+ ```
73
+
74
+ Run `--doctor` and `--dry-run` before the final command. They make no generation
75
+ requests; the final command is the paid work.
76
+
77
+ ## Change a model safely
78
+
79
+ This is the core workflow. Put your approved model and candidate model in one
80
+ config, then run the small response-and-contract preflight:
81
+
82
+ ```bash
83
+ llm-preflight benchmark.json --migration-check --dry-run
84
+ llm-preflight benchmark.json --migration-check
85
+ ```
86
+
87
+ It sends three short representative cases to each selected model, once each.
88
+ It answers: did the API work, did each response meet the basic contract, and
89
+ how quickly did the provider start and finish responding? It is a cheap
90
+ compatibility check, not a statistical performance conclusion.
91
+
92
+ When that passes, run the task-specific checks that match your application—for
93
+ example `exact-routing-check` or `structured-output-check`—before approving a
94
+ switch.
95
+ Use [custom contract tests](docs/custom-tests.md) to express the outputs your
96
+ own feature must preserve.
97
+
98
+ ## Choose your path
99
+
100
+ **I am new and want to see the tool safely.** Start with the
101
+ [Getting started guide](docs/getting-started.md). It uses a no-key local mock
102
+ before any provider request.
103
+
104
+ **I know the current and candidate model IDs.** Edit one config, run the
105
+ [migration check](#change-a-model-safely), then add a
106
+ [custom contract test](docs/custom-tests.md) for the output your feature must
107
+ preserve. You do not need the catalogue.
108
+
109
+ **I want to find and review provider releases.** Use the local catalogue
110
+ lifecycle below. It keeps broad provider metadata separate from the small set
111
+ of models you approve for ongoing testing.
112
+
113
+ ```bash
114
+ llm-preflight catalog init
115
+ llm-preflight catalog refresh benchmarks/watch.json
116
+ # If a model is shown as “Needs one probe”, review and confirm a minimal request:
117
+ llm-preflight catalog probe benchmarks/watch.json
118
+ llm-preflight catalog prepare benchmarks/watch.json \
119
+ --against benchmarks/approved.json --output benchmarks/candidates.json
120
+ llm-preflight benchmarks/candidates.json --interactive \
121
+ --approve-to benchmarks/approved.json
122
+ ```
123
+
124
+ Refresh reads metadata only. A probe sends one minimal request only for text
125
+ candidates you select and confirm. The interactive benchmark then lets you
126
+ approve passing models explicitly. Follow the complete
127
+ [catalogue tutorial](docs/model-watch.md) for the decision points.
128
+
129
+ **I am automating an established contract.** Use
130
+ [CI and JSON output](docs/ci.md), with a saved baseline and `--ci` where a
131
+ regression should fail the pipeline.
132
+
133
+ ## Useful commands once you know your path
134
+
135
+ ```bash
136
+ # Inspect configuration, credentials, and model selection without generation.
137
+ llm-preflight benchmark.json --doctor
138
+ llm-preflight benchmark.json --dry-run
139
+ llm-preflight benchmark.json --pricing-check
140
+
141
+ # Run a reduced live benchmark.
142
+ llm-preflight benchmark.json --smoke
143
+
144
+ # Run a single ad hoc prompt.
145
+ llm-preflight --quick "Return only valid JSON with a status field." \
146
+ --models openai:gpt-5.4-mini
147
+ ```
148
+
149
+ For advanced discovery, interactive runs, CI, baselines, replay, and stop
150
+ modes, see [workflows](docs/workflows.md). For models, environment files,
151
+ custom prompts, and provider-specific options, see
152
+ [configuration](docs/configuration.md).
153
+
154
+ ## What makes a comparison useful
155
+
156
+ - Keep prompts, system instructions, temperature, and output limits fixed.
157
+ - Validate outputs: a fast malformed response is a failed result.
158
+ - Run from the same host; network distance and provider load affect latency.
159
+ - Treat single-user latency and load testing as separate experiments.
160
+ - Prefer dated model IDs over moving aliases.
161
+
162
+ The CLI distinguishes `API FAIL` (transport, credentials, provider, or request
163
+ failure) from `API OK / TEST FAIL` (a response that fails your validator).
164
+ Recommendations only consider models that pass every selected test.
165
+
166
+ ## Documentation
167
+
168
+ - [Getting started](docs/getting-started.md) — safe demo, first paid run, and
169
+ choosing the right workflow.
170
+ - [Workflows](docs/workflows.md) — discovery, smoke mode, CI, replay, matrix,
171
+ baselines, and request safety.
172
+ - [Configuration](docs/configuration.md) — providers, custom prompts, presets,
173
+ aliases, and environment overlays.
174
+ - [Custom contract tests](docs/custom-tests.md) — copyable JSON extraction,
175
+ exact-routing, and content-rule migration tests.
176
+ - [CLI reference](docs/cli-reference.md) — every command-line option, default,
177
+ and incompatibility.
178
+ - [Interactive mode](docs/interactive.md) — selection, paid-run preview, and
179
+ live progress.
180
+ - [CI and JSON output](docs/ci.md) — machine-readable output and exit-code
181
+ gates.
182
+ - [Result JSON schema](docs/result-schema.md) — fields for integrations and
183
+ saved benchmark evidence.
184
+ - [Model watch and approval](docs/model-watch.md) — discover, compare, and
185
+ deliberately promote, re-test, and retire provider models.
186
+ - [Troubleshooting](docs/troubleshooting.md) — installation, credentials,
187
+ catalogue, and benchmark-result recovery.
188
+ - [Tests, pricing, and safety](docs/tests-pricing-safety.md) — built-in tests,
189
+ validators, pricing confidence, retries, and sensitive data.
190
+ - [Contributing](CONTRIBUTING.md) — development setup and the TDD workflow.
191
+ - [Security](SECURITY.md) — reporting vulnerabilities.
192
+
193
+ ## Contributing and license
194
+
195
+ Contributions are welcome; see [CONTRIBUTING.md](CONTRIBUTING.md). Released
196
+ under the [MIT License](LICENSE).
@@ -0,0 +1,30 @@
1
+ # Security policy
2
+
3
+ ## Reporting a vulnerability
4
+
5
+ Do not open a public issue for a suspected vulnerability or leaked credential.
6
+ Use GitHub's private vulnerability reporting feature for this repository. If it
7
+ is unavailable, contact the repository maintainers privately.
8
+
9
+ Include the affected version, reproduction steps, impact, and any suggested
10
+ mitigation. Do not include active API keys.
11
+
12
+ ## Credential and data handling
13
+
14
+ - API keys belong in environment variables or an uncommitted
15
+ `.env.production` file.
16
+ - The CLI does not execute `.env.production` as shell code.
17
+ - Catalog output removes custom request headers.
18
+ - The local catalogue capability ledger records model compatibility outcomes and
19
+ safe request options, not probe response text or credentials; it is created
20
+ with owner-only permissions where the platform supports them.
21
+ - Result artifacts redact every custom request-header value.
22
+ - Result files can contain prompts, provider errors, model metadata, and
23
+ optionally full responses. Treat `results/` as potentially sensitive.
24
+ - Treat benchmark JSON as trusted input. It controls outbound HTTP(S)
25
+ destinations, custom headers, prompts, and provider-specific request fields.
26
+ Do not run configurations from untrusted sources without reviewing them.
27
+ - Custom provider URLs must use HTTP or HTTPS, include a host, and may not
28
+ embed credentials.
29
+ - Revoke and rotate a credential immediately if it is committed or included in
30
+ logs. Removing it from Git history is not sufficient by itself.