CLI reference

Every grad command, its main flags, and how the CLI finds its server and key.

grad is one static binary. Install it from the install section. Every command takes --help with examples; this page is the map.

Configuration#

Highest precedence first:

  1. --api-key and --base-url flags (flags are visible in ps, so prefer the others).
  2. --profile NAME or GRADIATED_PROFILE: a profile saved by grad login (or the local profile grad local up writes).
  3. GRADIATED_API_KEY and GRADIATED_BASE_URL.
  4. The default profile in $XDG_CONFIG_HOME/gradiated/config.json (~/.config/gradiated/config.json, mode 0600).
  5. https://api.gradiated.com.
CommandWhat it does
grad loginSave an API key for this machine, checked against the server. --api-key-stdin reads it from a pipe; --no-verify skips the check.
grad logoutRemove the saved key of the current profile.
grad config show / pathPrint the resolved base URL, key source (masked) and profile, or the config file path.

Output and exit codes#

--json on any command prints one envelope on stdout, {"ok": true, "data": ...}, or {"ok": false, "error": {"code", "message", "exit_code", "status", "request_id"}} on stderr. Run --dry-run --json in agent loops to check a run before it costs anything.

CodeMeaning
0Success.
1Error: network, server, timeout, checksum or local I/O.
2Usage error: bad flags or arguments, an invalid local file, bad config.
3Authentication or permission error (401/403).
4Not found (404).
5Conflict or validation error (409/422).
6Capability unavailable on this server (inference_unavailable, secrets_unavailable).
7A run, eval or import finished unsuccessfully (failed, cancelled; runs also stopped_budget and stopped_balance).
130Interrupted (Ctrl-C). A started run keeps going on the server.

Following a run#

grad train --wait, grad runs watch, grad runs wait and grad runs resume --wait open a full-screen view when stdin and stdout are a terminal (over SSH and in tmux too). It shows the run and its config; the phase (waiting for a GPU, starting, training, resuming from a checkpoint) with how long it has lasted, and the attempt; step and cost progress against --max-cost-usd, tokens/s and an ETA; a train/eval loss chart with the best eval marked and the learning rate; checkpoints; and an event log with interruptions and resumes, reconnects, warnings and each eval step's recipe metrics (router offload and cost saving, decision accuracy and ECE, embedding recall@k). It reconnects on its own after a dropped connection and resumes the stream where it left off. Reattached to a running run, it replays the run from its first event, so the chart shows every step (0 to the total, a few spikes clipped and marked) and the phase clock starts when the phase began. Before the first step the chart says what the run is doing, for example Waiting for a GPU (2 workers online, all busy)… or Loading the model….

KeyAction
q / Ctrl-CDetach (exit 130). The run keeps going; reattach with grad runs watch.
cCancel the run, after a y to confirm.
lShow or hide the full event log.
?Help.

When the run ends the view closes and prints the usual summary: time, tokens and cost, the eval report, the artifact and its download command. With --json, --plain or GRAD_NO_TUI=1, or when output is piped (CI logs), these commands print plain lines instead.

Data#

CommandWhat it does and its main flags
grad models listThe server's trainable catalog. --recipe keeps models that support a recipe.
grad datasets list / get NAMEList datasets or show one.
grad datasets create NAMECreate an empty dataset.
grad datasets push NAME FILEPush a JSONL file of records in batches (--batch-size, default 1000); each batch appends a version.
grad import FILE --dataset NAMEUpload a trace export (JSONL, JSON or Parquet) and import it. --format (auto, jsonl, json, parquet or a parser such as otel, langfuse), --connector, --no-wait.
grad datasets import hf REPOImport a Hugging Face dataset: --split, --config, --revision, --limit, --column FIELD=COLUMN (repeatable), --secret NAME for gated datasets, --name.
grad datasets import benchmark NAMEImport gsm8k, mmlu, mmlu_pro or arc_challenge at a pinned revision (--limit, --name).
grad datasets records NAMEPrint merged records (--version, --limit, --cursor).
grad datasets score NAME --rubric FILEScore each record's own answer with a YAML/JSON rubric; billed like an eval, and the scores become the next version. --version, --limit, --wait.
grad datasets filter NAMESave a filtered view: --score NAME>=VALUE (repeatable), --metadata KEY=VALUE, --created-after, --created-before, --ids, --version, --view.
grad imports list / status ID / wait IDInspect import jobs.
grad render NAMEPreview the chat template and loss mask: --model, --train-on last|all_assistant, --thinking auto|on|off, --limit (1–20).

