From 1b4e4059699b1fd52250f9f94bf508d00c12b913 Mon Sep 17 00:00:00 2001 From: fl0l0u Date: Sun, 15 Nov 2026 17:21:01 +0000 Subject: [PATCH] server: /props keeps the model path to the operator The llama-server compatibility payload carries model_path -- a path on this machine -- to whoever asked, keyless included. It travels the same class of information /v1/models already gates its `root` field with, and that gate exists: a stranger enumerating models should learn the model's name, not where its file lives. The field now answers for an api-keyed request or a local operator and comes back empty otherwise -- which is also what it already was for a --model stdin read, so no client finds the member missing, only the strangers learn nothing new. --- core/server/admin.cpp | 15 ++++++++++++--- docs/GUIDE.md | 2 +- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/core/server/admin.cpp b/core/server/admin.cpp index 5873441a..760a5969 100644 --- a/core/server/admin.cpp +++ b/core/server/admin.cpp @@ -262,7 +262,7 @@ HttpResponse Server::handle_detokenize(const HttpRequest& req) { * Only what this server can fill honestly, under llama-server's names: no GGUF metadata, no * per-slot state. n_ctx is the context one request may use (llama-server's per-slot n_ctx); * omitted when the context length is unknown. */ -HttpResponse Server::handle_props(const HttpRequest&) { +HttpResponse Server::handle_props(const HttpRequest& req) { const SamplingParams& sp = opt_.default_sampling; /* Every field llama-server's `params` carries, so no client finds one missing. Samplers this * server does not run are reported at their off values, which is what it serves. */ @@ -333,12 +333,21 @@ HttpResponse Server::handle_props(const HttpRequest&) { o["default_generation_settings"] = std::move(gen); o["total_slots"] = opt_.max_seqs; o["model_alias"] = opt_.model_id; - o["model_path"] = opt_.model_path; + /* A path on this machine: it travels the way /v1/models' `root` does -- keyless it belongs + * to the operator alone, with a key it rides with the key. The compatibility shape keeps + * the field; a stranger sees it empty, which is also what a --model stdin read is. */ + o["model_path"] = (!opt_.api_key.empty() || local_operator(req)) ? opt_.model_path + : std::string(); o["modalities"] = std::move(modal); o["endpoint_slots"] = false; o["endpoint_props"] = false; o["endpoint_metrics"] = true; - o["chat_template"] = deps_.chat ? deps_.chat->source() : std::string(); + /* The template's source text is the container's own bytes, gated like model_path above; + * a keyless stranger has no reader for it anyway. The capability flags stay -- a client + * needs them to build a request, and they name no path and quote no source. */ + o["chat_template"] = (deps_.chat && (!opt_.api_key.empty() || local_operator(req))) + ? deps_.chat->source() + : std::string(); o["chat_template_caps"] = json::parse(deps_.chat ? deps_.chat->caps() : std::string("{}"), nullptr, false); std::string bos, eos; diff --git a/docs/GUIDE.md b/docs/GUIDE.md index 0b66e7f4..7198349d 100644 --- a/docs/GUIDE.md +++ b/docs/GUIDE.md @@ -2534,7 +2534,7 @@ keys are refused on it, and so are the pixel bands. | `GET /health`, `/v1/health`, `/ping`, `POST /ping` | liveness; 503 with `"status": "stuck"` once the device has advanced nothing for a minute. A device stuck for `scheduler.stuck-exit` (60s; `0` never) ends the process (exit status 70, the queues it is stuck on in the log), so a restart policy brings the server back | | `GET /load` | current load | | `GET /version` | server version | -| `GET /props` | llama-server's props: `n_ctx`, `total_slots`, `modalities`, `model_path`, the chat template and its capabilities, `bos_token`/`eos_token`, and the request defaults under llama-server's names | +| `GET /props` | llama-server's props: `n_ctx`, `total_slots`, `modalities`, `model_path`, the chat template and its capabilities, `bos_token`/`eos_token`, and the request defaults under llama-server's names. Keyless, `model_path` and the template source answer the local operator only (§6.6); the capability flags stay open — clients build requests from them | | `POST /apply-template` | the prompt a chat request renders to, as llama-server returns it | | `POST /v1/chat/completions/input_tokens` | how many tokens that prompt is | | `GET /server_info` | the whole configuration of the running engine |