v1.6.1

REST API

Last updated


Where the daemon's HTTP API listens and which guards every request passes.
The daemon listens on the loopback addresses — 127.0.0.1:17989 and [::1]:17989 — and, only while LAN access is on in a LAN build (see below), also on port 17989 of each private-network interface address. The port is fixed and not configurable. Since v1.5.0 a connection that does not finish sending its request headers within 10 seconds is closed.
The same daemon serves the web dashboard at /. The dashboard is embedded into the binary at build time, so http://127.0.0.1:17989 is the whole surface — there is no hosted front-end. AGENVOY_PAGE_DIR swaps the embedded copy for files on disk during development (make dev).
Since v1.0.1 the dashboard also runs offline. GET /sw.js serves a service worker that precaches the embedded assets under a versioned cache; GET /vendor/* serves the third-party assets (QuickUI, Font Awesome, Material Symbols, and the nanomd / voice scripts) from ~/.config/agenvoy/vendor/, which the daemon downloads once at startup and re-downloads when the binary version changes. Since v1.5.0 each download is checked against the sha384 recorded for it in page/vendor.json, and a mismatch aborts the sync without writing the file. Nothing is fetched from a CDN at page load. In AGENVOY_PAGE_DIR mode /sw.js instead serves a teardown worker that clears its caches and unregisters itself, so a dev build is never served from a stale cache.
Endpoints marked local additionally require the request to originate from 127.0.0.1/::1 (the localhostOnly() guard). They manage credentials, config files, or process lifecycle and are meant for a same-machine dashboard, not remote clients. Unmatched routes carry the same guard: an unknown /v1/ path returns a JSON 404, and any other unknown path falls back to the dashboard index.
Since v1.5.0 every route first checks the Host header: only localhost, 127.0.0.1 or ::1 (any port) pass, and anything else gets 403 [Denied] host: ..., so a DNS-rebinding page cannot reach the API through its own domain name.
LAN access was added in v1.5.0; since v1.5.1 it is compiled only into binaries built with make build ENABLE_LAN=1 (build tag lan), and a default build never listens on the LAN, hides the setting in the TUI and the dashboard, and answers lan_access in POST /v1/config/security with 403. In a LAN build it is lan_access_enabled in config.json, set with /config → LAN access in the TUI, the Security section of the dashboard's System tab, or POST /v1/config/security; off by default. The daemon watches the config and applies the change without a restart. While it is on, the daemon also listens on port 17989 of each private or IPv4 link-local interface address, and the Host check, the Origin check and the local guard also accept IP literals inside those interfaces' subnets (never domain names). Any device on that network can then call every endpoint, local ones included, without a password, so turn it on only for short use. Approving a restricted confirmation with the OS password and receiving daemon frames on /v1/log stay loopback-only.
Since v1.3.11 every POST, PUT, PATCH or DELETE whose Origin header is not a loopback origin (localhost, 127.0.0.1, ::1) gets 403 [Denied] origin: ... before routing, and POST /v1/send and POST /v1/chat/completions reject a Content-Type other than application/json with 415 [Invalid] Content-Type: .... A request without an Origin header, such as curl, is not affected by the first check.