feat: native provider passthrough with key injection and best-effort accounting

This commit is contained in:
2026-08-20 11:24:24 +01:00
parent 3ed473bdfe
commit 8d470b173b
8 changed files with 760 additions and 0 deletions
+12
View File
@@ -268,6 +268,18 @@ func (g *Gateway) ServeHTTP(w http.ResponseWriter, r *http.Request) {
return
}
if providerName, rest, ok := passthroughRoute(r.URL.Path); ok {
if _, known := g.adapters[providerName]; known {
u, grp, ok := g.auth.identify(r)
if !ok {
writeOAIError(sw, http.StatusUnauthorized, "authentication_error", "invalid or missing API key")
return
}
g.handlePassthrough(sw, r, u, grp, providerName, rest)
return
}
}
if g.cfg.PassthroughUnknown {
g.next.ServeHTTP(sw, r)
return