fix(gateway): mark local platform gates business-limited
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
parent
c782c2d9c3
commit
c3e7476992
@ -781,6 +781,7 @@ func (h *GatewayHandler) Messages(c *gin.Context) {
|
|||||||
// Beta policy block: return 400 immediately, no failover
|
// Beta policy block: return 400 immediately, no failover
|
||||||
var betaBlockedErr *service.BetaBlockedError
|
var betaBlockedErr *service.BetaBlockedError
|
||||||
if errors.As(err, &betaBlockedErr) {
|
if errors.As(err, &betaBlockedErr) {
|
||||||
|
service.MarkOpsClientBusinessLimited(c, service.OpsClientBusinessLimitedReasonLocalPolicyDenied)
|
||||||
h.errorResponse(c, http.StatusBadRequest, "invalid_request_error", betaBlockedErr.Message)
|
h.errorResponse(c, http.StatusBadRequest, "invalid_request_error", betaBlockedErr.Message)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@ -51,6 +51,7 @@ func RegisterGatewayRoutes(
|
|||||||
// /v1/messages/count_tokens: OpenAI groups get 404
|
// /v1/messages/count_tokens: OpenAI groups get 404
|
||||||
gateway.POST("/messages/count_tokens", func(c *gin.Context) {
|
gateway.POST("/messages/count_tokens", func(c *gin.Context) {
|
||||||
if getGroupPlatform(c) == service.PlatformOpenAI {
|
if getGroupPlatform(c) == service.PlatformOpenAI {
|
||||||
|
service.MarkOpsClientBusinessLimited(c, service.OpsClientBusinessLimitedReasonLocalFeatureGate)
|
||||||
c.JSON(http.StatusNotFound, gin.H{
|
c.JSON(http.StatusNotFound, gin.H{
|
||||||
"type": "error",
|
"type": "error",
|
||||||
"error": gin.H{
|
"error": gin.H{
|
||||||
@ -90,6 +91,7 @@ func RegisterGatewayRoutes(
|
|||||||
})
|
})
|
||||||
gateway.POST("/images/generations", func(c *gin.Context) {
|
gateway.POST("/images/generations", func(c *gin.Context) {
|
||||||
if getGroupPlatform(c) != service.PlatformOpenAI {
|
if getGroupPlatform(c) != service.PlatformOpenAI {
|
||||||
|
service.MarkOpsClientBusinessLimited(c, service.OpsClientBusinessLimitedReasonLocalFeatureGate)
|
||||||
c.JSON(http.StatusNotFound, gin.H{
|
c.JSON(http.StatusNotFound, gin.H{
|
||||||
"error": gin.H{
|
"error": gin.H{
|
||||||
"type": "not_found_error",
|
"type": "not_found_error",
|
||||||
@ -102,6 +104,7 @@ func RegisterGatewayRoutes(
|
|||||||
})
|
})
|
||||||
gateway.POST("/images/edits", func(c *gin.Context) {
|
gateway.POST("/images/edits", func(c *gin.Context) {
|
||||||
if getGroupPlatform(c) != service.PlatformOpenAI {
|
if getGroupPlatform(c) != service.PlatformOpenAI {
|
||||||
|
service.MarkOpsClientBusinessLimited(c, service.OpsClientBusinessLimitedReasonLocalFeatureGate)
|
||||||
c.JSON(http.StatusNotFound, gin.H{
|
c.JSON(http.StatusNotFound, gin.H{
|
||||||
"error": gin.H{
|
"error": gin.H{
|
||||||
"type": "not_found_error",
|
"type": "not_found_error",
|
||||||
@ -157,6 +160,7 @@ func RegisterGatewayRoutes(
|
|||||||
})
|
})
|
||||||
r.POST("/images/generations", bodyLimit, clientRequestID, opsErrorLogger, endpointNorm, gin.HandlerFunc(apiKeyAuth), requireGroupAnthropic, func(c *gin.Context) {
|
r.POST("/images/generations", bodyLimit, clientRequestID, opsErrorLogger, endpointNorm, gin.HandlerFunc(apiKeyAuth), requireGroupAnthropic, func(c *gin.Context) {
|
||||||
if getGroupPlatform(c) != service.PlatformOpenAI {
|
if getGroupPlatform(c) != service.PlatformOpenAI {
|
||||||
|
service.MarkOpsClientBusinessLimited(c, service.OpsClientBusinessLimitedReasonLocalFeatureGate)
|
||||||
c.JSON(http.StatusNotFound, gin.H{
|
c.JSON(http.StatusNotFound, gin.H{
|
||||||
"error": gin.H{
|
"error": gin.H{
|
||||||
"type": "not_found_error",
|
"type": "not_found_error",
|
||||||
@ -169,6 +173,7 @@ func RegisterGatewayRoutes(
|
|||||||
})
|
})
|
||||||
r.POST("/images/edits", bodyLimit, clientRequestID, opsErrorLogger, endpointNorm, gin.HandlerFunc(apiKeyAuth), requireGroupAnthropic, func(c *gin.Context) {
|
r.POST("/images/edits", bodyLimit, clientRequestID, opsErrorLogger, endpointNorm, gin.HandlerFunc(apiKeyAuth), requireGroupAnthropic, func(c *gin.Context) {
|
||||||
if getGroupPlatform(c) != service.PlatformOpenAI {
|
if getGroupPlatform(c) != service.PlatformOpenAI {
|
||||||
|
service.MarkOpsClientBusinessLimited(c, service.OpsClientBusinessLimitedReasonLocalFeatureGate)
|
||||||
c.JSON(http.StatusNotFound, gin.H{
|
c.JSON(http.StatusNotFound, gin.H{
|
||||||
"error": gin.H{
|
"error": gin.H{
|
||||||
"type": "not_found_error",
|
"type": "not_found_error",
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user