Sources and secrets#

CommandWhat it does and its main flags
grad secrets set NAMECreate or replace a write-only workspace secret; the value is read from stdin. --allowed-host HOST (repeatable) names where it may be sent; the default is the public provider hosts.
grad secrets list / delete NAMEList secret names, or delete one (refused while a source uses it).
grad sources add PROVIDER --dataset NAMEConnect langfuse, langsmith, braintrust, posthog, phoenix or gradiated to a dataset: --host, --secret NAME, --project (required for Braintrust and PostHog), --schedule CRON (five-field UTC), --filter KEY=VALUE (repeatable), --sample-rate, --max-records-per-sync, --max-records-per-day, --version-interval SECS, --idempotency-key. The gradiated source is coming soon on Gradiated Cloud (501 source_unavailable until then).
grad sources listSources with their filters, schedule, status (active or paused), last sync and last error (--dataset).
grad sources show IDA source's effective filters, sampling, caps and last sync.
grad sources update IDChange it from the next sync: --filter KEY=VALUE (replaces all), --clear-filters, --schedule CRON or --no-schedule, --sample-rate, --max-records-per-sync, --max-records-per-day (0 removes a cap), --version-interval.
grad sources sync IDSync now (--full rebuilds the dataset as a new version, --wait, --timeout SECS to stop waiting while the sync goes on). Returns the running sync if there is one, and resumes a paused source.
grad sources remove IDDisconnect a source. Its dataset and versions stay.

Training#

CommandWhat it does and its main flags
grad trainPlan (--dry-run, $0) or start a run. --dataset, --name, --recipe (sft, dpo, router, decision-model, cartridge, embedding, distill, reward-model), --model, --max-cost-usd, --wait, --idempotency-key, or -f run.yaml.
grad train recipe flags--lr, --lr-scale, --epochs, --batch-size, --adapter-rank, --train-on, --thinking, --split by_session|by_group|random, --eval-fraction; router --models, --max-quality-drop; DPO --beta; router, decision and reward --rubric NAME|FILE (a score already on your records, or a rubric file as in grad eval); distill --teacher, --rollout on-policy|off-policy, --max-new-tokens, --context-file; cartridge --context-file, --num-tokens, --teacher; reward --score. Anything else: --set KEY=VALUE.
grad runs listRuns, newest first.
grad runs inspect RUNShow a run. --yaml prints a config that grad train -f re-runs: it plans the same resolved config, with the resolved lr pinned and a continued-training run's starting artifact as model.
grad runs logs RUNStep metrics; --follow streams them until the run ends, --after-step N skips earlier steps.
grad runs events RUNLifecycle events: phases, metrics, checkpoints, attempts and interruptions, warnings; --follow streams them until the run ends.
grad runs watch RUNFollow a run live: the full-screen view on a terminal, the plain readout otherwise (--timeout). Reattach to a run you detached from.
grad runs wait RUNWait for a run to finish (--timeout, default 24 hours).
grad runs cancel RUNCancel a run. A running attempt is stopped and billed. A name must match one active run (--latest picks the newest).
grad runs resume RUNResume a stopped, failed or cancelled run from its latest checkpoint. --max-cost-usd is required for a stopped_budget run; --wait; --latest when several runs share the name.
grad runs checkpoints RUNList checkpoints with step, score, best and expiry.
grad runs promote CHECKPOINTCopy a checkpoint into a new artifact (--name).

RUN is a run id or a run name. Names aren't unique: when several runs share one, commands that read a run show the newest and say so on stderr (2 runs match 'X'; showing the newest (run_…). Pass a run id to choose.; with --json, in the envelope's warnings), and cancel and resume refuse unless --latest is given. grad train warns when a run with its --name is already queued or running, and starts it anyway. grad train, grad eval, grad datasets score and grad sources add take --idempotency-key KEY, so a retried command returns what the first one created.

Evaluations#

CommandWhat it does and its main flags
grad eval --models A,B --dataset NAMEEvaluate models (catalog ids or NAME@VERSION artifacts) on a dataset. --rubric FILE (YAML/JSON), --baseline, --samples, --temperature, --max-tokens, --limit, --pass-threshold, --dataset-version, --wait, --idempotency-key.
grad eval plan ... or grad eval --dry-runEstimate tasks, model and judge calls, and cost.
grad eval list / status ID / wait IDInspect evals.
grad eval results IDPer-task results (--model).
grad eval failures IDFailing tasks for mining into a new dataset (--model, --threshold).
grad eval cancel IDCancel a queued or running eval.

