Commit 80510e5f authored by yangjianbo's avatar yangjianbo
Browse files

fix(gateway): 明确旧协议接口不支持的错误提示



将 /v1/chat/completions 的拦截文案改为旧协议不支持,避免误导为会路由到 Sora。
明确要求客户端改用 /v1/responses。
Co-Authored-By: default avatarClaude Opus 4.6 <noreply@anthropic.com>
parent f323174d
...@@ -43,12 +43,12 @@ func RegisterGatewayRoutes( ...@@ -43,12 +43,12 @@ func RegisterGatewayRoutes(
gateway.GET("/usage", h.Gateway.Usage) gateway.GET("/usage", h.Gateway.Usage)
// OpenAI Responses API // OpenAI Responses API
gateway.POST("/responses", h.OpenAIGateway.Responses) gateway.POST("/responses", h.OpenAIGateway.Responses)
// 明确阻止旧入口误用到 Sora,避免客户端把 OpenAI Chat Completions 当作 Sora 入口 // 明确阻止旧协议入口:OpenAI 仅支持 Responses API,避免客户端误解为会自动路由到其它平台。
gateway.POST("/chat/completions", func(c *gin.Context) { gateway.POST("/chat/completions", func(c *gin.Context) {
c.JSON(http.StatusBadRequest, gin.H{ c.JSON(http.StatusBadRequest, gin.H{
"error": gin.H{ "error": gin.H{
"type": "invalid_request_error", "type": "invalid_request_error",
"message": "For Sora, use /sora/v1/chat/completions. OpenAI should use /v1/responses.", "message": "Unsupported legacy protocol: /v1/chat/completions is not supported. Please use /v1/responses.",
}, },
}) })
}) })
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment