Quickstart

Install ModelStill, define a task, record a first eval with an interval, and push it to your self-hosted dashboard.

This page takes you from nothing to one task with two scored runs, a gate decision and the same data in the dashboard. It needs Python 3.12, uv, Bun and Docker. No GPU and no model provider key.

Install

ModelStill is not on PyPI yet. Clone the repository and install the CLI from it.

Terminal
git clone <modelstill-repo-url> modelstill
uv tool install ./modelstill/python/modelstill
modelstill --help

uv tool install puts modelstill on your PATH. To use the library from Python as well, add it to your project instead: uv add ./modelstill/python/modelstill. The rest of this page runs from the root of your own project.

The core package needs only pydantic, PyYAML and SciPy. Training, Modal, LiteLLM and pytest support are optional extras (train, modal, litellm, pytest).

Define a task

A task is a folder with a spec, the system prompt and the output schema. This example classifies support tickets.

Layout
tasks/ticket-priority/
  spec.yaml
  prompts/system.md
  schemas/out.json
  data/golden.jsonl
tasks/ticket-priority/spec.yaml
task: ticket-priority
version: 1
instruction: prompts/system.md
output_schema: schemas/out.json
requirements:
  - id: correct_priority
    priority: p0
    type: label
    instruction: The priority is low, normal or urgent, as the ticket text supports it.
labelling:
  teachers:
    - {model: openai/gpt-5-mini, family: openai}
    - {model: anthropic/claude-haiku-4-5, family: anthropic}
  disagreement: human_queue
eval:
  judge: {model: google/gemini-2.5-flash, family: google}
  golden_set: data/golden.jsonl
  gate:
    metric: correct_priority
    max_regression: 0.02
    max_flip_rate: 0.01
    max_cost_ratio: 0.6
    max_p95_latency_ms: 2000
train:
  base: Qwen/Qwen3-1.7B
  method: lora
  lora_r: 16
  seeds: [1, 2, 3]
serve:
  litellm_alias: ticket-priority
  fallback: ticket-priority-cloud
  target_error: 0.05
monitor:
  canary: data/canary.jsonl
  replay_frac: 0.3

The model names are placeholders: pick your own. The judge must come from a family no teacher uses, or validation fails. Check it:

Terminal
modelstill spec validate tasks/ticket-priority/spec.yaml
modelstill spec hash tasks/ticket-priority/spec.yaml

spec hash prints the snapshot hash of the spec and the files it names. Every run and gate is tied to it. See the task spec reference.

Write a few cases

A benchmark is JSONL with an id, an input, an expected answer and optional tags.

tasks/ticket-priority/data/golden.jsonl
{"id": "t1", "input": "The checkout page returns 500 for every customer.", "expected": "urgent"}
{"id": "t2", "input": "Can you change the email on my invoice?", "expected": "normal"}
{"id": "t3", "input": "Small typo on the pricing page.", "expected": "low"}

Record a first eval

Score any callable on the cases and append the run to a history file. Here a stand-in function plays the model; in your code it calls your LLM.

record_eval.py
from pathlib import Path

from modelstill.benchmark import History, load_benchmark
from modelstill.evals import exact_match, run


def classify(ticket: str) -> str:
    return "urgent" if "500" in ticket else "normal"


benchmark = load_benchmark(Path("tasks/ticket-priority/data/golden.jsonl"))
result = run(benchmark.cases, classify, exact_match)
run_id = History(Path("history.jsonl")).record(benchmark, "rules-v1", result)
print(f"{run_id} {result.mean:.3f} [{result.low:.3f}, {result.high:.3f}]")
Terminal
uv run python record_eval.py
modelstill eval runs history.jsonl

Each run prints its mean with a 95% interval. With a handful of pass/fail cases the interval is wide, and that is the point: it tells you how little a small set proves.

Compare, accept and gate

Record a second run (change the model or the prompt), then compare the two case by case and gate the new one against the accepted baseline. Run ids can be given as a unique prefix.

Terminal
modelstill eval compare history.jsonl <before> <after>
modelstill eval accept history.jsonl <before>
modelstill report gate history.jsonl <after> --spec tasks/ticket-priority/spec.yaml \
  --previous <before> --flip-rate 1 --cost-ratio 9 --p95-latency-ms 99999 --format markdown

Flip rate, cost ratio and latency are measured outside ModelStill. Until you measure them, pass the failing worst-case values shown above: the gate then fails honestly instead of passing on numbers nobody measured. report gate exits 0 on a pass, 2 on a fail and 1 on an error.

Push it to the dashboard

Start the local stack: Postgres and ClickHouse from Docker Compose, then the API and the dashboard.

Terminal
cd modelstill
docker compose up -d
bun install
Terminal 1
cd modelstill/apps/api
MODELSTILL_API_TOKEN=$(openssl rand -hex 16) bun run dev
Terminal 2
cd modelstill/apps/website
bun run dev

Sign in at http://localhost:4323 with an emailed code (locally the code is printed in the API log), create a Read and write key under Settings > API keys, then push:

Terminal
export MODELSTILL_API_URL=http://localhost:8787
export MODELSTILL_API_TOKEN=ms_live_your_key_here
modelstill push task tasks/ticket-priority/spec.yaml
modelstill push run history.jsonl <before> --task ticket-priority
modelstill push run history.jsonl <after> --task ticket-priority
modelstill push gate history.jsonl <after> --task ticket-priority \
  --spec tasks/ticket-priority/spec.yaml --previous <before> \
  --flip-rate 1 --cost-ratio 9 --p95-latency-ms 99999

The push commands read the credential from MODELSTILL_API_TOKEN: either the API's admin token or a write API key. With the worst-case values above the gate fails, so push gate records the failed decision and exits 2. Open Tasks > ticket-priority to see the runs, the comparison and the gate report.

Without DATABASE_URL the API keeps everything in memory, including users and keys, and loses it on restart. See Authentication for a Postgres-backed setup.

Next steps

On this page