CLI
Ask Drex's decision model calibrated questions from the shell with the drex command.
drex-cli installs the drex command, which calls https://console.nace.ai from your shell. It is built on the Python SDK. This page covers drex decide and drex models. The same command also runs Perception's document tools, uploads, jobs and saved schemas — see the Perception CLI page for those.
pipx install drex-cli # or: uv tool install drex-cli
drex logindrex login asks for a key and checks it against Drex. It then saves the key to ~/.drex/config.toml, readable only by you. DREX_API_KEY and DREX_BASE_URL take precedence over the file.
| Flag | What it does |
|---|---|
--api-key KEY | The nace_sk_ key. KEY=- reads it from stdin, for scripts. Omit it to type it hidden. |
--base-url URL | Save a different API host with the key. |
drex logout deletes the saved key. drex version prints the CLI and SDK versions.
Every command
| Flag | What it does |
|---|---|
--json | Print the raw response JSON. |
--timeout SECONDS | Per-request HTTP timeout (default 120). |
Status messages go to stderr, so stdout holds only the result; drex decide --state ... > answer.json --json captures only the response. drex exits with 0 on success, 1 when an API call fails, and 2 on a usage or configuration error. An error message shows the error type, the code, up to 5 field-level issues, and the request_id.
Ask questions
drex decide --state "I was charged twice for my March invoice." \
--noul "wants_refund=Is the customer asking for a refund?" \
--choice "topic=billing,shipping,other: Which topic is it?" \
--score "urgency=low,medium,high: How urgent is it?"| Flag | What it does |
|---|---|
--state TEXT | The state: text, @FILE, or - for stdin. Required unless --body already has one. A JSON object or array is sent as JSON; anything else as text. |
--noul NAME=INSTRUCTIONS | A yes/no question. Repeatable. |
--choice NAME=A,B,C[: INSTRUCTIONS] | A pick-one question; labels before the colon, instructions after. Repeatable. |
--score NAME=LOW,...,HIGH[: INSTRUCTIONS] | An ordered-levels question, low to high. Repeatable. |
--questions JSON | A questions object as inline JSON, @FILE, or a path; merges with any --noul/--choice/--score flags. |
--body JSON | A whole request body as inline JSON, @FILE, or a path. The flags above override its fields. |
-m, --model MODEL | Model id (default drex-latest). See drex models. |
drex models lists the models your key can call; it takes no extra flags beyond Every command.
For drex parse/split/classify/extract/ground, drex upload, drex jobs/job/file/cancel and the drex schema-* commands, see the Perception CLI page.