Skip to main content

Preflight checks for LLM prototypes.

Project description

ModelPreflight

Preflight checks for LLM prototypes.

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

CI Python versions PyPI version License LiteLLM

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.

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

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 presets are best-effort starter data, not authoritative claims about free availability. User-local config wins over bundled defaults, optional/disabled providers do not block first-run checks, and endpoint names, quotas, pricing, and behavior can change without this package knowing.

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.

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

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.

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 available, prompt or case metadata, latency, token usage when available, and response id when available.

Non-goals

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

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.4.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.4-py3-none-any.whl (16.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: model_preflight-0.1.4.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.4.tar.gz
Algorithm Hash digest
SHA256 35d4d49bb52550f8cbc74727a298acdf5acb39602b17843b14ad2f96bfce75b9
MD5 53ab92b0a12e117a933fd707d251bcd0
BLAKE2b-256 e5809baee455cffb68c281134c7839887604730fd171729c4a70e157e933f6ad

See more details on using hashes here.

File details

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

File metadata

  • Download URL: model_preflight-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 16.2 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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 bbafe0fc07648a3fba0d220fec0efc2c11ab8dd4beaeb6a6bd7f3999d8484872
MD5 77b9870ce2478ab98c73badb7e66552b
BLAKE2b-256 310890d04fd1672b5fddc92bcf93571ab3cd61e415a5f304bfd199541b3a793c

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