Skip to main content

Preflight checks for LLM prototypes.

Project description

ModelPreflight

Preflight checks for LLM prototypes.

A tiny local gateway for smoke tests, provider failover, and cheap prototype checks before you wire an LLM into something bigger.

CI Python versions PyPI version License LiteLLM

ModelPreflight hero image
If you want to... Start here
Get one green check quickly 60-second start
Try it without keys No-key demo path
Configure provider groups once Machine-local config
Run project smoke cases Smoke tests
Fan out a one-off prompt Pro Mode
Use it as a Python helper Library usage

ModelPreflight keeps provider setup machine-local and keeps smoke cases project-local. It gives prototypes stable model-group aliases, simple failover, and JSONL audit logs without becoming a benchmark harness or hosted gateway.


Why this repo exists

Early LLM prototypes often need a quick answer to a practical question: "Can this prompt, model group, or provider route work well enough to keep building?"

ModelPreflight gives you a lightweight layer for that stage:

  • one global config for provider credentials and routing
  • project-local JSONL smoke cases
  • stable aliases such as free_reasoning and free_fast
  • best-effort failover through LiteLLM
  • audit records for live calls
When to use it

Use ModelPreflight when:

  • a prototype needs cheap LLM smoke checks before deeper eval work
  • several projects should share the same local provider setup
  • you want logical groups instead of hard-coding provider/model IDs everywhere
  • provider quotas, model slugs, or dev-tier availability may drift
  • you need enough provenance to debug "which model answered this?"
What it is not

ModelPreflight is not:

  • a model leaderboard
  • a formal benchmark framework
  • a hosted inference gateway
  • a provider catalog authority
  • proof that an endpoint is free, fast, or available today

Bundled provider presets are starter data. Check each provider's current catalog and terms before relying on a route.

60-second start

uvx model-preflight --help

# In a persistent tool or project environment:
uv tool install model-preflight
# or:
pipx install model-preflight

Pick one provider, set one key, and run one live check:

mpf init --provider openrouter
export OPENROUTER_API_KEY=...
mpf doctor --live
mpf demo

Add checks to a project:

cd my-project
mpf init-project
mpf run

Both mpf and model-preflight are installed as console scripts.

ModelPreflight catches missing keys, broken provider routes, prompt formatting regressions, output-shape drift, accidental model/provider changes, and "this worked yesterday" prototype failures before you wire the LLM call into something larger.

No-key demo path

Use the minimal offline preset when you want to test the CLI and project workflow without a provider account:

mpf init --preset minimal
mpf doctor --live
mpf demo
mpf init-project
mpf run
Install options

PyPI or isolated tool install

uv tool install model-preflight
# or:
pipx install model-preflight
mpf --help

Project dependency

uv add --dev model-preflight
# or:
pip install model-preflight

Editable checkout

git clone https://github.com/pylit-ai/model-preflight.git
cd model-preflight
uv pip install -e .
# or from another repo:
uv add --dev --editable /absolute/path/to/model-preflight

ModelPreflight requires Python 3.11+.


Machine-local config

ModelPreflight reads provider routes from ~/.config/model-preflight/config.yaml by default. Override the path with either --config or MODEL_PREFLIGHT_CONFIG.

mpf init --provider openrouter
mpf doctor
mpf models

The default config creates logical groups, then maps each group to one or more LiteLLM deployments:

router:
  num_retries: 1
  timeout_seconds: 60
  default_group: free_reasoning
  audit_jsonl: null
artifacts_dir: ~/.cache/model-preflight/artifacts

deployments:
  - name: openrouter_gpt_oss_120b_free
    provider: openrouter
    group: free_reasoning
    model: openrouter/openai/gpt-oss-120b:free
    api_key_env: OPENROUTER_API_KEY
    enabled: true
    required: true
    status: best_effort
    setup_url: https://openrouter.ai/docs/api-reference/authentication
    rpm: 18
    tier: reasoning
Provider preset discipline

Provider presets are best-effort starter data, not authoritative claims about free availability.

  • user-local config wins over bundled defaults
  • mpf doctor fails fast when required keys are missing
  • optional/disabled providers do not block first-run checks
  • live checks should be opt-in in CI
  • endpoint names, quotas, pricing, and behavior can change without this repo knowing

See docs/PROVIDER_PRESETS.md for the preset rules.

Custom config path
mpf init --config ./model-preflight.yaml
mpf doctor --config ./model-preflight.yaml
mpf doctor --config ./model-preflight.yaml --live

export MODEL_PREFLIGHT_CONFIG="$PWD/model-preflight.yaml"
mpf models

Use environment variables for secrets. Do not commit provider keys.


Smoke tests

Smoke cases are JSONL files owned by the project that is doing the prototype work.

