26 lines
783 B
Go
26 lines
783 B
Go
package api
|
|
|
|
import (
|
|
"github.com/gin-gonic/gin"
|
|
)
|
|
|
|
func (s *Server) registerGatewayRoutes(r *gin.Engine) {
|
|
v1 := r.Group("/v1")
|
|
v1.Use(s.sessionMiddleware())
|
|
{
|
|
v1.GET("/models", s.gatewayModels)
|
|
|
|
v1.POST("/chat/completions", s.gatewayChatCompletions)
|
|
v1.POST("/responses", s.gatewayResponses)
|
|
v1.POST("/completions", s.gatewayProxyOpenAI("/v1/completions"))
|
|
v1.POST("/embeddings", s.gatewayProxyOpenAI("/v1/embeddings"))
|
|
v1.POST("/rerank", s.gatewayProxyOpenAI("/v1/rerank"))
|
|
|
|
v1.POST("/predictions", s.gatewayCreatePrediction)
|
|
v1.GET("/predictions", s.gatewayListPredictions)
|
|
v1.GET("/predictions/:id", s.gatewayGetPrediction)
|
|
v1.POST("/predictions/:id/cancel", s.gatewayCancelPrediction)
|
|
v1.GET("/predictions/:id/stream", s.gatewayStreamPrediction)
|
|
}
|
|
}
|