{ "swagger": "2.0", "info": { "description": "Management API for EZ-API Gateway system.", "title": "EZ-API Control Plane", "termsOfService": "http://swagger.io/terms/", "contact": { "name": "API Support", "url": "http://www.swagger.io/support", "email": "support@swagger.io" }, "license": { "name": "Apache 2.0", "url": "http://www.apache.org/licenses/LICENSE-2.0.html" }, "version": "0.0.1" }, "host": "localhost:8080", "basePath": "/", "paths": { "/admin/bindings": { "get": { "security": [ { "AdminAuth": [] } ], "description": "List all configured bindings", "produces": [ "application/json" ], "tags": [ "admin" ], "summary": "List bindings", "parameters": [ { "type": "integer", "description": "page (1-based)", "name": "page", "in": "query" }, { "type": "integer", "description": "limit (default 50, max 200)", "name": "limit", "in": "query" }, { "type": "string", "description": "search by namespace/public_model/route_group", "name": "search", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/github_com_ez-api_ez-api_internal_model.Binding" } } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } }, "post": { "security": [ { "AdminAuth": [] } ], "description": "Create a new (namespace, public_model) binding to a route group and selector", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "admin" ], "summary": "Create a new binding", "parameters": [ { "description": "Binding Info", "name": "binding", "in": "body", "required": true, "schema": { "$ref": "#/definitions/github_com_ez-api_ez-api_internal_dto.BindingDTO" } } ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/github_com_ez-api_ez-api_internal_model.Binding" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/gin.H" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } } }, "/admin/bindings/batch": { "post": { "security": [ { "AdminAuth": [] } ], "description": "Batch delete or status update for bindings", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "admin" ], "summary": "Batch bindings", "parameters": [ { "description": "Batch payload", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_api.BatchActionRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api.BatchResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/gin.H" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } } }, "/admin/bindings/{id}": { "get": { "security": [ { "AdminAuth": [] } ], "description": "Get a binding by id", "produces": [ "application/json" ], "tags": [ "admin" ], "summary": "Get a binding", "parameters": [ { "type": "integer", "description": "Binding ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/github_com_ez-api_ez-api_internal_model.Binding" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/gin.H" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/gin.H" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } }, "put": { "security": [ { "AdminAuth": [] } ], "description": "Update an existing binding", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "admin" ], "summary": "Update a binding", "parameters": [ { "type": "integer", "description": "Binding ID", "name": "id", "in": "path", "required": true }, { "description": "Binding Info", "name": "binding", "in": "body", "required": true, "schema": { "$ref": "#/definitions/github_com_ez-api_ez-api_internal_dto.BindingDTO" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/github_com_ez-api_ez-api_internal_model.Binding" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/gin.H" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/gin.H" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } }, "delete": { "security": [ { "AdminAuth": [] } ], "description": "Delete a binding by id and rebuild bindings snapshot", "produces": [ "application/json" ], "tags": [ "admin" ], "summary": "Delete a binding", "parameters": [ { "type": "integer", "description": "Binding ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/gin.H" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/gin.H" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/gin.H" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } } }, "/admin/features": { "get": { "security": [ { "AdminAuth": [] } ], "description": "Returns all feature flags stored in Redis (meta:features)", "produces": [ "application/json" ], "tags": [ "admin" ], "summary": "List feature flags", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/gin.H" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } }, "put": { "security": [ { "AdminAuth": [] } ], "description": "Updates selected feature flags (meta:features). Values are stored as strings.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "admin" ], "summary": "Update feature flags", "parameters": [ { "description": "Feature map", "name": "request", "in": "body", "required": true, "schema": { "type": "object" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/gin.H" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/gin.H" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } } }, "/admin/keys/{id}/access": { "get": { "security": [ { "AdminAuth": [] } ], "description": "Returns key default_namespace and namespaces", "produces": [ "application/json" ], "tags": [ "admin" ], "summary": "Get key access settings", "parameters": [ { "type": "integer", "description": "Key ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api.AccessResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/gin.H" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/gin.H" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } }, "put": { "security": [ { "AdminAuth": [] } ], "description": "Updates key default_namespace and namespaces and syncs to Redis", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "admin" ], "summary": "Update key access settings", "parameters": [ { "type": "integer", "description": "Key ID", "name": "id", "in": "path", "required": true }, { "description": "Access settings", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_api.UpdateAccessRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api.AccessResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/gin.H" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/gin.H" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } } }, "/admin/logs": { "get": { "security": [ { "AdminAuth": [] } ], "description": "List request logs with basic filtering/pagination", "produces": [ "application/json" ], "tags": [ "admin" ], "summary": "List logs (admin)", "parameters": [ { "type": "integer", "description": "limit (default 50, max 200)", "name": "limit", "in": "query" }, { "type": "integer", "description": "offset", "name": "offset", "in": "query" }, { "type": "integer", "description": "unix seconds", "name": "since", "in": "query" }, { "type": "integer", "description": "unix seconds", "name": "until", "in": "query" }, { "type": "integer", "description": "key id", "name": "key_id", "in": "query" }, { "type": "string", "description": "route group", "name": "group", "in": "query" }, { "type": "string", "description": "model", "name": "model", "in": "query" }, { "type": "integer", "description": "status code", "name": "status_code", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api.ListMasterLogsResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } }, "delete": { "security": [ { "AdminAuth": [] } ], "description": "Delete logs before a given timestamp with optional filters", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "admin" ], "summary": "Delete logs (admin)", "parameters": [ { "description": "Delete filters", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_api.DeleteLogsRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api.DeleteLogsResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/gin.H" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } } }, "/admin/logs/stats": { "get": { "security": [ { "AdminAuth": [] } ], "description": "Aggregate log stats with basic filtering", "produces": [ "application/json" ], "tags": [ "admin" ], "summary": "Log stats (admin)", "parameters": [ { "type": "integer", "description": "unix seconds", "name": "since", "in": "query" }, { "type": "integer", "description": "unix seconds", "name": "until", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api.LogStatsResponse" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } } }, "/admin/logs/webhook": { "get": { "security": [ { "AdminAuth": [] } ], "description": "Returns current webhook notification config", "produces": [ "application/json" ], "tags": [ "admin" ], "summary": "Get log webhook config", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/github_com_ez-api_ez-api_internal_service.LogWebhookConfig" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } }, "put": { "security": [ { "AdminAuth": [] } ], "description": "Updates webhook notification config", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "admin" ], "summary": "Update log webhook config", "parameters": [ { "description": "Webhook config", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/github_com_ez-api_ez-api_internal_service.LogWebhookConfig" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/github_com_ez-api_ez-api_internal_service.LogWebhookConfig" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/gin.H" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } } }, "/admin/masters": { "get": { "security": [ { "AdminAuth": [] } ], "description": "List all master tenants", "produces": [ "application/json" ], "tags": [ "admin" ], "summary": "List masters", "parameters": [ { "type": "integer", "description": "page (1-based)", "name": "page", "in": "query" }, { "type": "integer", "description": "limit (default 50, max 200)", "name": "limit", "in": "query" }, { "type": "string", "description": "search by name/group", "name": "search", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/internal_api.MasterView" } } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } }, "post": { "security": [ { "AdminAuth": [] } ], "description": "Create a new master account (tenant)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "admin" ], "summary": "Create a new master tenant", "parameters": [ { "description": "Master Info", "name": "master", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_api.CreateMasterRequest" } } ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/gin.H" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/gin.H" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } } }, "/admin/masters/batch": { "post": { "security": [ { "AdminAuth": [] } ], "description": "Batch delete or status update for masters", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "admin" ], "summary": "Batch masters", "parameters": [ { "description": "Batch payload", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_api.BatchActionRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api.BatchResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/gin.H" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } } }, "/admin/masters/{id}": { "get": { "security": [ { "AdminAuth": [] } ], "description": "Get a master tenant by id", "produces": [ "application/json" ], "tags": [ "admin" ], "summary": "Get master", "parameters": [ { "type": "integer", "description": "Master ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api.MasterView" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/gin.H" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/gin.H" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } }, "put": { "security": [ { "AdminAuth": [] } ], "description": "Update master fields; optionally propagate group to existing keys", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "admin" ], "summary": "Update master", "parameters": [ { "type": "integer", "description": "Master ID", "name": "id", "in": "path", "required": true }, { "description": "Update payload", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_api.UpdateMasterRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api.MasterView" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/gin.H" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/gin.H" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } }, "delete": { "security": [ { "AdminAuth": [] } ], "description": "Suspends a master and revokes all existing keys by bumping epoch and syncing to Redis", "produces": [ "application/json" ], "tags": [ "admin" ], "summary": "Delete (revoke) master", "parameters": [ { "type": "integer", "description": "Master ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/gin.H" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/gin.H" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/gin.H" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } } }, "/admin/masters/{id}/access": { "get": { "security": [ { "AdminAuth": [] } ], "description": "Returns master default_namespace and namespaces", "produces": [ "application/json" ], "tags": [ "admin" ], "summary": "Get master access settings", "parameters": [ { "type": "integer", "description": "Master ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api.AccessResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/gin.H" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/gin.H" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } }, "put": { "security": [ { "AdminAuth": [] } ], "description": "Updates master default_namespace and namespaces; optionally propagate to existing keys", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "admin" ], "summary": "Update master access settings", "parameters": [ { "type": "integer", "description": "Master ID", "name": "id", "in": "path", "required": true }, { "description": "Access settings", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_api.UpdateAccessRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api.AccessResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/gin.H" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/gin.H" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } } }, "/admin/masters/{id}/keys": { "post": { "security": [ { "AdminAuth": [] } ], "description": "Issue a new access token (child key) for a specified master. The key still belongs to the master; issuer is recorded as admin for audit.", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "admin" ], "summary": "Issue a child key on behalf of a master", "parameters": [ { "type": "integer", "description": "Master ID", "name": "id", "in": "path", "required": true }, { "description": "Key Request", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_api.IssueChildKeyRequest" } } ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/gin.H" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/gin.H" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/gin.H" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/gin.H" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } } }, "/admin/masters/{id}/manage": { "post": { "security": [ { "AdminAuth": [] } ], "description": "Freeze or unfreeze a master tenant", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "admin" ], "summary": "Manage master status", "parameters": [ { "type": "integer", "description": "Master ID", "name": "id", "in": "path", "required": true }, { "description": "Action", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_api.ManageMasterRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api.MasterView" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/gin.H" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/gin.H" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } } }, "/admin/masters/{id}/realtime": { "get": { "security": [ { "AdminAuth": [] } ], "description": "Return realtime counters for the specified master", "produces": [ "application/json" ], "tags": [ "admin" ], "summary": "Master realtime stats (admin)", "parameters": [ { "type": "integer", "description": "Master ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api.MasterRealtimeView" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/gin.H" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/gin.H" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } } }, "/admin/model-registry/check": { "post": { "security": [ { "AdminAuth": [] } ], "description": "Checks models.dev commit SHA for a ref and indicates whether refresh is needed (does not apply changes)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "admin" ], "summary": "Check model registry upstream version", "parameters": [ { "description": "optional override ref", "name": "body", "in": "body", "schema": { "$ref": "#/definitions/internal_api.refreshModelRegistryRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/github_com_ez-api_ez-api_internal_service.ModelRegistryCheckResult" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/gin.H" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } } }, "/admin/model-registry/refresh": { "post": { "security": [ { "AdminAuth": [] } ], "description": "Fetches models.dev, computes per-binding capabilities, and updates Redis meta:models", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "admin" ], "summary": "Refresh model registry from models.dev", "parameters": [ { "description": "optional override ref", "name": "body", "in": "body", "schema": { "$ref": "#/definitions/internal_api.refreshModelRegistryRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/gin.H" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/gin.H" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } } }, "/admin/model-registry/rollback": { "post": { "security": [ { "AdminAuth": [] } ], "description": "Rollback meta:models to previous cached last-good version", "produces": [ "application/json" ], "tags": [ "admin" ], "summary": "Rollback model registry", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/gin.H" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } } }, "/admin/model-registry/status": { "get": { "security": [ { "AdminAuth": [] } ], "description": "Returns Redis meta and local last-good cache info for model capability registry", "produces": [ "application/json" ], "tags": [ "admin" ], "summary": "Get model registry status", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/github_com_ez-api_ez-api_internal_service.ModelRegistryStatus" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } } }, "/admin/models": { "get": { "security": [ { "AdminAuth": [] } ], "description": "Get a list of all registered models", "produces": [ "application/json" ], "tags": [ "admin" ], "summary": "List all models", "parameters": [ { "type": "integer", "description": "page (1-based)", "name": "page", "in": "query" }, { "type": "integer", "description": "limit (default 50, max 200)", "name": "limit", "in": "query" }, { "type": "string", "description": "search by name/kind", "name": "search", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/github_com_ez-api_ez-api_internal_model.Model" } } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } }, "post": { "security": [ { "AdminAuth": [] } ], "description": "Register a supported model with its capabilities", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "admin" ], "summary": "Register a new model", "parameters": [ { "description": "Model Info", "name": "model", "in": "body", "required": true, "schema": { "$ref": "#/definitions/github_com_ez-api_ez-api_internal_dto.ModelDTO" } } ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/github_com_ez-api_ez-api_internal_model.Model" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/gin.H" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } } }, "/admin/models/batch": { "post": { "security": [ { "AdminAuth": [] } ], "description": "Batch delete for models", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "admin" ], "summary": "Batch models", "parameters": [ { "description": "Batch payload", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_api.BatchActionRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api.BatchResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/gin.H" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } } }, "/admin/models/{id}": { "put": { "security": [ { "AdminAuth": [] } ], "description": "Update an existing model's configuration", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "admin" ], "summary": "Update a model", "parameters": [ { "type": "integer", "description": "Model ID", "name": "id", "in": "path", "required": true }, { "description": "Model Info", "name": "model", "in": "body", "required": true, "schema": { "$ref": "#/definitions/github_com_ez-api_ez-api_internal_dto.ModelDTO" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/github_com_ez-api_ez-api_internal_model.Model" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/gin.H" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/gin.H" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } }, "delete": { "security": [ { "AdminAuth": [] } ], "description": "Delete a model by id", "produces": [ "application/json" ], "tags": [ "admin" ], "summary": "Delete a model", "parameters": [ { "type": "integer", "description": "Model ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/gin.H" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/gin.H" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/gin.H" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } } }, "/admin/namespaces": { "get": { "security": [ { "AdminAuth": [] } ], "description": "List all namespaces", "produces": [ "application/json" ], "tags": [ "admin" ], "summary": "List namespaces", "parameters": [ { "type": "integer", "description": "page (1-based)", "name": "page", "in": "query" }, { "type": "integer", "description": "limit (default 50, max 200)", "name": "limit", "in": "query" }, { "type": "string", "description": "search by name/description", "name": "search", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/github_com_ez-api_ez-api_internal_model.Namespace" } } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } }, "post": { "security": [ { "AdminAuth": [] } ], "description": "Create a namespace for bindings", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "admin" ], "summary": "Create namespace", "parameters": [ { "description": "Namespace payload", "name": "namespace", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_api.NamespaceRequest" } } ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/github_com_ez-api_ez-api_internal_model.Namespace" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/gin.H" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } } }, "/admin/namespaces/{id}": { "get": { "security": [ { "AdminAuth": [] } ], "description": "Get a namespace by id", "produces": [ "application/json" ], "tags": [ "admin" ], "summary": "Get namespace", "parameters": [ { "type": "integer", "description": "Namespace ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/github_com_ez-api_ez-api_internal_model.Namespace" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/gin.H" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/gin.H" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } }, "put": { "security": [ { "AdminAuth": [] } ], "description": "Update a namespace", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "admin" ], "summary": "Update namespace", "parameters": [ { "type": "integer", "description": "Namespace ID", "name": "id", "in": "path", "required": true }, { "description": "Update payload", "name": "namespace", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_api.UpdateNamespaceRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/github_com_ez-api_ez-api_internal_model.Namespace" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/gin.H" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/gin.H" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } }, "delete": { "security": [ { "AdminAuth": [] } ], "description": "Delete a namespace and its bindings", "produces": [ "application/json" ], "tags": [ "admin" ], "summary": "Delete namespace", "parameters": [ { "type": "integer", "description": "Namespace ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/gin.H" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/gin.H" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/gin.H" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } } }, "/admin/operation-logs": { "get": { "security": [ { "AdminAuth": [] } ], "description": "List admin operation logs", "produces": [ "application/json" ], "tags": [ "admin" ], "summary": "List operation logs", "parameters": [ { "type": "integer", "description": "page (1-based)", "name": "page", "in": "query" }, { "type": "integer", "description": "limit (default 50, max 200)", "name": "limit", "in": "query" }, { "type": "string", "description": "search by actor/method/path", "name": "search", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/internal_api.OperationLogView" } } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } } }, "/admin/providers": { "get": { "security": [ { "AdminAuth": [] } ], "description": "List all configured upstream providers", "produces": [ "application/json" ], "tags": [ "admin" ], "summary": "List providers", "parameters": [ { "type": "integer", "description": "page (1-based)", "name": "page", "in": "query" }, { "type": "integer", "description": "limit (default 50, max 200)", "name": "limit", "in": "query" }, { "type": "string", "description": "search by name/type/base_url/group", "name": "search", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/github_com_ez-api_ez-api_internal_model.Provider" } } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } }, "post": { "security": [ { "AdminAuth": [] } ], "description": "Register a new upstream AI provider", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "admin" ], "summary": "Create a new provider", "parameters": [ { "description": "Provider Info", "name": "provider", "in": "body", "required": true, "schema": { "$ref": "#/definitions/github_com_ez-api_ez-api_internal_dto.ProviderDTO" } } ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/github_com_ez-api_ez-api_internal_model.Provider" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/gin.H" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } } }, "/admin/providers/batch": { "post": { "security": [ { "AdminAuth": [] } ], "description": "Batch delete or status update for providers", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "admin" ], "summary": "Batch providers", "parameters": [ { "description": "Batch payload", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_api.BatchActionRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api.BatchResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/gin.H" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } } }, "/admin/providers/custom": { "post": { "security": [ { "AdminAuth": [] } ], "description": "Create an OpenAI-compatible provider (base_url + api_key required)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "admin" ], "summary": "Create a custom provider", "parameters": [ { "description": "Provider custom payload", "name": "provider", "in": "body", "required": true, "schema": { "$ref": "#/definitions/github_com_ez-api_ez-api_internal_dto.ProviderCustomCreateDTO" } } ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/github_com_ez-api_ez-api_internal_model.Provider" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/gin.H" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } } }, "/admin/providers/google": { "post": { "security": [ { "AdminAuth": [] } ], "description": "Create a Google SDK provider (Gemini API key or Vertex project/location); base_url is not used", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "admin" ], "summary": "Create a Google SDK provider", "parameters": [ { "description": "Google provider payload", "name": "provider", "in": "body", "required": true, "schema": { "$ref": "#/definitions/github_com_ez-api_ez-api_internal_dto.ProviderGoogleCreateDTO" } } ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/github_com_ez-api_ez-api_internal_model.Provider" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/gin.H" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } } }, "/admin/providers/preset": { "post": { "security": [ { "AdminAuth": [] } ], "description": "Create an official OpenAI/Anthropic provider (only api_key is typically required)", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "admin" ], "summary": "Create a preset provider", "parameters": [ { "description": "Provider preset payload", "name": "provider", "in": "body", "required": true, "schema": { "$ref": "#/definitions/github_com_ez-api_ez-api_internal_dto.ProviderPresetCreateDTO" } } ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/github_com_ez-api_ez-api_internal_model.Provider" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/gin.H" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } } }, "/admin/providers/{id}": { "get": { "security": [ { "AdminAuth": [] } ], "description": "Get a provider by id", "produces": [ "application/json" ], "tags": [ "admin" ], "summary": "Get provider", "parameters": [ { "type": "integer", "description": "Provider ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/github_com_ez-api_ez-api_internal_model.Provider" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/gin.H" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/gin.H" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } }, "put": { "security": [ { "AdminAuth": [] } ], "description": "Update provider attributes including status/auto-ban flags", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "admin" ], "summary": "Update a provider", "parameters": [ { "type": "integer", "description": "Provider ID", "name": "id", "in": "path", "required": true }, { "description": "Provider Info", "name": "provider", "in": "body", "required": true, "schema": { "$ref": "#/definitions/github_com_ez-api_ez-api_internal_dto.ProviderDTO" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/github_com_ez-api_ez-api_internal_model.Provider" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/gin.H" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/gin.H" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } }, "delete": { "security": [ { "AdminAuth": [] } ], "description": "Deletes a provider and triggers a full snapshot sync to avoid stale routing", "produces": [ "application/json" ], "tags": [ "admin" ], "summary": "Delete provider", "parameters": [ { "type": "integer", "description": "Provider ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/gin.H" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/gin.H" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/gin.H" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } } }, "/admin/providers/{id}/fetch-models": { "post": { "security": [ { "AdminAuth": [] } ], "description": "Calls upstream /models (or /v1/models) and updates provider model list", "produces": [ "application/json" ], "tags": [ "admin" ], "summary": "Fetch models from provider", "parameters": [ { "type": "integer", "description": "Provider ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/gin.H" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/gin.H" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/gin.H" } }, "502": { "description": "Bad Gateway", "schema": { "$ref": "#/definitions/gin.H" } } } } }, "/admin/providers/{id}/test": { "post": { "security": [ { "AdminAuth": [] } ], "description": "Performs a lightweight upstream request to verify the provider configuration", "produces": [ "application/json" ], "tags": [ "admin" ], "summary": "Test provider connectivity", "parameters": [ { "type": "integer", "description": "Provider ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api.testProviderResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/gin.H" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/gin.H" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } } }, "/admin/stats": { "get": { "security": [ { "AdminAuth": [] } ], "description": "Aggregate request stats across all masters", "produces": [ "application/json" ], "tags": [ "admin" ], "summary": "Usage stats (admin)", "parameters": [ { "type": "string", "description": "today|week|month|all", "name": "period", "in": "query" }, { "type": "integer", "description": "unix seconds", "name": "since", "in": "query" }, { "type": "integer", "description": "unix seconds", "name": "until", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api.AdminUsageStatsResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/gin.H" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } } }, "/admin/sync/snapshot": { "post": { "security": [ { "AdminAuth": [] } ], "description": "Force full synchronization of DB state to Redis", "produces": [ "application/json" ], "tags": [ "admin" ], "summary": "Force sync snapshot", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/gin.H" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } } }, "/api/status/test": { "get": { "description": "Checks Redis/PostgreSQL connections and reports status", "produces": [ "application/json" ], "tags": [ "system" ], "summary": "Test dependency connectivity", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/github_com_ez-api_ez-api_internal_service.HealthStatus" } }, "503": { "description": "Service Unavailable", "schema": { "$ref": "#/definitions/github_com_ez-api_ez-api_internal_service.HealthStatus" } } } } }, "/internal/stats/flush": { "post": { "description": "Internal endpoint for flushing accumulated key usage stats from DP to CP database", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "internal" ], "summary": "Flush key stats", "parameters": [ { "description": "Stats to flush", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_api.statsFlushRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/gin.H" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/gin.H" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } } }, "/logs": { "post": { "description": "Internal endpoint for ingesting logs from Balancer", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "system" ], "summary": "Ingest logs", "parameters": [ { "description": "Log Record", "name": "log", "in": "body", "required": true, "schema": { "$ref": "#/definitions/github_com_ez-api_ez-api_internal_model.LogRecord" } } ], "responses": { "202": { "description": "Accepted", "schema": { "$ref": "#/definitions/gin.H" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/gin.H" } } } } }, "/v1/logs": { "get": { "security": [ { "MasterAuth": [] } ], "description": "List request logs for the authenticated master", "produces": [ "application/json" ], "tags": [ "master" ], "summary": "List logs (master)", "parameters": [ { "type": "integer", "description": "limit (default 50, max 200)", "name": "limit", "in": "query" }, { "type": "integer", "description": "offset", "name": "offset", "in": "query" }, { "type": "integer", "description": "unix seconds", "name": "since", "in": "query" }, { "type": "integer", "description": "unix seconds", "name": "until", "in": "query" }, { "type": "string", "description": "model", "name": "model", "in": "query" }, { "type": "integer", "description": "status code", "name": "status_code", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api.ListMasterLogsResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/gin.H" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } } }, "/v1/logs/stats": { "get": { "security": [ { "MasterAuth": [] } ], "description": "Aggregate request log stats for the authenticated master", "produces": [ "application/json" ], "tags": [ "master" ], "summary": "Log stats (master)", "parameters": [ { "type": "integer", "description": "unix seconds", "name": "since", "in": "query" }, { "type": "integer", "description": "unix seconds", "name": "until", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api.LogStatsResponse" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/gin.H" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } } }, "/v1/realtime": { "get": { "security": [ { "MasterAuth": [] } ], "description": "Return realtime counters for the authenticated master", "produces": [ "application/json" ], "tags": [ "master" ], "summary": "Master realtime stats", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api.MasterRealtimeView" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/gin.H" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } } }, "/v1/self": { "get": { "security": [ { "MasterAuth": [] } ], "description": "Returns master metadata for the authenticated master key", "produces": [ "application/json" ], "tags": [ "master" ], "summary": "Get current master info", "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api.MasterView" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/gin.H" } } } } }, "/v1/stats": { "get": { "security": [ { "MasterAuth": [] } ], "description": "Aggregate request stats for the authenticated master", "produces": [ "application/json" ], "tags": [ "master" ], "summary": "Usage stats (master)", "parameters": [ { "type": "string", "description": "today|week|month|all", "name": "period", "in": "query" }, { "type": "integer", "description": "unix seconds", "name": "since", "in": "query" }, { "type": "integer", "description": "unix seconds", "name": "until", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api.MasterUsageStatsResponse" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/gin.H" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/gin.H" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } } }, "/v1/tokens": { "get": { "security": [ { "MasterAuth": [] } ], "description": "List child keys issued under the authenticated master", "produces": [ "application/json" ], "tags": [ "master" ], "summary": "List child keys", "parameters": [ { "type": "integer", "description": "page (1-based)", "name": "page", "in": "query" }, { "type": "integer", "description": "limit (default 50, max 200)", "name": "limit", "in": "query" }, { "type": "string", "description": "search by group/scopes/namespaces/status", "name": "search", "in": "query" } ], "responses": { "200": { "description": "OK", "schema": { "type": "array", "items": { "$ref": "#/definitions/internal_api.TokenView" } } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/gin.H" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } }, "post": { "security": [ { "MasterAuth": [] } ], "description": "Issue a new access token (child key) for the authenticated master", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "master" ], "summary": "Issue a child key", "parameters": [ { "description": "Key Request", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_api.IssueChildKeyRequest" } } ], "responses": { "201": { "description": "Created", "schema": { "$ref": "#/definitions/gin.H" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/gin.H" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/gin.H" } }, "403": { "description": "Forbidden", "schema": { "$ref": "#/definitions/gin.H" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } } }, "/v1/tokens/{id}": { "get": { "security": [ { "MasterAuth": [] } ], "description": "Get a child key by id under the authenticated master", "produces": [ "application/json" ], "tags": [ "master" ], "summary": "Get child key", "parameters": [ { "type": "integer", "description": "Token ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api.TokenView" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/gin.H" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/gin.H" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/gin.H" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } }, "put": { "security": [ { "MasterAuth": [] } ], "description": "Update token scopes/status under the authenticated master", "consumes": [ "application/json" ], "produces": [ "application/json" ], "tags": [ "master" ], "summary": "Update child key", "parameters": [ { "type": "integer", "description": "Token ID", "name": "id", "in": "path", "required": true }, { "description": "Update payload", "name": "request", "in": "body", "required": true, "schema": { "$ref": "#/definitions/internal_api.UpdateTokenRequest" } } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/internal_api.TokenView" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/gin.H" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/gin.H" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/gin.H" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } }, "delete": { "security": [ { "MasterAuth": [] } ], "description": "Suspends a child key under the authenticated master", "produces": [ "application/json" ], "tags": [ "master" ], "summary": "Delete (revoke) child key", "parameters": [ { "type": "integer", "description": "Token ID", "name": "id", "in": "path", "required": true } ], "responses": { "200": { "description": "OK", "schema": { "$ref": "#/definitions/gin.H" } }, "400": { "description": "Bad Request", "schema": { "$ref": "#/definitions/gin.H" } }, "401": { "description": "Unauthorized", "schema": { "$ref": "#/definitions/gin.H" } }, "404": { "description": "Not Found", "schema": { "$ref": "#/definitions/gin.H" } }, "500": { "description": "Internal Server Error", "schema": { "$ref": "#/definitions/gin.H" } } } } } }, "definitions": { "gin.H": { "type": "object", "additionalProperties": {} }, "github_com_ez-api_ez-api_internal_dto.BindingDTO": { "type": "object", "properties": { "namespace": { "type": "string" }, "public_model": { "type": "string" }, "route_group": { "type": "string" }, "selector_type": { "type": "string" }, "selector_value": { "type": "string" }, "status": { "type": "string" } } }, "github_com_ez-api_ez-api_internal_dto.ModelDTO": { "type": "object", "properties": { "context_window": { "type": "integer" }, "cost_per_token": { "type": "number" }, "kind": { "type": "string" }, "max_output_tokens": { "type": "integer" }, "name": { "type": "string" }, "supports_fim": { "type": "boolean" }, "supports_functions": { "type": "boolean" }, "supports_tool_choice": { "type": "boolean" }, "supports_vision": { "type": "boolean" } } }, "github_com_ez-api_ez-api_internal_dto.ProviderCustomCreateDTO": { "type": "object", "properties": { "api_key": { "type": "string" }, "auto_ban": { "type": "boolean" }, "base_url": { "type": "string" }, "group": { "type": "string" }, "models": { "type": "array", "items": { "type": "string" } }, "name": { "type": "string" }, "status": { "type": "string" }, "weight": { "type": "integer" } } }, "github_com_ez-api_ez-api_internal_dto.ProviderDTO": { "type": "object", "properties": { "api_key": { "type": "string" }, "auto_ban": { "type": "boolean" }, "ban_reason": { "type": "string" }, "ban_until": { "type": "string" }, "base_url": { "type": "string" }, "google_location": { "type": "string" }, "google_project": { "type": "string" }, "group": { "type": "string" }, "models": { "description": "List of supported model names", "type": "array", "items": { "type": "string" } }, "name": { "type": "string" }, "skip_routing": { "description": "Optional control params", "type": "boolean" }, "status": { "type": "string" }, "type": { "type": "string" }, "weight": { "type": "integer" } } }, "github_com_ez-api_ez-api_internal_dto.ProviderGoogleCreateDTO": { "type": "object", "properties": { "api_key": { "description": "Gemini API", "type": "string" }, "auto_ban": { "type": "boolean" }, "google_location": { "type": "string" }, "google_project": { "description": "Vertex", "type": "string" }, "group": { "type": "string" }, "models": { "type": "array", "items": { "type": "string" } }, "name": { "description": "Optional fields.", "type": "string" }, "status": { "type": "string" }, "type": { "description": "Type must be a Google-family provider type, e.g.:\n- gemini/google/aistudio (Gemini API)\n- vertex/vertex-express (Vertex)", "type": "string" }, "weight": { "type": "integer" } } }, "github_com_ez-api_ez-api_internal_dto.ProviderPresetCreateDTO": { "type": "object", "properties": { "api_key": { "type": "string" }, "auto_ban": { "type": "boolean" }, "google_location": { "type": "string" }, "google_project": { "type": "string" }, "group": { "type": "string" }, "models": { "type": "array", "items": { "type": "string" } }, "name": { "description": "Optional fields.", "type": "string" }, "preset": { "description": "openai | anthropic | gemini", "type": "string" }, "status": { "type": "string" }, "weight": { "type": "integer" } } }, "github_com_ez-api_ez-api_internal_model.Binding": { "type": "object", "properties": { "createdAt": { "type": "string" }, "deletedAt": { "$ref": "#/definitions/gorm.DeletedAt" }, "id": { "type": "integer" }, "namespace": { "type": "string" }, "public_model": { "type": "string" }, "route_group": { "type": "string" }, "selector_type": { "type": "string" }, "selector_value": { "type": "string" }, "status": { "type": "string" }, "updatedAt": { "type": "string" } } }, "github_com_ez-api_ez-api_internal_model.LogRecord": { "type": "object", "properties": { "audit_reason": { "type": "string" }, "client_ip": { "type": "string" }, "createdAt": { "type": "string" }, "deletedAt": { "$ref": "#/definitions/gorm.DeletedAt" }, "error_message": { "type": "string" }, "group": { "type": "string" }, "id": { "type": "integer" }, "key_id": { "type": "integer" }, "latency_ms": { "type": "integer" }, "model": { "type": "string" }, "provider_id": { "type": "integer" }, "provider_name": { "type": "string" }, "provider_type": { "type": "string" }, "request_body": { "description": "optional, only when audit triggered", "type": "string" }, "request_size": { "type": "integer" }, "response_body": { "description": "optional, only when audit triggered", "type": "string" }, "response_size": { "type": "integer" }, "status_code": { "type": "integer" }, "tokens_in": { "type": "integer" }, "tokens_out": { "type": "integer" }, "updatedAt": { "type": "string" } } }, "github_com_ez-api_ez-api_internal_model.Model": { "type": "object", "properties": { "context_window": { "type": "integer" }, "cost_per_token": { "type": "number" }, "createdAt": { "type": "string" }, "deletedAt": { "$ref": "#/definitions/gorm.DeletedAt" }, "id": { "type": "integer" }, "kind": { "type": "string" }, "max_output_tokens": { "type": "integer" }, "name": { "type": "string" }, "supports_fim": { "type": "boolean" }, "supports_functions": { "type": "boolean" }, "supports_tool_choice": { "type": "boolean" }, "supports_vision": { "type": "boolean" }, "updatedAt": { "type": "string" } } }, "github_com_ez-api_ez-api_internal_model.Namespace": { "type": "object", "properties": { "createdAt": { "type": "string" }, "deletedAt": { "$ref": "#/definitions/gorm.DeletedAt" }, "description": { "type": "string" }, "id": { "type": "integer" }, "name": { "type": "string" }, "status": { "type": "string" }, "updatedAt": { "type": "string" } } }, "github_com_ez-api_ez-api_internal_model.Provider": { "type": "object", "properties": { "api_key": { "type": "string" }, "auto_ban": { "description": "whether DP-triggered disable is allowed", "type": "boolean" }, "ban_reason": { "description": "reason for current disable", "type": "string" }, "ban_until": { "description": "optional TTL for disable", "type": "string" }, "base_url": { "type": "string" }, "createdAt": { "type": "string" }, "deletedAt": { "$ref": "#/definitions/gorm.DeletedAt" }, "google_location": { "type": "string" }, "google_project": { "type": "string" }, "group": { "description": "routing group/tier", "type": "string" }, "id": { "type": "integer" }, "models": { "description": "comma-separated list of supported models (e.g. \"gpt-4,gpt-3.5-turbo\")", "type": "string" }, "name": { "type": "string" }, "status": { "description": "active, auto_disabled, manual_disabled", "type": "string" }, "type": { "description": "openai, anthropic, etc.", "type": "string" }, "updatedAt": { "type": "string" }, "weight": { "description": "routing weight inside route_group", "type": "integer" } } }, "github_com_ez-api_ez-api_internal_service.HealthStatus": { "type": "object", "properties": { "database": { "type": "string" }, "redis": { "type": "string" }, "status": { "type": "string" }, "uptime": { "type": "string" } } }, "github_com_ez-api_ez-api_internal_service.LogWebhookConfig": { "type": "object", "properties": { "cooldown_seconds": { "type": "integer" }, "enabled": { "type": "boolean" }, "secret": { "type": "string" }, "status_code_threshold": { "type": "integer" }, "threshold": { "type": "integer" }, "url": { "type": "string" }, "window_seconds": { "type": "integer" } } }, "github_com_ez-api_ez-api_internal_service.ModelRegistryCheckResult": { "type": "object", "properties": { "current_upstream_ref": { "type": "string" }, "current_version": { "type": "string" }, "enabled": { "type": "boolean" }, "latest_version": { "type": "string" }, "needs_refresh": { "type": "boolean" }, "upstream_ref": { "type": "string" } } }, "github_com_ez-api_ez-api_internal_service.ModelRegistryStatus": { "type": "object", "properties": { "cache_current": { "$ref": "#/definitions/github_com_ez-api_ez-api_internal_service.modelRegistryFile" }, "cache_prev": { "$ref": "#/definitions/github_com_ez-api_ez-api_internal_service.modelRegistryFile" }, "enabled": { "type": "boolean" }, "last_error": { "type": "string" }, "last_refresh_at": { "type": "integer" }, "models_dev_ref": { "type": "string" }, "models_dev_url": { "type": "string" }, "redis_meta": { "type": "object", "additionalProperties": { "type": "string" } } } }, "github_com_ez-api_ez-api_internal_service.modelRegistryFile": { "type": "object", "properties": { "meta": { "$ref": "#/definitions/modelcap.Meta" }, "models": { "type": "object", "additionalProperties": { "$ref": "#/definitions/modelcap.Model" } } } }, "gorm.DeletedAt": { "type": "object", "properties": { "time": { "type": "string" }, "valid": { "description": "Valid is true if Time is not NULL", "type": "boolean" } } }, "internal_api.AccessResponse": { "type": "object", "properties": { "default_namespace": { "type": "string" }, "namespaces": { "type": "array", "items": { "type": "string" } } } }, "internal_api.AdminUsageStatsResponse": { "type": "object", "properties": { "active_masters": { "type": "integer" }, "by_master": { "type": "array", "items": { "$ref": "#/definitions/internal_api.MasterUsageAgg" } }, "by_provider": { "type": "array", "items": { "$ref": "#/definitions/internal_api.ProviderUsageAgg" } }, "period": { "type": "string" }, "total_masters": { "type": "integer" }, "total_requests": { "type": "integer" }, "total_tokens": { "type": "integer" } } }, "internal_api.BatchActionRequest": { "type": "object", "properties": { "action": { "type": "string" }, "ids": { "type": "array", "items": { "type": "integer" } }, "status": { "type": "string" } } }, "internal_api.BatchResponse": { "type": "object", "properties": { "action": { "type": "string" }, "failed": { "type": "array", "items": { "$ref": "#/definitions/internal_api.BatchResult" } }, "success": { "type": "array", "items": { "type": "integer" } } } }, "internal_api.BatchResult": { "type": "object", "properties": { "error": { "type": "string" }, "id": { "type": "integer" } } }, "internal_api.CreateMasterRequest": { "type": "object", "required": [ "group", "name" ], "properties": { "global_qps": { "type": "integer" }, "group": { "type": "string" }, "max_child_keys": { "type": "integer" }, "name": { "type": "string" } } }, "internal_api.DeleteLogsRequest": { "type": "object", "properties": { "before": { "type": "string" }, "key_id": { "type": "integer" }, "model": { "type": "string" } } }, "internal_api.DeleteLogsResponse": { "type": "object", "properties": { "deleted_count": { "type": "integer" } } }, "internal_api.IssueChildKeyRequest": { "type": "object", "properties": { "allow_ips": { "type": "string" }, "deny_ips": { "type": "string" }, "expires_at": { "type": "string" }, "group": { "type": "string" }, "model_limits": { "type": "string" }, "model_limits_enabled": { "type": "boolean" }, "scopes": { "type": "string" } } }, "internal_api.KeyUsageStat": { "type": "object", "properties": { "key_id": { "type": "integer" }, "requests": { "type": "integer" }, "tokens": { "type": "integer" } } }, "internal_api.ListMasterLogsResponse": { "type": "object", "properties": { "items": { "type": "array", "items": { "$ref": "#/definitions/internal_api.MasterLogView" } }, "limit": { "type": "integer" }, "offset": { "type": "integer" }, "total": { "type": "integer" } } }, "internal_api.LogStatsResponse": { "type": "object", "properties": { "avg_latency_ms": { "type": "number" }, "by_status": { "type": "object", "additionalProperties": { "type": "integer", "format": "int64" } }, "tokens_in": { "type": "integer" }, "tokens_out": { "type": "integer" }, "total": { "type": "integer" } } }, "internal_api.ManageMasterRequest": { "type": "object", "required": [ "action" ], "properties": { "action": { "description": "freeze/unfreeze", "type": "string" } } }, "internal_api.MasterLogView": { "type": "object", "properties": { "created_at": { "type": "integer" }, "error_message": { "type": "string" }, "group": { "type": "string" }, "id": { "type": "integer" }, "key_id": { "type": "integer" }, "latency_ms": { "type": "integer" }, "model": { "type": "string" }, "request_size": { "type": "integer" }, "response_size": { "type": "integer" }, "status_code": { "type": "integer" }, "tokens_in": { "type": "integer" }, "tokens_out": { "type": "integer" } } }, "internal_api.MasterRealtimeView": { "type": "object", "properties": { "qps": { "type": "integer" }, "qps_limit": { "type": "integer" }, "rate_limited": { "type": "boolean" }, "requests": { "type": "integer" }, "tokens": { "type": "integer" }, "updated_at": { "type": "integer" } } }, "internal_api.MasterUsageAgg": { "type": "object", "properties": { "master_id": { "type": "integer" }, "requests": { "type": "integer" }, "tokens": { "type": "integer" } } }, "internal_api.MasterUsageStatsResponse": { "type": "object", "properties": { "by_key": { "type": "array", "items": { "$ref": "#/definitions/internal_api.KeyUsageStat" } }, "by_model": { "type": "array", "items": { "$ref": "#/definitions/internal_api.ModelUsageStat" } }, "period": { "type": "string" }, "total_requests": { "type": "integer" }, "total_tokens": { "type": "integer" } } }, "internal_api.MasterView": { "type": "object", "properties": { "created_at": { "type": "integer" }, "default_namespace": { "type": "string" }, "epoch": { "type": "integer" }, "global_qps": { "type": "integer" }, "group": { "type": "string" }, "id": { "type": "integer" }, "max_child_keys": { "type": "integer" }, "name": { "type": "string" }, "namespaces": { "type": "string" }, "realtime": { "$ref": "#/definitions/internal_api.MasterRealtimeView" }, "status": { "type": "string" }, "updated_at": { "type": "integer" } } }, "internal_api.ModelUsageStat": { "type": "object", "properties": { "model": { "type": "string" }, "requests": { "type": "integer" }, "tokens": { "type": "integer" } } }, "internal_api.NamespaceRequest": { "type": "object", "properties": { "description": { "type": "string" }, "name": { "type": "string" }, "status": { "type": "string" } } }, "internal_api.OperationLogView": { "type": "object", "properties": { "actor": { "type": "string" }, "client_ip": { "type": "string" }, "created_at": { "type": "integer" }, "error_message": { "type": "string" }, "id": { "type": "integer" }, "latency_ms": { "type": "integer" }, "method": { "type": "string" }, "path": { "type": "string" }, "query": { "type": "string" }, "request_id": { "type": "string" }, "status_code": { "type": "integer" }, "user_agent": { "type": "string" } } }, "internal_api.ProviderUsageAgg": { "type": "object", "properties": { "provider_id": { "type": "integer" }, "provider_name": { "type": "string" }, "provider_type": { "type": "string" }, "requests": { "type": "integer" }, "tokens": { "type": "integer" } } }, "internal_api.TokenView": { "type": "object", "properties": { "allow_ips": { "type": "string" }, "created_at": { "type": "integer" }, "default_namespace": { "type": "string" }, "deny_ips": { "type": "string" }, "expires_at": { "type": "string" }, "group": { "type": "string" }, "id": { "type": "integer" }, "issued_at_epoch": { "type": "integer" }, "issued_by": { "type": "string" }, "last_accessed_at": { "type": "string" }, "model_limits": { "type": "string" }, "model_limits_enabled": { "type": "boolean" }, "namespaces": { "type": "string" }, "quota_limit": { "type": "integer" }, "quota_reset_at": { "type": "string" }, "quota_reset_type": { "type": "string" }, "quota_used": { "type": "integer" }, "request_count": { "type": "integer" }, "scopes": { "type": "string" }, "status": { "type": "string" }, "updated_at": { "type": "integer" }, "used_tokens": { "type": "integer" } } }, "internal_api.UpdateAccessRequest": { "type": "object", "properties": { "default_namespace": { "type": "string" }, "namespaces": { "type": "array", "items": { "type": "string" } }, "propagate_to_keys": { "type": "boolean" } } }, "internal_api.UpdateMasterRequest": { "type": "object", "properties": { "global_qps": { "type": "integer" }, "group": { "type": "string" }, "max_child_keys": { "type": "integer" }, "name": { "type": "string" }, "propagate_to_keys": { "type": "boolean" } } }, "internal_api.UpdateNamespaceRequest": { "type": "object", "properties": { "description": { "type": "string" }, "name": { "type": "string" }, "status": { "type": "string" } } }, "internal_api.UpdateTokenRequest": { "type": "object", "properties": { "allow_ips": { "type": "string" }, "deny_ips": { "type": "string" }, "expires_at": { "type": "string" }, "model_limits": { "type": "string" }, "model_limits_enabled": { "type": "boolean" }, "scopes": { "type": "string" }, "status": { "description": "active/suspended", "type": "string" } } }, "internal_api.refreshModelRegistryRequest": { "type": "object", "properties": { "ref": { "type": "string" } } }, "internal_api.statsFlushEntry": { "type": "object", "properties": { "last_accessed_at": { "type": "integer" }, "requests": { "type": "integer" }, "token_hash": { "type": "string" }, "tokens": { "type": "integer" } } }, "internal_api.statsFlushRequest": { "type": "object", "properties": { "keys": { "type": "array", "items": { "$ref": "#/definitions/internal_api.statsFlushEntry" } } } }, "internal_api.testProviderResponse": { "type": "object", "properties": { "body": { "type": "string" }, "ok": { "type": "boolean" }, "status_code": { "type": "integer" }, "url": { "type": "string" } } }, "modelcap.Meta": { "type": "object", "properties": { "checksum": { "type": "string" }, "source": { "type": "string" }, "updated_at": { "type": "string" }, "upstream_ref": { "type": "string" }, "upstream_url": { "type": "string" }, "version": { "type": "string" } } }, "modelcap.Model": { "type": "object", "properties": { "context_window": { "type": "integer" }, "cost_per_token": { "type": "number" }, "kind": { "type": "string" }, "max_output_tokens": { "type": "integer" }, "name": { "type": "string" }, "supports_fim": { "type": "boolean" }, "supports_functions": { "type": "boolean" }, "supports_stream": { "type": "boolean" }, "supports_tool_choice": { "type": "boolean" }, "supports_vision": { "type": "boolean" } } } }, "securityDefinitions": { "AdminAuth": { "type": "apiKey", "name": "Authorization", "in": "header" }, "MasterAuth": { "type": "apiKey", "name": "Authorization", "in": "header" } } }