Initial commit: Luminary AI Gateway
CI / docker (push) Successful in 2m4s

OpenAI-compatible AI gateway with Vue admin UI, multi-provider egress,
ingress key governance, monitoring, and security controls.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
renjue
2026-06-23 21:46:16 +08:00
commit 76ba500417
134 changed files with 18988 additions and 0 deletions
+30
View File
@@ -0,0 +1,30 @@
package limiter
import (
"github.com/rose_cat707/luminary/internal/model"
"github.com/rose_cat707/luminary/internal/store/cache"
)
func IsProviderKeyAvailable(k model.ProviderKey) bool {
if !k.Enabled {
return false
}
if k.MaxRequestsPerDay > 0 && k.RequestsToday >= k.MaxRequestsPerDay {
return false
}
if k.MaxTokensPerDay > 0 && k.TokensToday >= k.MaxTokensPerDay {
return false
}
return true
}
func CheckIngressBudget(k *model.IngressKey, estimatedCost float64) bool {
if k.BudgetLimit <= 0 {
return true
}
return k.BudgetUsed+estimatedCost <= k.BudgetLimit
}
func CheckRateLimit(c *cache.Store, ingressKeyID uint, rpm, tpm, tokens int) bool {
return c.CheckRateLimit(ingressKeyID, rpm, tpm, tokens)
}