浏览代码

fix: swag api path (#191)

zijiren 7 月之前
父节点
当前提交
0ab48c3894

+ 1 - 1
core/controller/channel-test.go

@@ -251,7 +251,7 @@ func processTestResult(mc *model.ModelCaches, channel *model.Channel, modelName
 //	@Param			success_body	query		bool	false	"Success body"
 //	@Param			stream			query		bool	false	"Stream"
 //	@Success		200				{object}	middleware.APIResponse{data=[]TestResult}
-//	@Router			/api/channel/{id}/models [get]
+//	@Router			/api/channel/{id}/test [get]
 func TestChannelModels(c *gin.Context) {
 	id, err := strconv.Atoi(c.Param("id"))
 	if err != nil {

+ 3 - 3
core/controller/channel.go

@@ -46,7 +46,7 @@ func ChannelTypeMetas(c *gin.Context) {
 //	@Param			base_url		query		string	false	"Filter by base URL"
 //	@Param			order			query		string	false	"Order by field"
 //	@Success		200				{object}	middleware.APIResponse{data=map[string]any{channels=[]model.Channel,total=int}}
-//	@Router			/api/channels [get]
+//	@Router			/api/channels/ [get]
 func GetChannels(c *gin.Context) {
 	page, perPage := parsePageParams(c)
 	id, _ := strconv.Atoi(c.Query("id"))
@@ -94,7 +94,7 @@ func GetAllChannels(c *gin.Context) {
 //	@Security		ApiKeyAuth
 //	@Param			channels	body		[]AddChannelRequest	true	"Channel information"
 //	@Success		200			{object}	middleware.APIResponse
-//	@Router			/api/channels [post]
+//	@Router			/api/channels/ [post]
 func AddChannels(c *gin.Context) {
 	channels := make([]*AddChannelRequest, 0)
 	err := c.ShouldBindJSON(&channels)
@@ -258,7 +258,7 @@ func (r *AddChannelRequest) ToChannels() ([]*model.Channel, error) {
 //	@Security		ApiKeyAuth
 //	@Param			channel	body		AddChannelRequest	true	"Channel information"
 //	@Success		200		{object}	middleware.APIResponse
-//	@Router			/api/channel [post]
+//	@Router			/api/channel/ [post]
 func AddChannel(c *gin.Context) {
 	channel := AddChannelRequest{}
 	err := c.ShouldBindJSON(&channel)

+ 2 - 2
core/controller/dashboard.go

@@ -152,7 +152,7 @@ func fillGaps(data []*model.ChartData, start, end time.Time, t model.TimeSpanTyp
 //	@Param			end_timestamp	query		int64	false	"End second timestamp"
 //	@Param			timezone		query		string	false	"Timezone, default is Local"
 //	@Success		200				{object}	middleware.APIResponse{data=model.DashboardResponse}
-//	@Router			/api/dashboard [get]
+//	@Router			/api/dashboard/ [get]
 func GetDashboard(c *gin.Context) {
 	log := middleware.GetLogger(c)
 
@@ -294,7 +294,7 @@ func GetGroupDashboardModels(c *gin.Context) {
 //	@Param			start_timestamp	query		int64	false	"Start timestamp"
 //	@Param			end_timestamp	query		int64	false	"End timestamp"
 //	@Success		200				{object}	middleware.APIResponse{data=[]model.ModelCostRank}
-//	@Router			/api/model_cost_rank [get]
+//	@Router			/api/model_cost_rank/ [get]
 func GetModelCostRank(c *gin.Context) {
 	group := c.Query("group")
 	channelID, _ := strconv.Atoi(c.Query("channel"))

+ 1 - 1
core/controller/group.go

@@ -39,7 +39,7 @@ func (g *GroupResponse) MarshalJSON() ([]byte, error) {
 //	@Param			page		query		int	false	"Page number"
 //	@Param			per_page	query		int	false	"Items per page"
 //	@Success		200			{object}	middleware.APIResponse{data=map[string]any{groups=[]GroupResponse,total=int}}
-//	@Router			/api/groups [get]
+//	@Router			/api/groups/ [get]
 func GetGroups(c *gin.Context) {
 	page, perPage := parsePageParams(c)
 	order := c.DefaultQuery("order", "")

+ 2 - 2
core/controller/log.go

@@ -80,7 +80,7 @@ func parseCommonParams(c *gin.Context) (params struct {
 //	@Param			ip				query		string	false	"IP"
 //	@Param			user			query		string	false	"User"
 //	@Success		200				{object}	middleware.APIResponse{data=model.GetLogsResult}
-//	@Router			/api/logs [get]
+//	@Router			/api/logs/ [get]
 func GetLogs(c *gin.Context) {
 	page, perPage := parsePageParams(c)
 	startTime, endTime := parseTimeRange(c)
@@ -444,7 +444,7 @@ func GetGroupUsedTokenNames(c *gin.Context) {
 //	@Security		ApiKeyAuth
 //	@Param			timestamp	query		int	true	"Timestamp (milliseconds)"
 //	@Success		200			{object}	middleware.APIResponse{data=int}
-//	@Router			/api/logs [delete]
+//	@Router			/api/logs/ [delete]
 func DeleteHistoryLogs(c *gin.Context) {
 	timestamp, _ := strconv.ParseInt(c.Query("timestamp"), 10, 64)
 	if timestamp == 0 {

+ 3 - 3
core/controller/modelconfig.go

@@ -17,7 +17,7 @@ import (
 //	@Security		ApiKeyAuth
 //	@Param			model	query		string	false	"Model name"
 //	@Success		200		{object}	middleware.APIResponse{data=map[string]any{configs=[]model.ModelConfig,total=int}}
-//	@Router			/api/model_configs [get]
+//	@Router			/api/model_configs/ [get]
 func GetModelConfigs(c *gin.Context) {
 	page, perPage := parsePageParams(c)
 	_model := c.Query("model")
@@ -124,7 +124,7 @@ type SaveModelConfigsRequest struct {
 //	@Security		ApiKeyAuth
 //	@Param			configs	body		[]SaveModelConfigsRequest	true	"Model configs"
 //	@Success		200		{object}	middleware.APIResponse
-//	@Router			/api/model_configs [post]
+//	@Router			/api/model_configs/ [post]
 func SaveModelConfigs(c *gin.Context) {
 	var configs []*SaveModelConfigsRequest
 	if err := c.ShouldBindJSON(&configs); err != nil {
@@ -152,7 +152,7 @@ func SaveModelConfigs(c *gin.Context) {
 //	@Security		ApiKeyAuth
 //	@Param			config	body		SaveModelConfigsRequest	true	"Model config"
 //	@Success		200		{object}	middleware.APIResponse
-//	@Router			/api/model_config [post]
+//	@Router			/api/model_config/ [post]
 func SaveModelConfig(c *gin.Context) {
 	var config SaveModelConfigsRequest
 	if err := c.ShouldBindJSON(&config); err != nil {

+ 2 - 2
core/controller/monitor.go

@@ -17,7 +17,7 @@ import (
 //	@Produce		json
 //	@Security		ApiKeyAuth
 //	@Success		200	{object}	middleware.APIResponse{data=map[int64]map[string]float64}
-//	@Router			/api/monitor [get]
+//	@Router			/api/monitor/ [get]
 func GetAllChannelModelErrorRates(c *gin.Context) {
 	rates, err := monitor.GetAllChannelModelErrorRates(c.Request.Context())
 	if err != nil {
@@ -59,7 +59,7 @@ func GetChannelModelErrorRates(c *gin.Context) {
 //	@Produce		json
 //	@Security		ApiKeyAuth
 //	@Success		200	{object}	middleware.APIResponse
-//	@Router			/api/monitor [delete]
+//	@Router			/api/monitor/ [delete]
 func ClearAllModelErrors(c *gin.Context) {
 	err := monitor.ClearAllModelErrors(c.Request.Context())
 	if err != nil {

+ 6 - 6
core/controller/option.go

@@ -17,7 +17,7 @@ import (
 //	@Produce		json
 //	@Security		ApiKeyAuth
 //	@Success		200	{object}	middleware.APIResponse{data=map[string]string}
-//	@Router			/api/options [get]
+//	@Router			/api/option/ [get]
 func GetOptions(c *gin.Context) {
 	dbOptions, err := model.GetAllOption()
 	if err != nil {
@@ -40,7 +40,7 @@ func GetOptions(c *gin.Context) {
 //	@Security		ApiKeyAuth
 //	@Param			key	path		string	true	"Option key"
 //	@Success		200	{object}	middleware.APIResponse{data=model.Option}
-//	@Router			/api/options/{key} [get]
+//	@Router			/api/option/{key} [get]
 func GetOption(c *gin.Context) {
 	key := c.Param("key")
 	if key == "" {
@@ -64,8 +64,8 @@ func GetOption(c *gin.Context) {
 //	@Security		ApiKeyAuth
 //	@Param			value	body		model.Option	true	"Option value"
 //	@Success		200		{object}	middleware.APIResponse
-//	@Router			/api/options/ [put]
-//	@Router			/api/options/ [post]
+//	@Router			/api/option/ [put]
+//	@Router			/api/option/ [post]
 func UpdateOption(c *gin.Context) {
 	var option model.Option
 	err := c.BindJSON(&option)
@@ -91,7 +91,7 @@ func UpdateOption(c *gin.Context) {
 //	@Param			key		path		string	true	"Option key"
 //	@Param			value	body		string	true	"Option value"
 //	@Success		200		{object}	middleware.APIResponse
-//	@Router			/api/options/{key} [put]
+//	@Router			/api/option/{key} [put]
 func UpdateOptionByKey(c *gin.Context) {
 	key := c.Param("key")
 	body, err := io.ReadAll(c.Request.Body)
@@ -116,7 +116,7 @@ func UpdateOptionByKey(c *gin.Context) {
 //	@Security		ApiKeyAuth
 //	@Param			options	body		map[string]string	true	"Options"
 //	@Success		200		{object}	middleware.APIResponse
-//	@Router			/api/options [post]
+//	@Router			/api/option/batch [post]
 func UpdateOptions(c *gin.Context) {
 	var options map[string]string
 	err := c.BindJSON(&options)

+ 4 - 4
core/controller/relay.go

@@ -49,7 +49,7 @@ func Completions() []gin.HandlerFunc {
 //	@Header			all				{integer}	X-RateLimit-Remaining-Tokens	"X-RateLimit-Remaining-Tokens"
 //	@Header			all				{string}	X-RateLimit-Reset-Requests		"X-RateLimit-Reset-Requests"
 //	@Header			all				{string}	X-RateLimit-Reset-Tokens		"X-RateLimit-Reset-Tokens"
-//	@Router			/v1/message [post]
+//	@Router			/v1/messages [post]
 func Anthropic() []gin.HandlerFunc {
 	return []gin.HandlerFunc{
 		middleware.NewDistribute(mode.Anthropic),
@@ -196,7 +196,7 @@ func AudioSpeech() []gin.HandlerFunc {
 //	@Header			all				{integer}	X-RateLimit-Remaining-Tokens	"X-RateLimit-Remaining-Tokens"
 //	@Header			all				{string}	X-RateLimit-Reset-Requests		"X-RateLimit-Reset-Requests"
 //	@Header			all				{string}	X-RateLimit-Reset-Tokens		"X-RateLimit-Reset-Tokens"
-//	@Router			/v1/audio/transcription [post]
+//	@Router			/v1/audio/transcriptions [post]
 func AudioTranscription() []gin.HandlerFunc {
 	return []gin.HandlerFunc{
 		middleware.NewDistribute(mode.AudioTranscription),
@@ -221,7 +221,7 @@ func AudioTranscription() []gin.HandlerFunc {
 //	@Header			all				{integer}	X-RateLimit-Remaining-Tokens	"X-RateLimit-Remaining-Tokens"
 //	@Header			all				{string}	X-RateLimit-Reset-Requests		"X-RateLimit-Reset-Requests"
 //	@Header			all				{string}	X-RateLimit-Reset-Tokens		"X-RateLimit-Reset-Tokens"
-//	@Router			/v1/audio/translation [post]
+//	@Router			/v1/audio/translations [post]
 func AudioTranslation() []gin.HandlerFunc {
 	return []gin.HandlerFunc{
 		middleware.NewDistribute(mode.AudioTranslation),
@@ -277,7 +277,7 @@ func Rerank() []gin.HandlerFunc {
 //	@Header			all				{integer}	X-RateLimit-Remaining-Tokens	"X-RateLimit-Remaining-Tokens"
 //	@Header			all				{string}	X-RateLimit-Reset-Requests		"X-RateLimit-Reset-Requests"
 //	@Header			all				{string}	X-RateLimit-Reset-Tokens		"X-RateLimit-Reset-Tokens"
-//	@Router			/v1/parse-pdf [post]
+//	@Router			/v1/parse/pdf [post]
 func ParsePdf() []gin.HandlerFunc {
 	return []gin.HandlerFunc{
 		middleware.NewDistribute(mode.ParsePdf),

+ 1 - 1
core/controller/token.go

@@ -116,7 +116,7 @@ func buildTokenResponses(tokens []*model.Token) []*TokenResponse {
 //	@Param			order		query		string	false	"Order"
 //	@Param			status		query		int		false	"Status"
 //	@Success		200			{object}	middleware.APIResponse{data=map[string]any{tokens=[]TokenResponse,total=int}}
-//	@Router			/api/tokens [get]
+//	@Router			/api/tokens/ [get]
 func GetTokens(c *gin.Context) {
 	page, perPage := parsePageParams(c)
 	group := c.Query("group")

+ 82 - 82
core/docs/docs.go

@@ -15,7 +15,7 @@ const docTemplate = `{
     "host": "{{.Host}}",
     "basePath": "{{.BasePath}}",
     "paths": {
-        "/api/channel": {
+        "/api/channel/": {
             "post": {
                 "security": [
                     {
@@ -234,7 +234,53 @@ const docTemplate = `{
                 }
             }
         },
-        "/api/channel/{id}/models": {
+        "/api/channel/{id}/status": {
+            "post": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "description": "Updates the status of a channel by its ID",
+                "consumes": [
+                    "application/json"
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "channel"
+                ],
+                "summary": "Update channel status",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "Channel ID",
+                        "name": "id",
+                        "in": "path",
+                        "required": true
+                    },
+                    {
+                        "description": "Status information",
+                        "name": "status",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/controller.UpdateChannelStatusRequest"
+                        }
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/middleware.APIResponse"
+                        }
+                    }
+                }
+            }
+        },
+        "/api/channel/{id}/test": {
             "get": {
                 "security": [
                     {
@@ -301,52 +347,6 @@ const docTemplate = `{
                 }
             }
         },
-        "/api/channel/{id}/status": {
-            "post": {
-                "security": [
-                    {
-                        "ApiKeyAuth": []
-                    }
-                ],
-                "description": "Updates the status of a channel by its ID",
-                "consumes": [
-                    "application/json"
-                ],
-                "produces": [
-                    "application/json"
-                ],
-                "tags": [
-                    "channel"
-                ],
-                "summary": "Update channel status",
-                "parameters": [
-                    {
-                        "type": "integer",
-                        "description": "Channel ID",
-                        "name": "id",
-                        "in": "path",
-                        "required": true
-                    },
-                    {
-                        "description": "Status information",
-                        "name": "status",
-                        "in": "body",
-                        "required": true,
-                        "schema": {
-                            "$ref": "#/definitions/controller.UpdateChannelStatusRequest"
-                        }
-                    }
-                ],
-                "responses": {
-                    "200": {
-                        "description": "OK",
-                        "schema": {
-                            "$ref": "#/definitions/middleware.APIResponse"
-                        }
-                    }
-                }
-            }
-        },
         "/api/channel/{id}/{model}": {
             "get": {
                 "security": [
@@ -400,7 +400,7 @@ const docTemplate = `{
                 }
             }
         },
-        "/api/channels": {
+        "/api/channels/": {
             "get": {
                 "security": [
                     {
@@ -921,7 +921,7 @@ const docTemplate = `{
                 }
             }
         },
-        "/api/dashboard": {
+        "/api/dashboard/": {
             "get": {
                 "security": [
                     {
@@ -1835,7 +1835,7 @@ const docTemplate = `{
                 }
             }
         },
-        "/api/groups": {
+        "/api/groups/": {
             "get": {
                 "security": [
                     {
@@ -2568,7 +2568,7 @@ const docTemplate = `{
                 }
             }
         },
-        "/api/logs": {
+        "/api/logs/": {
             "get": {
                 "security": [
                     {
@@ -3774,7 +3774,7 @@ const docTemplate = `{
                 }
             }
         },
-        "/api/model_config": {
+        "/api/model_config/": {
             "post": {
                 "security": [
                     {
@@ -3888,7 +3888,7 @@ const docTemplate = `{
                 }
             }
         },
-        "/api/model_configs": {
+        "/api/model_configs/": {
             "get": {
                 "security": [
                     {
@@ -4207,7 +4207,7 @@ const docTemplate = `{
                 }
             }
         },
-        "/api/model_cost_rank": {
+        "/api/model_cost_rank/": {
             "get": {
                 "security": [
                     {
@@ -4820,7 +4820,7 @@ const docTemplate = `{
                 }
             }
         },
-        "/api/monitor": {
+        "/api/monitor/": {
             "get": {
                 "security": [
                     {
@@ -5094,7 +5094,7 @@ const docTemplate = `{
                 }
             }
         },
-        "/api/options": {
+        "/api/option/": {
             "get": {
                 "security": [
                     {
@@ -5133,31 +5133,28 @@ const docTemplate = `{
                     }
                 }
             },
-            "post": {
+            "put": {
                 "security": [
                     {
                         "ApiKeyAuth": []
                     }
                 ],
-                "description": "Updates multiple options",
+                "description": "Updates a single option",
                 "produces": [
                     "application/json"
                 ],
                 "tags": [
                     "option"
                 ],
-                "summary": "Update options",
+                "summary": "Update option",
                 "parameters": [
                     {
-                        "description": "Options",
-                        "name": "options",
+                        "description": "Option value",
+                        "name": "value",
                         "in": "body",
                         "required": true,
                         "schema": {
-                            "type": "object",
-                            "additionalProperties": {
-                                "type": "string"
-                            }
+                            "$ref": "#/definitions/model.Option"
                         }
                     }
                 ],
@@ -5169,10 +5166,8 @@ const docTemplate = `{
                         }
                     }
                 }
-            }
-        },
-        "/api/options/": {
-            "put": {
+            },
+            "post": {
                 "security": [
                     {
                         "ApiKeyAuth": []
@@ -5205,29 +5200,34 @@ const docTemplate = `{
                         }
                     }
                 }
-            },
+            }
+        },
+        "/api/option/batch": {
             "post": {
                 "security": [
                     {
                         "ApiKeyAuth": []
                     }
                 ],
-                "description": "Updates a single option",
+                "description": "Updates multiple options",
                 "produces": [
                     "application/json"
                 ],
                 "tags": [
                     "option"
                 ],
-                "summary": "Update option",
+                "summary": "Update options",
                 "parameters": [
                     {
-                        "description": "Option value",
-                        "name": "value",
+                        "description": "Options",
+                        "name": "options",
                         "in": "body",
                         "required": true,
                         "schema": {
-                            "$ref": "#/definitions/model.Option"
+                            "type": "object",
+                            "additionalProperties": {
+                                "type": "string"
+                            }
                         }
                     }
                 ],
@@ -5241,7 +5241,7 @@ const docTemplate = `{
                 }
             }
         },
-        "/api/options/{key}": {
+        "/api/option/{key}": {
             "get": {
                 "security": [
                     {
@@ -5844,7 +5844,7 @@ const docTemplate = `{
                 }
             }
         },
-        "/api/tokens": {
+        "/api/tokens/": {
             "get": {
                 "security": [
                     {
@@ -6515,7 +6515,7 @@ const docTemplate = `{
                 }
             }
         },
-        "/v1/audio/transcription": {
+        "/v1/audio/transcriptions": {
             "post": {
                 "security": [
                     {
@@ -6588,7 +6588,7 @@ const docTemplate = `{
                 }
             }
         },
-        "/v1/audio/translation": {
+        "/v1/audio/translations": {
             "post": {
                 "security": [
                     {
@@ -7063,7 +7063,7 @@ const docTemplate = `{
                 }
             }
         },
-        "/v1/message": {
+        "/v1/messages": {
             "post": {
                 "security": [
                     {
@@ -7192,7 +7192,7 @@ const docTemplate = `{
                 }
             }
         },
-        "/v1/parse-pdf": {
+        "/v1/parse/pdf": {
             "post": {
                 "security": [
                     {

+ 82 - 82
core/docs/swagger.json

@@ -6,7 +6,7 @@
         "version": "1.0"
     },
     "paths": {
-        "/api/channel": {
+        "/api/channel/": {
             "post": {
                 "security": [
                     {
@@ -225,7 +225,53 @@
                 }
             }
         },
-        "/api/channel/{id}/models": {
+        "/api/channel/{id}/status": {
+            "post": {
+                "security": [
+                    {
+                        "ApiKeyAuth": []
+                    }
+                ],
+                "description": "Updates the status of a channel by its ID",
+                "consumes": [
+                    "application/json"
+                ],
+                "produces": [
+                    "application/json"
+                ],
+                "tags": [
+                    "channel"
+                ],
+                "summary": "Update channel status",
+                "parameters": [
+                    {
+                        "type": "integer",
+                        "description": "Channel ID",
+                        "name": "id",
+                        "in": "path",
+                        "required": true
+                    },
+                    {
+                        "description": "Status information",
+                        "name": "status",
+                        "in": "body",
+                        "required": true,
+                        "schema": {
+                            "$ref": "#/definitions/controller.UpdateChannelStatusRequest"
+                        }
+                    }
+                ],
+                "responses": {
+                    "200": {
+                        "description": "OK",
+                        "schema": {
+                            "$ref": "#/definitions/middleware.APIResponse"
+                        }
+                    }
+                }
+            }
+        },
+        "/api/channel/{id}/test": {
             "get": {
                 "security": [
                     {
@@ -292,52 +338,6 @@
                 }
             }
         },
-        "/api/channel/{id}/status": {
-            "post": {
-                "security": [
-                    {
-                        "ApiKeyAuth": []
-                    }
-                ],
-                "description": "Updates the status of a channel by its ID",
-                "consumes": [
-                    "application/json"
-                ],
-                "produces": [
-                    "application/json"
-                ],
-                "tags": [
-                    "channel"
-                ],
-                "summary": "Update channel status",
-                "parameters": [
-                    {
-                        "type": "integer",
-                        "description": "Channel ID",
-                        "name": "id",
-                        "in": "path",
-                        "required": true
-                    },
-                    {
-                        "description": "Status information",
-                        "name": "status",
-                        "in": "body",
-                        "required": true,
-                        "schema": {
-                            "$ref": "#/definitions/controller.UpdateChannelStatusRequest"
-                        }
-                    }
-                ],
-                "responses": {
-                    "200": {
-                        "description": "OK",
-                        "schema": {
-                            "$ref": "#/definitions/middleware.APIResponse"
-                        }
-                    }
-                }
-            }
-        },
         "/api/channel/{id}/{model}": {
             "get": {
                 "security": [
@@ -391,7 +391,7 @@
                 }
             }
         },
-        "/api/channels": {
+        "/api/channels/": {
             "get": {
                 "security": [
                     {
@@ -912,7 +912,7 @@
                 }
             }
         },
-        "/api/dashboard": {
+        "/api/dashboard/": {
             "get": {
                 "security": [
                     {
@@ -1826,7 +1826,7 @@
                 }
             }
         },
-        "/api/groups": {
+        "/api/groups/": {
             "get": {
                 "security": [
                     {
@@ -2559,7 +2559,7 @@
                 }
             }
         },
-        "/api/logs": {
+        "/api/logs/": {
             "get": {
                 "security": [
                     {
@@ -3765,7 +3765,7 @@
                 }
             }
         },
-        "/api/model_config": {
+        "/api/model_config/": {
             "post": {
                 "security": [
                     {
@@ -3879,7 +3879,7 @@
                 }
             }
         },
-        "/api/model_configs": {
+        "/api/model_configs/": {
             "get": {
                 "security": [
                     {
@@ -4198,7 +4198,7 @@
                 }
             }
         },
-        "/api/model_cost_rank": {
+        "/api/model_cost_rank/": {
             "get": {
                 "security": [
                     {
@@ -4811,7 +4811,7 @@
                 }
             }
         },
-        "/api/monitor": {
+        "/api/monitor/": {
             "get": {
                 "security": [
                     {
@@ -5085,7 +5085,7 @@
                 }
             }
         },
-        "/api/options": {
+        "/api/option/": {
             "get": {
                 "security": [
                     {
@@ -5124,31 +5124,28 @@
                     }
                 }
             },
-            "post": {
+            "put": {
                 "security": [
                     {
                         "ApiKeyAuth": []
                     }
                 ],
-                "description": "Updates multiple options",
+                "description": "Updates a single option",
                 "produces": [
                     "application/json"
                 ],
                 "tags": [
                     "option"
                 ],
-                "summary": "Update options",
+                "summary": "Update option",
                 "parameters": [
                     {
-                        "description": "Options",
-                        "name": "options",
+                        "description": "Option value",
+                        "name": "value",
                         "in": "body",
                         "required": true,
                         "schema": {
-                            "type": "object",
-                            "additionalProperties": {
-                                "type": "string"
-                            }
+                            "$ref": "#/definitions/model.Option"
                         }
                     }
                 ],
@@ -5160,10 +5157,8 @@
                         }
                     }
                 }
-            }
-        },
-        "/api/options/": {
-            "put": {
+            },
+            "post": {
                 "security": [
                     {
                         "ApiKeyAuth": []
@@ -5196,29 +5191,34 @@
                         }
                     }
                 }
-            },
+            }
+        },
+        "/api/option/batch": {
             "post": {
                 "security": [
                     {
                         "ApiKeyAuth": []
                     }
                 ],
-                "description": "Updates a single option",
+                "description": "Updates multiple options",
                 "produces": [
                     "application/json"
                 ],
                 "tags": [
                     "option"
                 ],
-                "summary": "Update option",
+                "summary": "Update options",
                 "parameters": [
                     {
-                        "description": "Option value",
-                        "name": "value",
+                        "description": "Options",
+                        "name": "options",
                         "in": "body",
                         "required": true,
                         "schema": {
-                            "$ref": "#/definitions/model.Option"
+                            "type": "object",
+                            "additionalProperties": {
+                                "type": "string"
+                            }
                         }
                     }
                 ],
@@ -5232,7 +5232,7 @@
                 }
             }
         },
-        "/api/options/{key}": {
+        "/api/option/{key}": {
             "get": {
                 "security": [
                     {
@@ -5835,7 +5835,7 @@
                 }
             }
         },
-        "/api/tokens": {
+        "/api/tokens/": {
             "get": {
                 "security": [
                     {
@@ -6506,7 +6506,7 @@
                 }
             }
         },
-        "/v1/audio/transcription": {
+        "/v1/audio/transcriptions": {
             "post": {
                 "security": [
                     {
@@ -6579,7 +6579,7 @@
                 }
             }
         },
-        "/v1/audio/translation": {
+        "/v1/audio/translations": {
             "post": {
                 "security": [
                     {
@@ -7054,7 +7054,7 @@
                 }
             }
         },
-        "/v1/message": {
+        "/v1/messages": {
             "post": {
                 "security": [
                     {
@@ -7183,7 +7183,7 @@
                 }
             }
         },
-        "/v1/parse-pdf": {
+        "/v1/parse/pdf": {
             "post": {
                 "security": [
                     {

+ 70 - 70
core/docs/swagger.yaml

@@ -1601,7 +1601,7 @@ info:
   title: AI Proxy Swagger API
   version: "1.0"
 paths:
-  /api/channel:
+  /api/channel/:
     post:
       consumes:
       - application/json
@@ -1761,7 +1761,36 @@ paths:
       summary: Update channel balance
       tags:
       - channel
-  /api/channel/{id}/models:
+  /api/channel/{id}/status:
+    post:
+      consumes:
+      - application/json
+      description: Updates the status of a channel by its ID
+      parameters:
+      - description: Channel ID
+        in: path
+        name: id
+        required: true
+        type: integer
+      - description: Status information
+        in: body
+        name: status
+        required: true
+        schema:
+          $ref: '#/definitions/controller.UpdateChannelStatusRequest'
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            $ref: '#/definitions/middleware.APIResponse'
+      security:
+      - ApiKeyAuth: []
+      summary: Update channel status
+      tags:
+      - channel
+  /api/channel/{id}/test:
     get:
       description: Tests all models in the channel
       parameters:
@@ -1801,36 +1830,7 @@ paths:
       summary: Test channel models
       tags:
       - channel
-  /api/channel/{id}/status:
-    post:
-      consumes:
-      - application/json
-      description: Updates the status of a channel by its ID
-      parameters:
-      - description: Channel ID
-        in: path
-        name: id
-        required: true
-        type: integer
-      - description: Status information
-        in: body
-        name: status
-        required: true
-        schema:
-          $ref: '#/definitions/controller.UpdateChannelStatusRequest'
-      produces:
-      - application/json
-      responses:
-        "200":
-          description: OK
-          schema:
-            $ref: '#/definitions/middleware.APIResponse'
-      security:
-      - ApiKeyAuth: []
-      summary: Update channel status
-      tags:
-      - channel
-  /api/channels:
+  /api/channels/:
     get:
       description: Returns a paginated list of channels with optional filters
       parameters:
@@ -2140,7 +2140,7 @@ paths:
       summary: Get channel type metadata
       tags:
       - channels
-  /api/dashboard:
+  /api/dashboard/:
     get:
       description: Returns the general dashboard data including usage statistics and
         metrics
@@ -2700,7 +2700,7 @@ paths:
       summary: Update group TPM ratio
       tags:
       - group
-  /api/groups:
+  /api/groups/:
     get:
       description: Returns a list of all groups with pagination
       parameters:
@@ -3146,7 +3146,7 @@ paths:
       summary: Get group used token names
       tags:
       - log
-  /api/logs:
+  /api/logs/:
     delete:
       description: Deletes logs older than the specified retention period
       parameters:
@@ -3877,7 +3877,7 @@ paths:
       summary: Create or update group MCP reusing parameters
       tags:
       - mcp
-  /api/model_config:
+  /api/model_config/:
     post:
       description: Saves a model config
       parameters:
@@ -3945,7 +3945,7 @@ paths:
       summary: Get model config
       tags:
       - modelconfig
-  /api/model_configs:
+  /api/model_configs/:
     get:
       description: Returns a list of model configs with pagination
       parameters:
@@ -4131,7 +4131,7 @@ paths:
       summary: Search model configs
       tags:
       - modelconfig
-  /api/model_cost_rank:
+  /api/model_cost_rank/:
     get:
       description: Returns ranking data for models based on cost
       parameters:
@@ -4496,7 +4496,7 @@ paths:
       summary: Get enabled models by set
       tags:
       - model
-  /api/monitor:
+  /api/monitor/:
     delete:
       description: Clears all model errors
       produces:
@@ -4656,7 +4656,7 @@ paths:
       summary: Get models error rate
       tags:
       - monitor
-  /api/options:
+  /api/option/:
     get:
       description: Returns a list of options
       produces:
@@ -4678,30 +4678,6 @@ paths:
       summary: Get options
       tags:
       - option
-    post:
-      description: Updates multiple options
-      parameters:
-      - description: Options
-        in: body
-        name: options
-        required: true
-        schema:
-          additionalProperties:
-            type: string
-          type: object
-      produces:
-      - application/json
-      responses:
-        "200":
-          description: OK
-          schema:
-            $ref: '#/definitions/middleware.APIResponse'
-      security:
-      - ApiKeyAuth: []
-      summary: Update options
-      tags:
-      - option
-  /api/options/:
     post:
       description: Updates a single option
       parameters:
@@ -4744,7 +4720,7 @@ paths:
       summary: Update option
       tags:
       - option
-  /api/options/{key}:
+  /api/option/{key}:
     get:
       description: Returns a single option
       parameters:
@@ -4796,6 +4772,30 @@ paths:
       summary: Update option by key
       tags:
       - option
+  /api/option/batch:
+    post:
+      description: Updates multiple options
+      parameters:
+      - description: Options
+        in: body
+        name: options
+        required: true
+        schema:
+          additionalProperties:
+            type: string
+          type: object
+      produces:
+      - application/json
+      responses:
+        "200":
+          description: OK
+          schema:
+            $ref: '#/definitions/middleware.APIResponse'
+      security:
+      - ApiKeyAuth: []
+      summary: Update options
+      tags:
+      - option
   /api/status:
     get:
       description: Returns the status of the server
@@ -5114,7 +5114,7 @@ paths:
       summary: Search tokens for a specific group
       tags:
       - token
-  /api/tokens:
+  /api/tokens/:
     get:
       description: Returns a paginated list of all tokens
       parameters:
@@ -5527,7 +5527,7 @@ paths:
       summary: AudioSpeech
       tags:
       - relay
-  /v1/audio/transcription:
+  /v1/audio/transcriptions:
     post:
       description: AudioTranscription
       parameters:
@@ -5576,7 +5576,7 @@ paths:
       summary: AudioTranscription
       tags:
       - relay
-  /v1/audio/translation:
+  /v1/audio/translations:
     post:
       description: AudioTranslation
       parameters:
@@ -5889,7 +5889,7 @@ paths:
       summary: ImagesGenerations
       tags:
       - relay
-  /v1/message:
+  /v1/messages:
     post:
       description: Anthropic
       parameters:
@@ -5971,7 +5971,7 @@ paths:
       summary: Retrieve model
       tags:
       - relay
-  /v1/parse-pdf:
+  /v1/parse/pdf:
     post:
       description: ParsePdf
       parameters: