@@ -4806,14 +4806,14 @@ int main(int argc, char ** argv) {
4806
4806
// register static assets routes
4807
4807
if (!params.public_path .empty ()) {
4808
4808
// Set the base directory for serving static files
4809
- bool is_found = svr->set_mount_point (" /" , params.public_path );
4809
+ bool is_found = svr->set_mount_point (params. api_prefix + " /" , params.public_path );
4810
4810
if (!is_found) {
4811
4811
LOG_ERR (" %s: static assets path not found: %s\n " , __func__, params.public_path .c_str ());
4812
4812
return 1 ;
4813
4813
}
4814
4814
} else {
4815
4815
// using embedded static index.html
4816
- svr->Get (" /" , [](const httplib::Request & req, httplib::Response & res) {
4816
+ svr->Get (params. api_prefix + " /" , [](const httplib::Request & req, httplib::Response & res) {
4817
4817
if (req.get_header_value (" Accept-Encoding" ).find (" gzip" ) == std::string::npos) {
4818
4818
res.set_content (" Error: gzip is not supported by this browser" , " text/plain" );
4819
4819
} else {
@@ -4829,37 +4829,37 @@ int main(int argc, char ** argv) {
4829
4829
}
4830
4830
4831
4831
// register API routes
4832
- svr->Get (" /health" , handle_health); // public endpoint (no API key check)
4833
- svr->Get (" /metrics" , handle_metrics);
4834
- svr->Get (" /props" , handle_props);
4835
- svr->Post (" /props" , handle_props_change);
4836
- svr->Post (" /api/show" , handle_api_show);
4837
- svr->Get (" /models" , handle_models); // public endpoint (no API key check)
4838
- svr->Get (" /v1/models" , handle_models); // public endpoint (no API key check)
4839
- svr->Get (" /api/tags" , handle_models); // ollama specific endpoint. public endpoint (no API key check)
4840
- svr->Post (" /completion" , handle_completions); // legacy
4841
- svr->Post (" /completions" , handle_completions);
4842
- svr->Post (" /v1/completions" , handle_completions_oai);
4843
- svr->Post (" /chat/completions" , handle_chat_completions);
4844
- svr->Post (" /v1/chat/completions" , handle_chat_completions);
4845
- svr->Post (" /api/chat" , handle_chat_completions); // ollama specific endpoint
4846
- svr->Post (" /infill" , handle_infill);
4847
- svr->Post (" /embedding" , handle_embeddings); // legacy
4848
- svr->Post (" /embeddings" , handle_embeddings);
4849
- svr->Post (" /v1/embeddings" , handle_embeddings_oai);
4850
- svr->Post (" /rerank" , handle_rerank);
4851
- svr->Post (" /reranking" , handle_rerank);
4852
- svr->Post (" /v1/rerank" , handle_rerank);
4853
- svr->Post (" /v1/reranking" , handle_rerank);
4854
- svr->Post (" /tokenize" , handle_tokenize);
4855
- svr->Post (" /detokenize" , handle_detokenize);
4856
- svr->Post (" /apply-template" , handle_apply_template);
4832
+ svr->Get (params. api_prefix + " /health" , handle_health); // public endpoint (no API key check)
4833
+ svr->Get (params. api_prefix + " /metrics" , handle_metrics);
4834
+ svr->Get (params. api_prefix + " /props" , handle_props);
4835
+ svr->Post (params. api_prefix + " /props" , handle_props_change);
4836
+ svr->Post (params. api_prefix + " /api/show" , handle_api_show);
4837
+ svr->Get (params. api_prefix + " /models" , handle_models); // public endpoint (no API key check)
4838
+ svr->Get (params. api_prefix + " /v1/models" , handle_models); // public endpoint (no API key check)
4839
+ svr->Get (params. api_prefix + " /api/tags" , handle_models); // ollama specific endpoint. public endpoint (no API key check)
4840
+ svr->Post (params. api_prefix + " /completion" , handle_completions); // legacy
4841
+ svr->Post (params. api_prefix + " /completions" , handle_completions);
4842
+ svr->Post (params. api_prefix + " /v1/completions" , handle_completions_oai);
4843
+ svr->Post (params. api_prefix + " /chat/completions" , handle_chat_completions);
4844
+ svr->Post (params. api_prefix + " /v1/chat/completions" , handle_chat_completions);
4845
+ svr->Post (params. api_prefix + " /api/chat" , handle_chat_completions); // ollama specific endpoint
4846
+ svr->Post (params. api_prefix + " /infill" , handle_infill);
4847
+ svr->Post (params. api_prefix + " /embedding" , handle_embeddings); // legacy
4848
+ svr->Post (params. api_prefix + " /embeddings" , handle_embeddings);
4849
+ svr->Post (params. api_prefix + " /v1/embeddings" , handle_embeddings_oai);
4850
+ svr->Post (params. api_prefix + " /rerank" , handle_rerank);
4851
+ svr->Post (params. api_prefix + " /reranking" , handle_rerank);
4852
+ svr->Post (params. api_prefix + " /v1/rerank" , handle_rerank);
4853
+ svr->Post (params. api_prefix + " /v1/reranking" , handle_rerank);
4854
+ svr->Post (params. api_prefix + " /tokenize" , handle_tokenize);
4855
+ svr->Post (params. api_prefix + " /detokenize" , handle_detokenize);
4856
+ svr->Post (params. api_prefix + " /apply-template" , handle_apply_template);
4857
4857
// LoRA adapters hotswap
4858
- svr->Get (" /lora-adapters" , handle_lora_adapters_list);
4859
- svr->Post (" /lora-adapters" , handle_lora_adapters_apply);
4858
+ svr->Get (params. api_prefix + " /lora-adapters" , handle_lora_adapters_list);
4859
+ svr->Post (params. api_prefix + " /lora-adapters" , handle_lora_adapters_apply);
4860
4860
// Save & load slots
4861
- svr->Get (" /slots" , handle_slots);
4862
- svr->Post (" /slots/:id_slot" , handle_slots_action);
4861
+ svr->Get (params. api_prefix + " /slots" , handle_slots);
4862
+ svr->Post (params. api_prefix + " /slots/:id_slot" , handle_slots_action);
4863
4863
4864
4864
//
4865
4865
// Start the server
0 commit comments