MCPcopy
hub / github.com/mudler/LocalAI / isAPIPath

Function isAPIPath

core/http/auth/middleware.go:578–600  ·  view source on GitHub ↗

isAPIPath returns true for paths that always require authentication.

(path string)

Source from the content-addressed store, hash-verified

576
577// isAPIPath returns true for paths that always require authentication.
578func isAPIPath(path string) bool {
579 return strings.HasPrefix(path, "/api/") ||
580 strings.HasPrefix(path, "/v1/") ||
581 strings.HasPrefix(path, "/models/") ||
582 strings.HasPrefix(path, "/backends/") ||
583 strings.HasPrefix(path, "/backend/") ||
584 strings.HasPrefix(path, "/tts") ||
585 strings.HasPrefix(path, "/vad") ||
586 strings.HasPrefix(path, "/video") ||
587 strings.HasPrefix(path, "/stores/") ||
588 strings.HasPrefix(path, "/system") ||
589 strings.HasPrefix(path, "/ws/") ||
590 strings.HasPrefix(path, "/generated-") ||
591 strings.HasPrefix(path, "/chat/") ||
592 strings.HasPrefix(path, "/completions") ||
593 strings.HasPrefix(path, "/edits") ||
594 strings.HasPrefix(path, "/embeddings") ||
595 strings.HasPrefix(path, "/audio/") ||
596 strings.HasPrefix(path, "/images/") ||
597 strings.HasPrefix(path, "/messages") ||
598 strings.HasPrefix(path, "/responses") ||
599 path == "/metrics"
600}
601
602// authError returns an appropriate error response.
603func authError(c echo.Context, appConfig *config.ApplicationConfig) error {

Callers 1

MiddlewareFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected