Install
da-vinci command (the npm package is leonardo-davinci;
the command matches this API’s name). One-off use via npx leonardo-davinci
needs no install. Requires Node 18.17+.
Interactive mode
Runda-vinci with no command and the terminal becomes the studiolo — a
red-chalk workspace with a prompt. Type commands without the da-vinci prefix
(random, search flying machine, folio codex-atlanticus 1646 --full),
clear to repaint, quit to leave. The session scrolls back like a
conversation and stays in your terminal history after you quit. Scripts and
pipes are unaffected: non-interactive invocations print plain output.
Find one page — never a guess
find answers in exactly one of three ways, and the exit code says which: 0 one
page (folio in the JSON; how says whether a label or a search decided it), 2
several pages fit (candidates), 4 nothing fits. A folio label names a page outright.
A phrase is searched, and the best page is the answer only when it clearly leads — its
score well ahead of the runner-up and every term found in one passage or the title. A
thematic query like optics and birds is legitimately a list.
Commands
A collection may be given as its slug or any name people use —
ca, atlanticus,
arundel, "ms f", "forster iii", "madrid ii". A page may be its index in the
collection (531) or the folio written on it (266v, 0266 v, 266 recto, 12r bis).
Every command accepts --json for machine-readable output, --format md for a markdown
table, --fields slug,index,url to trim a record, and --quiet for slug/index refs
only — pipe them to jq, scripts, or agents:
0 ok · 1 usage · 2 several pages fit (listed) · 3 network or rate limit ·
4 none · 5 some pulls failed. Under --json, errors are { "ok": false, "error": { "code", "message" } } on stdout. Codes 2 and 4 are answers, not failures.
Examples
Rate limits & keys
The CLI uses the same rate limits as the API — anonymous 60/hour. Pass--api-key or set DAVINCI_API_KEY for higher tiers.
Security
Built to be maximally auditable: zero runtime dependencies (one file of Node builtins), no install scripts, no telemetry, HTTPS only to venivididavinci.com origins (downloads included), validated inputs, traversal-safe downloads. Ships exactly four files — verify withnpm pack leonardo-davinci --dry-run.
Attribution
Content fetched through the CLI carries the same attribution terms as the API — every folio includes a ready-madeattribution string.