feat: 密钥管理

This commit is contained in:
tbphp
2025-07-04 21:19:15 +08:00
parent 7c10474d19
commit 01b86f7e30
23 changed files with 1427 additions and 250 deletions

View File

@@ -1,6 +1,7 @@
package channel
import (
"context"
"gpt-load/internal/models"
"github.com/gin-gonic/gin"
@@ -11,4 +12,10 @@ type ChannelProxy interface {
// Handle takes a context, an API key, and the original request,
// then forwards the request to the upstream service.
Handle(c *gin.Context, apiKey *models.APIKey, group *models.Group) error
}
// ValidateKey checks if the given API key is valid.
ValidateKey(ctx context.Context, key string) (bool, error)
// IsStreamingRequest checks if the request is for a streaming response.
IsStreamingRequest(c *gin.Context) bool
}