mirror of
				https://github.com/ggml-org/llama.cpp.git
				synced 2025-10-31 08:51:55 +00:00 
			
		
		
		
	straightforward /v1/models endpoint
This commit is contained in:
		| @@ -2660,6 +2660,26 @@ int main(int argc, char **argv) | ||||
|             }); | ||||
|  | ||||
|  | ||||
|  | ||||
|     svr.Get("/v1/models", [¶ms](const httplib::Request&, httplib::Response& res) | ||||
|             { | ||||
|                 std::time_t t = std::time(0); | ||||
|  | ||||
|                 json models = { | ||||
|                     {"object", "list"}, | ||||
|                     {"data", { | ||||
|                         { | ||||
|                             {"id", params.model_alias}, | ||||
|                             {"object", "model"}, | ||||
|                             {"created", t}, | ||||
|                             {"owned_by", "llamacpp"} | ||||
|                         }, | ||||
|                     }} | ||||
|                 }; | ||||
|  | ||||
|                 res.set_content(models.dump(), "application/json"); | ||||
|             }); | ||||
|  | ||||
|     // TODO: add mount point without "/v1" prefix -- how? | ||||
|     svr.Post("/v1/chat/completions", [&llama](const httplib::Request &req, httplib::Response &res) | ||||
|             { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Tobi Lütke
					Tobi Lütke