mirror of
https://github.com/EZ-Api/ez-api.git
synced 2026-01-13 17:47:51 +00:00
Reflect recent API changes in Swagger documentation:
- Add endpoints for feature flag management (/admin/features)
- Add endpoint for issuing child keys to masters (/admin/masters/{id}/keys)
- Add endpoint for updating providers (/admin/providers/{id})
- Update provider model definitions with new fields (auto_ban, google_* attributes, status)
601 lines
15 KiB
YAML
601 lines
15 KiB
YAML
basePath: /
|
|
definitions:
|
|
gin.H:
|
|
additionalProperties: {}
|
|
type: object
|
|
github_com_ez-api_ez-api_internal_dto.ModelDTO:
|
|
properties:
|
|
context_window:
|
|
type: integer
|
|
cost_per_token:
|
|
type: number
|
|
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
|
|
type: object
|
|
github_com_ez-api_ez-api_internal_dto.ProviderDTO:
|
|
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
|
|
items:
|
|
type: string
|
|
type: array
|
|
name:
|
|
type: string
|
|
skip_routing:
|
|
description: Optional control params
|
|
type: boolean
|
|
status:
|
|
type: string
|
|
type:
|
|
type: string
|
|
type: object
|
|
github_com_ez-api_ez-api_internal_model.LogRecord:
|
|
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
|
|
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
|
|
type: object
|
|
github_com_ez-api_ez-api_internal_model.Model:
|
|
properties:
|
|
context_window:
|
|
type: integer
|
|
cost_per_token:
|
|
type: number
|
|
createdAt:
|
|
type: string
|
|
deletedAt:
|
|
$ref: '#/definitions/gorm.DeletedAt'
|
|
id:
|
|
type: integer
|
|
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
|
|
type: object
|
|
github_com_ez-api_ez-api_internal_model.Provider:
|
|
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
|
|
type: object
|
|
gorm.DeletedAt:
|
|
properties:
|
|
time:
|
|
type: string
|
|
valid:
|
|
description: Valid is true if Time is not NULL
|
|
type: boolean
|
|
type: object
|
|
internal_api.CreateMasterRequest:
|
|
properties:
|
|
global_qps:
|
|
type: integer
|
|
group:
|
|
type: string
|
|
max_child_keys:
|
|
type: integer
|
|
name:
|
|
type: string
|
|
required:
|
|
- group
|
|
- name
|
|
type: object
|
|
internal_api.IssueChildKeyRequest:
|
|
properties:
|
|
group:
|
|
type: string
|
|
scopes:
|
|
type: string
|
|
type: object
|
|
host: localhost:8080
|
|
info:
|
|
contact:
|
|
email: support@swagger.io
|
|
name: API Support
|
|
url: http://www.swagger.io/support
|
|
description: Management API for EZ-API Gateway system.
|
|
license:
|
|
name: Apache 2.0
|
|
url: http://www.apache.org/licenses/LICENSE-2.0.html
|
|
termsOfService: http://swagger.io/terms/
|
|
title: EZ-API Control Plane
|
|
version: 0.0.1
|
|
paths:
|
|
/admin/features:
|
|
get:
|
|
description: Returns all feature flags stored in Redis (meta:features)
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/gin.H'
|
|
"500":
|
|
description: Internal Server Error
|
|
schema:
|
|
$ref: '#/definitions/gin.H'
|
|
security:
|
|
- AdminAuth: []
|
|
summary: List feature flags
|
|
tags:
|
|
- admin
|
|
put:
|
|
consumes:
|
|
- application/json
|
|
description: Updates selected feature flags (meta:features). Values are stored
|
|
as strings.
|
|
parameters:
|
|
- description: Feature map
|
|
in: body
|
|
name: request
|
|
required: true
|
|
schema:
|
|
type: object
|
|
produces:
|
|
- application/json
|
|
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'
|
|
security:
|
|
- AdminAuth: []
|
|
summary: Update feature flags
|
|
tags:
|
|
- admin
|
|
/admin/masters:
|
|
post:
|
|
consumes:
|
|
- application/json
|
|
description: Create a new master account (tenant)
|
|
parameters:
|
|
- description: Master Info
|
|
in: body
|
|
name: master
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/internal_api.CreateMasterRequest'
|
|
produces:
|
|
- application/json
|
|
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'
|
|
security:
|
|
- AdminAuth: []
|
|
summary: Create a new master tenant
|
|
tags:
|
|
- admin
|
|
/admin/masters/{id}/keys:
|
|
post:
|
|
consumes:
|
|
- application/json
|
|
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.
|
|
parameters:
|
|
- description: Master ID
|
|
in: path
|
|
name: id
|
|
required: true
|
|
type: integer
|
|
- description: Key Request
|
|
in: body
|
|
name: request
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/internal_api.IssueChildKeyRequest'
|
|
produces:
|
|
- application/json
|
|
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'
|
|
security:
|
|
- AdminAuth: []
|
|
summary: Issue a child key on behalf of a master
|
|
tags:
|
|
- admin
|
|
/admin/models:
|
|
get:
|
|
description: Get a list of all registered models
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
items:
|
|
$ref: '#/definitions/github_com_ez-api_ez-api_internal_model.Model'
|
|
type: array
|
|
"500":
|
|
description: Internal Server Error
|
|
schema:
|
|
$ref: '#/definitions/gin.H'
|
|
security:
|
|
- AdminAuth: []
|
|
summary: List all models
|
|
tags:
|
|
- admin
|
|
post:
|
|
consumes:
|
|
- application/json
|
|
description: Register a supported model with its capabilities
|
|
parameters:
|
|
- description: Model Info
|
|
in: body
|
|
name: model
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/github_com_ez-api_ez-api_internal_dto.ModelDTO'
|
|
produces:
|
|
- application/json
|
|
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'
|
|
security:
|
|
- AdminAuth: []
|
|
summary: Register a new model
|
|
tags:
|
|
- admin
|
|
/admin/models/{id}:
|
|
put:
|
|
consumes:
|
|
- application/json
|
|
description: Update an existing model's configuration
|
|
parameters:
|
|
- description: Model ID
|
|
in: path
|
|
name: id
|
|
required: true
|
|
type: integer
|
|
- description: Model Info
|
|
in: body
|
|
name: model
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/github_com_ez-api_ez-api_internal_dto.ModelDTO'
|
|
produces:
|
|
- application/json
|
|
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'
|
|
security:
|
|
- AdminAuth: []
|
|
summary: Update a model
|
|
tags:
|
|
- admin
|
|
/admin/providers:
|
|
post:
|
|
consumes:
|
|
- application/json
|
|
description: Register a new upstream AI provider
|
|
parameters:
|
|
- description: Provider Info
|
|
in: body
|
|
name: provider
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/github_com_ez-api_ez-api_internal_dto.ProviderDTO'
|
|
produces:
|
|
- application/json
|
|
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'
|
|
security:
|
|
- AdminAuth: []
|
|
summary: Create a new provider
|
|
tags:
|
|
- admin
|
|
/admin/providers/{id}:
|
|
put:
|
|
consumes:
|
|
- application/json
|
|
description: Update provider attributes including status/auto-ban flags
|
|
parameters:
|
|
- description: Provider ID
|
|
in: path
|
|
name: id
|
|
required: true
|
|
type: integer
|
|
- description: Provider Info
|
|
in: body
|
|
name: provider
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/github_com_ez-api_ez-api_internal_dto.ProviderDTO'
|
|
produces:
|
|
- application/json
|
|
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'
|
|
security:
|
|
- AdminAuth: []
|
|
summary: Update a provider
|
|
tags:
|
|
- admin
|
|
/admin/sync/snapshot:
|
|
post:
|
|
description: Force full synchronization of DB state to Redis
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"200":
|
|
description: OK
|
|
schema:
|
|
$ref: '#/definitions/gin.H'
|
|
"500":
|
|
description: Internal Server Error
|
|
schema:
|
|
$ref: '#/definitions/gin.H'
|
|
security:
|
|
- AdminAuth: []
|
|
summary: Force sync snapshot
|
|
tags:
|
|
- admin
|
|
/logs:
|
|
post:
|
|
consumes:
|
|
- application/json
|
|
description: Internal endpoint for ingesting logs from Balancer
|
|
parameters:
|
|
- description: Log Record
|
|
in: body
|
|
name: log
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/github_com_ez-api_ez-api_internal_model.LogRecord'
|
|
produces:
|
|
- application/json
|
|
responses:
|
|
"202":
|
|
description: Accepted
|
|
schema:
|
|
$ref: '#/definitions/gin.H'
|
|
"400":
|
|
description: Bad Request
|
|
schema:
|
|
$ref: '#/definitions/gin.H'
|
|
summary: Ingest logs
|
|
tags:
|
|
- system
|
|
/v1/tokens:
|
|
post:
|
|
consumes:
|
|
- application/json
|
|
description: Issue a new access token (child key) for the authenticated master
|
|
parameters:
|
|
- description: Key Request
|
|
in: body
|
|
name: request
|
|
required: true
|
|
schema:
|
|
$ref: '#/definitions/internal_api.IssueChildKeyRequest'
|
|
produces:
|
|
- application/json
|
|
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'
|
|
security:
|
|
- MasterAuth: []
|
|
summary: Issue a child key
|
|
tags:
|
|
- master
|
|
securityDefinitions:
|
|
AdminAuth:
|
|
in: header
|
|
name: Authorization
|
|
type: apiKey
|
|
MasterAuth:
|
|
in: header
|
|
name: Authorization
|
|
type: apiKey
|
|
swagger: "2.0"
|