mirror of
https://github.com/ggml-org/llama.cpp.git
synced 2025-10-29 08:41:22 +00:00
server : add /v1/health endpoint (#16461)
* server : add /v1/health endpoint * cont : update readme
This commit is contained in:
@@ -393,7 +393,7 @@ node index.js
|
|||||||
|
|
||||||
### GET `/health`: Returns health check result
|
### GET `/health`: Returns health check result
|
||||||
|
|
||||||
This endpoint is public (no API key check).
|
This endpoint is public (no API key check). `/v1/health` also works.
|
||||||
|
|
||||||
**Response format**
|
**Response format**
|
||||||
|
|
||||||
|
|||||||
@@ -4184,6 +4184,7 @@ int main(int argc, char ** argv) {
|
|||||||
auto middleware_validate_api_key = [¶ms, &res_error](const httplib::Request & req, httplib::Response & res) {
|
auto middleware_validate_api_key = [¶ms, &res_error](const httplib::Request & req, httplib::Response & res) {
|
||||||
static const std::unordered_set<std::string> public_endpoints = {
|
static const std::unordered_set<std::string> public_endpoints = {
|
||||||
"/health",
|
"/health",
|
||||||
|
"/v1/health",
|
||||||
"/models",
|
"/models",
|
||||||
"/v1/models",
|
"/v1/models",
|
||||||
"/api/tags"
|
"/api/tags"
|
||||||
@@ -5232,6 +5233,7 @@ int main(int argc, char ** argv) {
|
|||||||
|
|
||||||
// register API routes
|
// register API routes
|
||||||
svr->Get (params.api_prefix + "/health", handle_health); // public endpoint (no API key check)
|
svr->Get (params.api_prefix + "/health", handle_health); // public endpoint (no API key check)
|
||||||
|
svr->Get (params.api_prefix + "/v1/health", handle_health); // public endpoint (no API key check)
|
||||||
svr->Get (params.api_prefix + "/metrics", handle_metrics);
|
svr->Get (params.api_prefix + "/metrics", handle_metrics);
|
||||||
svr->Get (params.api_prefix + "/props", handle_props);
|
svr->Get (params.api_prefix + "/props", handle_props);
|
||||||
svr->Post(params.api_prefix + "/props", handle_props_change);
|
svr->Post(params.api_prefix + "/props", handle_props_change);
|
||||||
|
|||||||
Reference in New Issue
Block a user