Artifacts#

CommandWhat it does and its main flags
grad artifacts listArtifacts, newest first (--name).
grad artifacts inspect REFShow an artifact by id, NAME@VERSION or NAME@latest, with its provenance (run, upload or import).
grad artifacts download REFDownload, verify (SHA-256) and extract into a PEFT directory: -o DIR, --archive FILE to keep the .grad.tar.gz, --force to replace an existing directory.
grad artifacts download REF --urlPrint a presigned URL of the bundle, valid 15 minutes, instead of downloading.
grad artifacts upload PATH --base MODELRegister local weights (a directory, file or .tar.gz) as an artifact after an import worker checks them: --format (default peft_lora), --name, --no-wait. A failed check names the file and exits 5.
grad artifacts import hf://OWNER/NAME[@REV] --base MODELThe same from the Hugging Face Hub, pinned to the commit the revision resolved to: --secret NAME for gated or private repos, --format, --name.
grad artifacts delete REFDelete an artifact and its bundle. Refused (409 artifact_pinned) while a published Gradiated Cloud model version pins it.

Workspace#

CommandWhat it does
grad keys create --name N --scopes A,BCreate a scoped key; the secret is printed once. See API key scopes.
grad keys list / revoke IDList or revoke keys.
grad usageCost and tokens for a period, by kind (training, eval, scoring, labeling, teacher), with the top 5 runs and evals. --from, --to, --by day|week|month|model|recipe|kind.
grad usage listThe billed rows, newest first: --from, --to, --run RUN (with the evals it started), --eval EVAL, --kind, --limit, --cursor.
grad ui [RUN]Open the server's web UI in your browser, signed in with the current profile's key (RUN opens one run).

List commands take --limit and --cursor. Usage periods are UTC and default to this month: --from is inclusive, --to YYYY-MM-DD covers that whole day and a timestamp is exclusive.

Local stack#

grad local runs Postgres, SeaweedFS (S3), the API, a CPU trainer worker and an eval worker with Docker Compose on 127.0.0.1; the API and web UI are at http://127.0.0.1:18787. See Self-hosting.

CommandWhat it does and its main flags
grad local upPull the images, start the stack and write the local profile. --gpu adds the CUDA worker, --observability adds Prometheus and Grafana with the grad dashboards, --image-tag TAG pulls another build (sha-abc1234, 0.3.0), --build builds images from a checkout instead, --dev-models adds tiny random test models (test/tiny-qwen3, test/tiny-qwen3-teacher, test/tiny-bert) and a CPU inference endpoint that serves them, artifacts trained on them and the test/tiny-judge judge to evals, for trying the workflow (train, eval, compare) on a laptop, --port, --no-wait, --timeout. It writes only the local profile, and refuses when --profile or GRADIATED_PROFILE selects a profile for another server.
grad local statusContainer status, API health and the API, UI, Grafana and Prometheus URLs.
grad local logs [SERVICE]Logs of grad-server, grad-eval-worker, grad-trainer, postgres, seaweedfs or migrate (--follow, --tail).
grad local downStop the stack and keep its data (-v/--volumes deletes it).
grad local resetDelete the local data and keys (-y skips the prompt).

Every grad local command takes -f/--file (repeatable) for your own compose files and --project-name. If Docker Hub refuses the pull, grad local up fails with image_pull_denied (run docker logout or docker login and retry, point GRAD_SERVER_IMAGE/GRAD_TRAINER_IMAGE at the ghcr.io/gradiated mirror, or use --build); image_not_found means no image has that tag. Inside a grad checkout without --image-tag, either one builds the images from the checkout instead and says so. GRAD_SERVER_IMAGE, GRAD_TRAINER_IMAGE and GRAD_TRAINER_GPU_IMAGE use your own images and skip the pull.

Environment variables#

VariableUsed for
GRADIATED_API_KEY, GRADIATED_BASE_URLThe key and server, below flags and profiles.
GRADIATED_PROFILEThe profile to use (same as --profile).
GRAD_NO_TUISet to 1 for the plain readout instead of the full-screen view.
NO_COLORTurn off colour in the full-screen view.
XDG_CONFIG_HOMEWhere the config file lives ($XDG_CONFIG_HOME/gradiated/config.json).
GRAD_PORTgrad local API port (default 18787; a busy default moves to a free port in 18790-18809).
GRAD_COMPOSE_FILE, COMPOSE_PROJECT_NAMEgrad local compose files (:-separated) and project name.
GRAD_DOCKERThe Docker binary grad local runs (default docker).