{"id":"basic-ok","prompt":"Return only: ok","expected_substrings":["ok"]}
{"id":"avoid-word","prompt":"Answer yes without using the word nope","forbidden_substrings":["nope"]}

Run them with:

mpf run
# or:
mpf run path/to/smoke_cases.jsonl

mpf run prints JSON results and exits non-zero if any case fails.

Case fields

Each smoke case supports:

  • id: stable case identifier
  • prompt: user prompt sent to the configured model group
  • group: optional model group override
  • expected_substrings: strings that must appear in the answer
  • forbidden_substrings: strings that must not appear in the answer

These checks are intentionally simple. They are meant to catch obvious routing, prompt, and regression problems before you spend time on heavier evals.


Pro Mode

mpf pro fans out a one-off prompt, then synthesizes a final answer through a judge group.

mpf pro "Suggest three robust JSON schemas for this toy extraction task" --n 8

Defaults:

Option Default Role
--n 8 number of sampled answers
--sample-group free_fast fanout group
--judge-group free_reasoning synthesis group
Cost and quota note

Fanout multiplies live provider calls. Keep --n low while testing, use restricted provider keys where available, and review provider dashboards when running against paid endpoints.

ModelPreflight records audit rows for live calls, but it does not enforce provider billing limits beyond your configured routing and provider-side controls.


Library usage

from model_preflight import ModelGateway, load_config, pro_mode

gateway = ModelGateway(load_config())

print(gateway.text("Return only: ok", group="free_reasoning"))

result = pro_mode(gateway, "Solve this toy puzzle", n=8)
print(result["final"])

The library API is intentionally thin:

  • load_config() reads the same machine-local config as the CLI
  • ModelGateway wraps LiteLLM Router with stable group aliases and audit logging
  • pro_mode() runs fanout plus synthesis for one-off prototype prompts

Audit artifacts

By default, ModelPreflight writes audit logs under:

~/.cache/model-preflight/artifacts/audit.jsonl

Each live call should be traceable enough to debug provider drift:

  • timestamp
  • logical group
  • resolved provider/model when returned by the provider
  • prompt or case metadata
  • latency
  • token usage when available
  • response id when available

See docs/EVAL_PROVENANCE.md for provenance expectations.


Repo adapters

Path Purpose
examples/autoharness_provider.py Drop-in provider wrapper for AutoHarness-style experiments
examples/gpt_pro_mode_refactor.py Example refactor from single-provider Pro Mode to shared routing
examples/node_hook_example.mjs CLI bridge for JS or agent-hook projects
skills/model-preflight/SKILL.md Optional coding-agent skill for consistent usage
Command reference
mpf init --provider openrouter
mpf doctor --live
mpf demo
mpf init-project
mpf run
mpf providers list
mpf providers guide openrouter
mpf models
mpf pro "solve this toy task" --n 8
Contributor workflow
uv sync
uv run pytest
uv run ruff check .
uv run mypy src

Package metadata lives in pyproject.toml. Tests live under tests/.


Design principles

  • Global provider/auth/routing lives in ~/.config/model-preflight/config.yaml.
  • Project-local checks define cases, scoring, fixtures, and artifacts.
  • LiteLLM handles provider-specific API quirks.
  • ModelPreflight adds stable aliases, lightweight failover, and audit logs.
  • Deterministic tests should run before live provider checks.

For the product scope and non-goals, see docs/NORTHSTAR.md.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

model_preflight-0.1.3.tar.gz (1.5 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

model_preflight-0.1.3-py3-none-any.whl (18.0 kB view details)

Uploaded Python 3

File details

Details for the file model_preflight-0.1.3.tar.gz.

File metadata

  • Download URL: model_preflight-0.1.3.tar.gz
  • Upload date:
  • Size: 1.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for model_preflight-0.1.3.tar.gz
Algorithm Hash digest
SHA256 41a395480454d0959eefc8618176ba123ad2f65e315f8114bfdd463ca090f0e6
MD5 99315e5c5b8790b31577076dca798096
BLAKE2b-256 6992a01443ff44d499e291847f5bff0b286c0bf58acb9f67607109b714ea1fae

See more details on using hashes here.

File details

Details for the file model_preflight-0.1.3-py3-none-any.whl.

File metadata

  • Download URL: model_preflight-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 18.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.8 {"installer":{"name":"uv","version":"0.11.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for model_preflight-0.1.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d31efb8e1eb6be0f7a4dd9774d78efc381321342c230356b8ad2be1e29a57093
MD5 fca5b6d8d41c4a0cfd034cc898366c41
BLAKE2b-256 4353f66cf0a39520cf989583055fa0d2ad31e1e309abd6821643f316c381a2c7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page