@@ -3907,6 +3907,21 @@ int main(int argc, char ** argv) {
39073907 res_ok (res, {{ " success" , true }});
39083908 };
39093909
3910+ const auto handle_api_show = [&ctx_server, &res_ok](const httplib::Request &, httplib::Response & res) {
3911+ json data = {
3912+ {
3913+ " template" , common_chat_templates_source (ctx_server.chat_templates .get ()),
3914+ },
3915+ {
3916+ " model_info" , {
3917+ { " llama.context_length" , ctx_server.slots .back ().n_ctx , },
3918+ }
3919+ },
3920+ };
3921+
3922+ res_ok (res, data);
3923+ };
3924+
39103925 // handle completion-like requests (completion, chat, infill)
39113926 // we can optionally provide a custom format for partial results and final results
39123927 const auto handle_completions_impl = [&ctx_server, &res_error, &res_ok](
@@ -4471,6 +4486,7 @@ int main(int argc, char ** argv) {
44714486 svr->Get (" /metrics" , handle_metrics);
44724487 svr->Get (" /props" , handle_props);
44734488 svr->Post (" /props" , handle_props_change);
4489+ svr->Post (" /api/show" , handle_api_show);
44744490 svr->Get (" /models" , handle_models); // public endpoint (no API key check)
44754491 svr->Get (" /v1/models" , handle_models); // public endpoint (no API key check)
44764492 svr->Post (" /completion" , handle_completions); // legacy
0 commit comments