package proxy import ( "net/http" "git.wntrmute.dev/kyle/crossbar/internal/config" ) // isControlCall reports whether r is a control-plane call: a GET or HEAD on any allowed path, or a // POST to exactly /tokenize or /v1/chat/completions/control. Everything else — in particular a chat // completion on /v1/chat/completions — is not a control call. rest is the upstream path, not the // query string. func isControlCall(method, rest string) bool { if method == http.MethodGet || method == http.MethodHead { return true } return method == http.MethodPost && (rest == "/tokenize" || rest == "/v1/chat/completions/control") } // resolveModel returns the model for a request: the body's top-level "model" wins (already read by // peekModel), else the ?model= query parameter, else the route's default_model. The result keys the // lease and the limiter pair. func resolveModel(model string, r *http.Request, routeCfg config.Route) string { if model == "" { model = r.URL.Query().Get("model") } if model == "" { model = routeCfg.DefaultModel } return model }