@@ -84,6 +84,7 @@ func (h *HTTPHandler) routeHandlers() map[string]http.HandlerFunc {
8484 m ["POST " + inference .InferencePrefix + "/unload" ] = h .Unload
8585 m ["POST " + inference .InferencePrefix + "/{backend}/_configure" ] = h .Configure
8686 m ["POST " + inference .InferencePrefix + "/_configure" ] = h .Configure
87+ m ["GET " + inference .InferencePrefix + "/_configure" ] = h .GetModelConfigs
8788 m ["GET " + inference .InferencePrefix + "/requests" ] = h .scheduler .openAIRecorder .GetRecordsHandler ()
8889 return m
8990}
@@ -350,6 +351,31 @@ func (h *HTTPHandler) Configure(w http.ResponseWriter, r *http.Request) {
350351 w .WriteHeader (http .StatusAccepted )
351352}
352353
354+ // GetModelConfigs returns model configurations. If a model is specified in the query parameter,
355+ // returns only configs for that model; otherwise returns all configs.
356+ func (h * HTTPHandler ) GetModelConfigs (w http.ResponseWriter , r * http.Request ) {
357+ model := r .URL .Query ().Get ("model" )
358+
359+ configs := h .scheduler .loader .getAllRunnerConfigs (r .Context ())
360+
361+ if model != "" {
362+ modelID := h .scheduler .modelManager .ResolveID (model )
363+ filtered := configs [:0 ]
364+ for _ , entry := range configs {
365+ if entry .ModelID == modelID {
366+ filtered = append (filtered , entry )
367+ }
368+ }
369+ configs = filtered
370+ }
371+
372+ w .Header ().Set ("Content-Type" , "application/json" )
373+ if err := json .NewEncoder (w ).Encode (configs ); err != nil {
374+ http .Error (w , fmt .Sprintf ("Failed to encode response: %v" , err ), http .StatusInternalServerError )
375+ return
376+ }
377+ }
378+
353379// ServeHTTP implements net/http.Handler.ServeHTTP.
354380func (h * HTTPHandler ) ServeHTTP (w http.ResponseWriter , r * http.Request ) {
355381 h .lock .RLock ()
0 commit comments