handler

package
v0.0.1-beta.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 12, 2026 License: AGPL-3.0 Imports: 29 Imported by: 0

Documentation

Overview

Package handler provides primitives to interact with the openapi HTTP API.

Code generated by github.com/oapi-codegen/oapi-codegen/v2 version v2.4.1 DO NOT EDIT.

Package handler 实现 /api/admin/* 的 HTTP 处理:OpenAPI 契约层(oapi-codegen 生成的 ServerInterface + chi 路由),JSON in/out。

SPDX-License-Identifier: AGPL-3.0-or-later Dual-licensed: AGPL-3.0-or-later (open source) or commercial license (closed-source deployment exemption); see LICENSE and LICENSE.commercial. Copyright (c) 2026 is7Qin.

Index

Constants

View Source
const SupplierSurfaceBaseURL = "/api/user/supplier"

SupplierSurfaceBaseURL 供应商面第二 BaseURL(openapi 里该 tag 的 path 前缀)。

Variables

This section is empty.

Functions

func AccountScopeFrom

func AccountScopeFrom(ctx context.Context) domain.AccountScope

AccountScopeFrom 读取注入的账号作用域(缺省 = 管理面全量 {Set:false})。 service/repository 层经 domain.AccountScopeFrom 读取同一键(此处为 handler 面 便捷别名,保持既有引用)。

func Handler

func Handler(si ServerInterface) http.Handler

Handler creates http.Handler with routing matching OpenAPI spec.

func HandlerFromMux

func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler

HandlerFromMux creates http.Handler with routing matching OpenAPI spec based on the provided mux.

func HandlerFromMuxWithBaseURL

func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler

func HandlerWithOptions

func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler

HandlerWithOptions creates http.Handler with additional options

func NewSupplierSurface

func NewSupplierSurface(api *AdminAPI, iss *auth.Issuer, p auth.SnapshotProvider) http.Handler

NewSupplierSurface 组装供应商面完整链路(挂载于 /api/user/supplier/*):

RequireIdentity(iss,p) → RequireRole(p, SupplierSurfaceRoles...) →
SupplierScopeInject → 生成路由(tag `supplier` 的 22 op)

可达集唯一事实源 = domain.SupplierSurfaceRoles()(§2.6);暴露面唯一事实源 = openapi 里 tag `supplier` 的登记(本函数不再持有任何手写路由清单/guard)。p 为 单一鉴权快照面(users + mgmt 合并,proxy.Auth 实现)。

资金命令(POST /api/user/supplier/settlements)与 JWT 同权(spec 2026-10-09 A5): RequireIdentity 两条分支(JWT / 管理 key mk-)均注入 FundsActor(actor = owner, token_version = owner 快照当前值),写事务内复核通过——静态 token 专用资金门与 其 403 语义已随静态管理面 token 删除(§4.5)。

func SupplierScopeInject

func SupplierScopeInject(next http.Handler) http.Handler

SupplierScopeInject 供应商面作用域注入:从已验证 JWT claims 取 user_id,注入 {OwnerUID: jwtUser, Set:true}(§2.5 行层作用域)。必须位于 RequireJWT 之后。 无 claims(未鉴权)⇒ 不注入(下游按缺省管理面全量处理前应已由门控拒绝)。

Types

type Account

type Account struct {
	// BaseURL credential-type conditional: if template is codex-oauth/codex-pat must be null (non-empty forbidden); if api_key/responses-special non-empty overrides template
	BaseURL *string `json:"BaseURL"`

	// CacheDomain 共享缓存域(null = 账号私有域;软亲和一致性哈希的域标识;写面 PATCH /accounts/{id} 的 cache_domain 字段)
	CacheDomain *string    `json:"CacheDomain"`
	CreatedAt   *time.Time `json:"CreatedAt,omitempty"`

	// DeletedAt 软删除时间戳;null = 存活(列表过滤已删;GET 单个可查已删项)
	DeletedAt *time.Time `json:"DeletedAt"`

	// Enabled 管理面启停(写面 PATCH /accounts/{id} 的 enabled 字段;与运行时失效语义分离)
	Enabled *bool `json:"Enabled,omitempty"`

	// FailedAt 运行时失效时刻(rule 判死/SDK fatal;null = 未失效;恢复唯一入口 POST /accounts/{id}/recover)
	FailedAt *time.Time `json:"FailedAt"`

	// FailureSource 失效来源(rule/sdk 等;随 recover 清除)
	FailureSource *string `json:"FailureSource"`
	ID            *int64  `json:"ID,omitempty"`

	// IdentityRevision 身份代际 K:仅身份类字段(template_id/base_url/upstream_key 及可轮换凭据)按值变更时 +1;SDK 自动 token 刷新不推进
	IdentityRevision *int64     `json:"IdentityRevision,omitempty"`
	LastError        *string    `json:"LastError"`
	LastUsedAt       *time.Time `json:"LastUsedAt"`

	// LifecycleRevision 配置代际 C(客户端 CAS 令牌 + DB 变更水位):每次写面落库无条件 +1;PATCH 以 If-Match 作前置条件(陈旧 → 412),recover 以 body expected_revision(陈旧 → 409)
	LifecycleRevision *int64     `json:"LifecycleRevision,omitempty"`
	MaxConcurrency    *int       `json:"MaxConcurrency,omitempty"`
	Name              *string    `json:"Name,omitempty"`
	Template          *Template  `json:"Template,omitempty"`
	TemplateID        *int64     `json:"TemplateID,omitempty"`
	UpdatedAt         *time.Time `json:"UpdatedAt,omitempty"`

	// UpstreamCostMultiplier 采购成本倍率(正常值,1 = ×1,0 = 免费,上限 10 = ×10;API 边界与 basis points 换算——存储 25000 ↔ 显示 2.5;写面 PATCH /accounts/{id} 的 upstream_cost_multiplier 字段)
	UpstreamCostMultiplier *float64 `json:"UpstreamCostMultiplier,omitempty"`
	UpstreamKey            *string  `json:"UpstreamKey,omitempty"`

	// SupplierUserId 供应商归属(null = 平台自有;非空 = 归属该 supplier uid;只读回显,写面 PATCH /accounts/{id} 的 supplier_user_id)
	SupplierUserId *int64 `json:"supplier_user_id"`
}

Account defines model for Account.

type AccountBatchUpdateResponse

type AccountBatchUpdateResponse struct {
	Items   []AccountRevision `json:"items"`
	Updated int               `json:"updated"`
}

AccountBatchUpdateResponse 账号批量更新响应(独立 schema——不与 templates/groups 共用的 BatchUpdateResponse 合并)

type AccountConfigPatch

type AccountConfigPatch struct {
	BaseUrl                nullable.Nullable[string]  `json:"base_url,omitempty"`
	CacheDomain            nullable.Nullable[string]  `json:"cache_domain,omitempty"`
	Enabled                nullable.Nullable[bool]    `json:"enabled,omitempty"`
	GroupIds               *[]int64                   `json:"group_ids,omitempty"`
	MaxConcurrency         nullable.Nullable[int]     `json:"max_concurrency,omitempty"`
	Name                   nullable.Nullable[string]  `json:"name,omitempty"`
	SupplierUserId         nullable.Nullable[int64]   `json:"supplier_user_id,omitempty"`
	TemplateId             nullable.Nullable[int64]   `json:"template_id,omitempty"`
	UpstreamCostMultiplier nullable.Nullable[float64] `json:"upstream_cost_multiplier,omitempty"`
	UpstreamKey            nullable.Nullable[string]  `json:"upstream_key,omitempty"`
}

AccountConfigPatch 账号写面唯一字段模型(创建 / PATCH / 批量共用)。三态:字段缺席 = 不变(永不清空); 可空标量 null = 清空;集合 null = 不变、[] = 清空;不可空标量 null = 400; 可空标量 "" = 400(空串哨兵已取消——清空只有一个拼法 null)。

type AccountCreate

type AccountCreate = AccountConfigPatch

AccountCreate 账号写面唯一字段模型(创建 / PATCH / 批量共用)。三态:字段缺席 = 不变(永不清空); 可空标量 null = 清空;集合 null = 不变、[] = 清空;不可空标量 null = 400; 可空标量 "" = 400(空串哨兵已取消——清空只有一个拼法 null)。

type AccountEnabled

type AccountEnabled = bool

AccountEnabled defines model for AccountEnabled.

type AccountExt

type AccountExt struct {
	AccountId *int64 `json:"account_id,omitempty"`

	// CodexAccountId 上游账号/空间标识;可留空——导入/单账号保存时自动识别(OAuth token claims 离线解析 / PAT whoami 查询);识别失败:导入行拒绝、单账号保存留空且下次保存重试
	CodexAccountId *string `json:"codex_account_id"`

	// CodexEmail 管理标识:codex 账号登录邮箱(导入时由人工/上游提供,非自动生成——NewCodexIdentity 只生成 installation_id;可空)
	CodexEmail *string `json:"codex_email"`

	// CodexIdentity codex 账号持久身份(account_ext.codex_identity jsonb 契约形态;对象字段请求语义:null 与空串同 = 未提供)。仅 installation_id——会话级 session/thread/window 已退役为运行时槽状态,不再持久化/暴露。
	CodexIdentity *CodexIdentity `json:"codex_identity,omitempty"`

	// CodexOauthExpiresAt 凭据:oauth 访问令牌过期时间
	CodexOauthExpiresAt *time.Time `json:"codex_oauth_expires_at"`

	// CodexOauthRefreshToken 凭据:oauth 刷新令牌
	CodexOauthRefreshToken *string `json:"codex_oauth_refresh_token"`

	// CodexOauthToken 凭据:oauth 访问令牌(oauth 行必填——最小完整性)
	CodexOauthToken *string `json:"codex_oauth_token"`

	// CodexPatKey 凭据:pat
	CodexPatKey *string `json:"codex_pat_key"`

	// CredentialType 类型-列组约束(service 校验):oauth 只允许 codex_oauth_* 列组;pat 只允许 codex_pat_key
	CredentialType AccountExtCredentialType `json:"credential_type"`
}

AccountExt defines model for AccountExt.

type AccountExtCredentialType

type AccountExtCredentialType string

AccountExtCredentialType 类型-列组约束(service 校验):oauth 只允许 codex_oauth_* 列组;pat 只允许 codex_pat_key

const (
	AccountExtCredentialTypeCodexOauth AccountExtCredentialType = "codex-oauth"
	AccountExtCredentialTypeCodexPat   AccountExtCredentialType = "codex-pat"
)

Defines values for AccountExtCredentialType.

type AccountGroupsResponse

type AccountGroupsResponse struct {
	GroupIds []int64 `json:"group_ids"`
}

AccountGroupsResponse defines model for AccountGroupsResponse.

type AccountListResponse

type AccountListResponse struct {
	Rows  []AccountView `json:"rows"`
	Total int64         `json:"total"`
}

AccountListResponse defines model for AccountListResponse.

type AccountRecoverBody

type AccountRecoverBody struct {
	// ExpectedRevision CAS 期望代际(= 读到的 LifecycleRevision);过期 → 409
	ExpectedRevision int64 `json:"expected_revision"`
}

AccountRecoverBody defines model for AccountRecoverBody.

type AccountRevision

type AccountRevision struct {
	AccountId         int64 `json:"account_id"`
	LifecycleRevision int64 `json:"lifecycle_revision"`
}

AccountRevision 单账号更新后的配置代际(C = 客户端 CAS 令牌;与路由观测面的 identity_revision 不同)

type AccountTemplateId

type AccountTemplateId = int64

AccountTemplateId defines model for AccountTemplateId.

type AccountUsageItem

type AccountUsageItem struct {
	AccountId int64 `json:"account_id"`

	// Gateway 账号网关计费聚合(usage_logs 实时明细;毫分 /1e5 → USD;无记录账号全 0)
	Gateway  UsageGatewayStats   `json:"gateway"`
	Upstream *CodexUsageSnapshot `json:"upstream"`

	// UpstreamError 上游快照失败分类(null = 无上游能力/快照成功;auth_expired = 凭据失效(fatal 类);upstream_unavailable = 网络/5xx 等上游错误)
	UpstreamError *AccountUsageItemUpstreamError `json:"upstream_error"`
}

AccountUsageItem 账号 usage 视图 item(恒 = account_ids 去重后全量;upstream 为 codex 额度快照,api-key/无凭据账号恒 null)

type AccountUsageItemUpstreamError

type AccountUsageItemUpstreamError string

AccountUsageItemUpstreamError 上游快照失败分类(null = 无上游能力/快照成功;auth_expired = 凭据失效(fatal 类);upstream_unavailable = 网络/5xx 等上游错误)

const (
	AuthExpired         AccountUsageItemUpstreamError = "auth_expired"
	UpstreamUnavailable AccountUsageItemUpstreamError = "upstream_unavailable"
)

Defines values for AccountUsageItemUpstreamError.

type AccountView

type AccountView struct {
	// BaseURL credential-type conditional: if template is codex-oauth/codex-pat must be null (non-empty forbidden); if api_key/responses-special non-empty overrides template
	BaseURL *string `json:"BaseURL"`

	// CacheDomain 共享缓存域(null = 账号私有域;软亲和一致性哈希的域标识;写面 PATCH /accounts/{id} 的 cache_domain 字段)
	CacheDomain *string    `json:"CacheDomain"`
	CreatedAt   *time.Time `json:"CreatedAt,omitempty"`

	// DeletedAt 软删除时间戳;null = 存活(列表过滤已删;GET 单个可查已删项)
	DeletedAt *time.Time `json:"DeletedAt"`

	// Enabled 管理面启停(写面 PATCH /accounts/{id} 的 enabled 字段;与运行时失效语义分离)
	Enabled *bool `json:"Enabled,omitempty"`

	// FailedAt 运行时失效时刻(rule 判死/SDK fatal;null = 未失效;恢复唯一入口 POST /accounts/{id}/recover)
	FailedAt *time.Time `json:"FailedAt"`

	// FailureSource 失效来源(rule/sdk 等;随 recover 清除)
	FailureSource *string `json:"FailureSource"`
	ID            *int64  `json:"ID,omitempty"`

	// IdentityRevision 身份代际 K:仅身份类字段(template_id/base_url/upstream_key 及可轮换凭据)按值变更时 +1;SDK 自动 token 刷新不推进
	IdentityRevision *int64     `json:"IdentityRevision,omitempty"`
	LastError        *string    `json:"LastError"`
	LastUsedAt       *time.Time `json:"LastUsedAt"`

	// LifecycleRevision 配置代际 C(客户端 CAS 令牌 + DB 变更水位):每次写面落库无条件 +1;PATCH 以 If-Match 作前置条件(陈旧 → 412),recover 以 body expected_revision(陈旧 → 409)
	LifecycleRevision *int64     `json:"LifecycleRevision,omitempty"`
	MaxConcurrency    *int       `json:"MaxConcurrency,omitempty"`
	Name              *string    `json:"Name,omitempty"`
	Template          *Template  `json:"Template,omitempty"`
	TemplateID        *int64     `json:"TemplateID,omitempty"`
	UpdatedAt         *time.Time `json:"UpdatedAt,omitempty"`

	// UpstreamCostMultiplier 采购成本倍率(正常值,1 = ×1,0 = 免费,上限 10 = ×10;API 边界与 basis points 换算——存储 25000 ↔ 显示 2.5;写面 PATCH /accounts/{id} 的 upstream_cost_multiplier 字段)
	UpstreamCostMultiplier *float64 `json:"UpstreamCostMultiplier,omitempty"`
	UpstreamKey            *string  `json:"UpstreamKey,omitempty"`
	Concurrency            *int64   `json:"concurrency,omitempty"`
	ErrCount               *int     `json:"err_count,omitempty"`
	ErrRate                *float64 `json:"err_rate,omitempty"`

	// SupplierUserId 供应商归属(null = 平台自有;非空 = 归属该 supplier uid;只读回显,写面 PATCH /accounts/{id} 的 supplier_user_id)
	SupplierUserId *int64 `json:"supplier_user_id"`
}

AccountView defines model for AccountView.

type AccountsUsageResponse

type AccountsUsageResponse struct {
	Items []AccountUsageItem `json:"items"`
}

AccountsUsageResponse 账号用量聚合响应(items 顺序 = account_ids 去重后顺序)

type AdminAPI

type AdminAPI struct {
	// contains filtered or unexported fields
}

AdminAPI 实现生成的 ServerInterface(契约层唯一实现)。 注:生成代码自带包级 func Handler(...) 路由助手,故实现结构体命名 AdminAPI 以避免与生成的 Handler 函数重名。

func New

func New(svc *service.Service, ops ...OpsOptions) *AdminAPI

New 构造契约处理器(路由由 HandlerWithOptions 生成)。 ops 变参:GetOpsWorkers 的 worker 引用在组合根(cmd/server/main.go)持有, 由装配面注入;缺省零值 = 端点返回空(测试/无运维装配场景零改动)。 统计时区不是进程态:每请求 `timezone` 参数在 handler 边界解析 (resolveStatsZone,stats_zone.go),AdminAPI 绝不持有 Location (request-browser-timezone-stats——无进程级可变得时区)。

func (*AdminAPI) CreateRule

func (h *AdminAPI) CreateRule(w http.ResponseWriter, r *http.Request)

CreateRule 创建规则(ServerInterface)。

func (*AdminAPI) DeleteAccountsId

func (h *AdminAPI) DeleteAccountsId(w http.ResponseWriter, r *http.Request, id int64)

DeleteAccountsId 删除账号(ServerInterface)。

func (*AdminAPI) DeleteGroupsId

func (h *AdminAPI) DeleteGroupsId(w http.ResponseWriter, r *http.Request, id int64)

DeleteGroupsId 删除分组(ServerInterface)。

func (*AdminAPI) DeletePriceEntry

func (h *AdminAPI) DeletePriceEntry(w http.ResponseWriter, r *http.Request, params DeletePriceEntryParams)

func (*AdminAPI) DeletePriceVariants

func (h *AdminAPI) DeletePriceVariants(w http.ResponseWriter, r *http.Request, params DeletePriceVariantsParams)

func (*AdminAPI) DeleteRule

func (h *AdminAPI) DeleteRule(w http.ResponseWriter, r *http.Request, id int64)

DeleteRule 删除规则(ServerInterface;204 No Content)。

func (*AdminAPI) DeleteTemplatesId

func (h *AdminAPI) DeleteTemplatesId(w http.ResponseWriter, r *http.Request, id int64)

DeleteTemplatesId 删除模板(ServerInterface)。

func (*AdminAPI) GetAccounts

func (h *AdminAPI) GetAccounts(w http.ResponseWriter, r *http.Request, params GetAccountsParams)

GetAccounts 账号列表(分页/筛选/排序,含运行时视图,ServerInterface)。

func (*AdminAPI) GetAccountsId

func (h *AdminAPI) GetAccountsId(w http.ResponseWriter, r *http.Request, id int64)

GetAccountsId 账号详情(ServerInterface)。

func (*AdminAPI) GetAccountsIdExt

func (h *AdminAPI) GetAccountsIdExt(w http.ResponseWriter, r *http.Request, id int64)

GetAccountsIdExt 账号类型化鉴权扩展(编辑回显;仅 codex-oauth/codex-pat 账号有 ext 行,ServerInterface)。账号缺 id / 无 ext 行 → 404。

func (*AdminAPI) GetAccountsIdGroups

func (h *AdminAPI) GetAccountsIdGroups(w http.ResponseWriter, r *http.Request, id int64)

GetAccountsIdGroups 账号的全部分组 id(编辑回显;账号缺 id → 404, ServerInterface)。

func (*AdminAPI) GetAccountsUsage

func (h *AdminAPI) GetAccountsUsage(w http.ResponseWriter, r *http.Request, params GetAccountsUsageParams)

GetAccountsUsage 账号用量聚合(/api/admin/accounts/usage——统一 usage API 查询 面 spec 2026-08-18,ServerInterface)。参数解析与校验在 handler 层: account_ids 逗号分隔必填(非数字/空/去重后 >100 → 400);窗口**两形态恰择一** (P3,spec §7.3):from+to 绝对窗口,或 window 时长串相对窗口(服务端自持 `h.now`:to = 整点向上取整、from = to − window)。两态都给 / 只给一端 / 都不给 → 400 `window_ambiguous`;`window` 不是时长串(如 `7d`)→ 400 `window_invalid`。 **本端点不再有"缺省 = 当天"**(那正是"两态都不给"的第三种形态,双路径按裁决 删除而非兼容;调用方必须显式说出它要哪一段)。响应 items 恒 = account_ids 去重后全量(无记录账号 gateway 全 0——前端免补零),顺序 = 去重后顺序。

**窗口上限与覆盖率在 service 层判定**(domain.Admit,KindUsageAgg:raw cost 90d + usage_logs 覆盖率)——本 handler 只把线上形态解码成一对绝对时刻, 倒序(from 不早于 to)也由 Admit step 1 报 400(window_invalid),不再有第二 份形状校验(spec §4.5:全区间 GROUP BY 无 LIMIT 的真实成本洞在 service 补掉)。

func (*AdminAPI) GetAdminOverview

func (h *AdminAPI) GetAdminOverview(w http.ResponseWriter, r *http.Request, params GetAdminOverviewParams)

GET /api/admin/overview 管理端总览(spec 2026-08-14):一站式聚合端点—— summary(今日请求浏览器时区日界,cost 毫分 /1e5 → USD)+ trend(近 N 天日 桶,SQL 侧按请求时区分组)+ accounts(调度器快照健康分布/并发水位)+ resources(三表冷面 count)+ err_top(账号维度 EWMA Top5)+ alerts(billing 游标积压 lag 族注入面)。全冷面(聚合查询 + 快照遍历);内部 TTL 30s 缓存, 键含 days/group_id + 请求时区规范名 + 该时区日界(summary"今日"跨午夜滚转 且不同浏览器时区结果各异——两分量都进键,无进程级时区);无 singleflight (dashboard 单消费者,声明接受)。

func (*AdminAPI) GetAdminSettings

func (h *AdminAPI) GetAdminSettings(w http.ResponseWriter, r *http.Request)

GetAdminSettings 全部设置(默认值 + DB 覆盖;ServerInterface)。

func (*AdminAPI) GetAdminSupplierBalances

func (h *AdminAPI) GetAdminSupplierBalances(w http.ResponseWriter, r *http.Request, params GetAdminSupplierBalancesParams)

GetAdminSupplierBalances GET /api/admin/supplier/balances(§6.3)。

func (*AdminAPI) GetAdminSupplierSettlements

func (h *AdminAPI) GetAdminSupplierSettlements(w http.ResponseWriter, r *http.Request, params GetAdminSupplierSettlementsParams)

GetAdminSupplierSettlements GET /api/admin/supplier/settlements(§6.3)。

func (*AdminAPI) GetAdminUsersTop

func (h *AdminAPI) GetAdminUsersTop(w http.ResponseWriter, r *http.Request, params GetAdminUsersTopParams)

GET /api/admin/users-top 实时在途并发排行(spec 2026-08-14):读门禁快照在途 计数(Auth.InFlightUsers 只读访问器——零锁零热路径)→ 过滤 0 → 降序 → TopN(缺省 20,上限 100)+ other 归并(其余在途用户合计,非伪用户条目); email = TopN user_id 一次 IN 查询回填(users 表无 name 列——仅 email)。 内部 TTL 2s 缓存(top 并入缓存键);多实例部署下为**本实例**在途并发。

func (*AdminAPI) GetErrLogs

func (h *AdminAPI) GetErrLogs(w http.ResponseWriter, r *http.Request, params GetErrLogsParams)

GetErrLogs 错误明细分页查询(/err_logs:完整错误面——本地拒绝 + 半异常双轨, status_code/error_type 全值)。过滤面与 /usage_logs 同构 + status_code; keyset 游标分页与 /usage_logs 同语义(from/to 必填、cursor 透传、next_cursor 组装 ——limit 归一/探测走 httpface.LogLimit + ClipLogPage,C2 消重)。

func (*AdminAPI) GetGroups

func (h *AdminAPI) GetGroups(w http.ResponseWriter, r *http.Request, params GetGroupsParams)

GetGroups 分组列表(分页/筛选/排序,ServerInterface)。

func (*AdminAPI) GetGroupsId

func (h *AdminAPI) GetGroupsId(w http.ResponseWriter, r *http.Request, id int64)

GetGroupsId 分组详情(ServerInterface)。

func (*AdminAPI) GetGroupsIdAssignments

func (h *AdminAPI) GetGroupsIdAssignments(w http.ResponseWriter, r *http.Request, id int64)

GetGroupsIdAssignments 读取组的授予用户与专属倍率(platform_admin;与 PUT 对称,供前端预填充与安全全量写回;ServerInterface)。mults 只含有专属倍率 的用户(null/缺省 = 未设置 → 用组倍率)。

func (*AdminAPI) GetKeys

func (h *AdminAPI) GetKeys(w http.ResponseWriter, r *http.Request, params GetKeysParams)

GetKeys 密钥列表(脱敏,不含 key 明文;platform_admin 专属,ServerInterface)。 参数为 limit/offset 直接范式(不走 pageToQuery 的 page/page_size 范式—— 本端点分页规格即 limit/offset);limit/offset 缺省归一在 ListQuery 内 (20/0),sort/order 缺省(id/desc)与白名单校验在 sortOrder。

func (*AdminAPI) GetMailTemplates

func (h *AdminAPI) GetMailTemplates(w http.ResponseWriter, r *http.Request)

GetMailTemplates 邮件模板列表(缺行自动回退内置默认)。

func (*AdminAPI) GetOpsWorkers

func (h *AdminAPI) GetOpsWorkers(w http.ResponseWriter, r *http.Request)

GetOpsWorkers 契约实现(api.gen.go ServerInterface):按需组装,无缓存。 stats 直出各 worker 原类型(契约自由 schema,JSON 序列化时原样编码,零转换)。

func (*AdminAPI) GetPriceEntry

func (h *AdminAPI) GetPriceEntry(w http.ResponseWriter, r *http.Request, params GetPriceEntryParams)

func (*AdminAPI) GetPriceVariants

func (h *AdminAPI) GetPriceVariants(w http.ResponseWriter, r *http.Request, params GetPriceVariantsParams)

func (*AdminAPI) GetPrices

func (h *AdminAPI) GetPrices(w http.ResponseWriter, r *http.Request, params GetPricesParams)

func (*AdminAPI) GetRedemptionCodes

func (h *AdminAPI) GetRedemptionCodes(w http.ResponseWriter, r *http.Request, params GetRedemptionCodesParams)

GetRedemptionCodes 兑换码列表(增强分页范式 + type/status 筛选 + sort 白名单, ServerInterface)。

func (*AdminAPI) GetRedemptionCodesIdUses

func (h *AdminAPI) GetRedemptionCodesIdUses(w http.ResponseWriter, r *http.Request, id int64, params GetRedemptionCodesIdUsesParams)

GetRedemptionCodesIdUses 某码的兑换记录(审计;码缺失 → 404,ServerInterface)。 面值换算需码的 type(use 行不存类型——与前端 uses 弹窗同构:取码行 Type 换算)。 limit/offset 直透 ListQuery(缺省归一在 repo——spec 2026-08-17 补分页)。

func (*AdminAPI) GetRoutingFlow

func (h *AdminAPI) GetRoutingFlow(w http.ResponseWriter, r *http.Request, params GetRoutingFlowParams)

GetRoutingFlow 路由 flow 聚合 — ServerInterface。

func (*AdminAPI) GetRoutingFrontier

func (h *AdminAPI) GetRoutingFrontier(w http.ResponseWriter, r *http.Request, params GetRoutingFrontierParams)

GetRoutingFrontier 质量-成本前沿 — ServerInterface。limit 缺省/越界由 service 归一钳制(≤0→20,>200→200),handler 不重复实现。

func (*AdminAPI) GetRoutingPlan

func (h *AdminAPI) GetRoutingPlan(w http.ResponseWriter, r *http.Request, params GetRoutingPlanParams)

GetRoutingPlan 当前发布计划解释 — ServerInterface(无历史 generation 查询 面;search/route/分页见契约)。分页与切片归一全在 service,handler 只做 「缺省指针 → 契约默认」的取值。

func (*AdminAPI) GetStatsCapabilities

func (h *AdminAPI) GetStatsCapabilities(w http.ResponseWriter, r *http.Request)

GetStatsCapabilities 统计能力(spec §4.4(a)):本部署的 per-deployment 常量, 无参数、只读、可按部署缓存。**零字面量**——数据面由 `service.StatsCapabilities`(= domain.StatsKinds × 注入保留期的机械投影)给出, 本层只做形状映射(改这里的数字不可能,因为没有任何数字可改:上限/覆盖天数 全部来自同一份 KIND 矩阵)。`zero literals` 由 spec §8 A16'② 的 零命中 `git grep` 审计钉死:本包(含测试)不得出现任何上限秒值字面量。

func (*AdminAPI) GetStatsEntityTrend

func (h *AdminAPI) GetStatsEntityTrend(w http.ResponseWriter, r *http.Request, params GetStatsEntityTrendParams)

GetStatsEntityTrend 实体趋势(时区判定/窗口形态解码/回显同 GetStatsTrend)。

func (*AdminAPI) GetStatsTTFT

func (h *AdminAPI) GetStatsTTFT(w http.ResponseWriter, r *http.Request, params GetStatsTTFTParams)

GetStatsTTFT TTFT 聚合(sketch/exact 双分支)。分位数/计数为绝对区间数值 ——时区不改变结果;`timezone` 仅接受并校验(非法 400),不进查询、不进缓存键。

func (*AdminAPI) GetStatsTop

func (h *AdminAPI) GetStatsTop(w http.ResponseWriter, r *http.Request, params GetStatsTopParams)

GetStatsTop Top 排行(entity 卷积)。排行按实体聚合、无时间桶——数值与 时区无关;`timezone` 参数仅接受并校验(契约一致性:客户端统一带浏览器 时区,非法名照旧 400),不进查询。

func (*AdminAPI) GetStatsTrend

func (h *AdminAPI) GetStatsTrend(w http.ResponseWriter, r *http.Request, params GetStatsTrendParams)

GetStatsTrend 趋势聚合(按请求 `timezone` 判定 cube/原始行走哪条——判定在 domain.Admit,本层只读判定结果)。200 体是裸数组,故生效窗口与实际存储走 回显头(spec §4.4(b))。窗口两形态(from+to / window 单独,恰择一)在 httpface.ResolveStatsWindow 解码,时钟用本层可注入的 h.now(P3)——本层不判 "这个窗口能不能被服务"。ServerInterface。

func (*AdminAPI) GetSupplierChunks

func (h *AdminAPI) GetSupplierChunks(w http.ResponseWriter, r *http.Request, params supplier.GetSupplierChunksParams)

GetSupplierChunks GET /api/user/supplier/chunks。

func (*AdminAPI) GetSupplierEarnings

func (h *AdminAPI) GetSupplierEarnings(w http.ResponseWriter, r *http.Request, params supplier.GetSupplierEarningsParams)

GetSupplierEarnings GET /api/user/supplier/earnings。

func (*AdminAPI) GetSupplierOverview

func (h *AdminAPI) GetSupplierOverview(w http.ResponseWriter, r *http.Request)

GetSupplierOverview GET /api/user/supplier/overview。

func (*AdminAPI) GetSupplierSettlements

func (h *AdminAPI) GetSupplierSettlements(w http.ResponseWriter, r *http.Request, params supplier.GetSupplierSettlementsParams)

GetSupplierSettlements GET /api/user/supplier/settlements。

func (*AdminAPI) GetTempBalances

func (h *AdminAPI) GetTempBalances(w http.ResponseWriter, r *http.Request, params GetTempBalancesParams)

GetTempBalances 临时额度列表(增强分页范式 + user_id 筛选 + sort 白名单 expires_at/amount/created_at + order,ServerInterface)。默认排序 expires_at asc(FEFO 同序——与扣费顺序一致);ListQuery.sortOrder 缺省 sort 为 id, 本端点白名单不含 id,故缺省在 handler 显式归一为 expires_at。

func (*AdminAPI) GetTemplates

func (h *AdminAPI) GetTemplates(w http.ResponseWriter, r *http.Request, params GetTemplatesParams)

GetTemplates 模板列表(分页/筛选/排序,ServerInterface)。

func (*AdminAPI) GetTemplatesId

func (h *AdminAPI) GetTemplatesId(w http.ResponseWriter, r *http.Request, id int64)

GetTemplatesId 模板详情(ServerInterface)。

func (*AdminAPI) GetTemplatesIdExt

func (h *AdminAPI) GetTemplatesIdExt(w http.ResponseWriter, r *http.Request, id int64)

GetTemplatesIdExt 模板类型化扩展(编辑回显;仅生态三类型模板有 ext 行, ServerInterface)。模板缺 id / 无 ext 行 → 404。

func (*AdminAPI) GetUsageLogs

func (h *AdminAPI) GetUsageLogs(w http.ResponseWriter, r *http.Request, params GetUsageLogsParams)

GetUsageLogs 用量明细分页查询(/usage_logs;消费面改名裁决:/logs → /usage_logs 与表名一致)。keyset 游标分页(用户裁决:from/to 生成层必填 400,cursor 缺失/≤0 = 首页;limit 上限 200 超限裁剪——游标语义下 Total 已从契约移除)。 error_type 过滤保留——usage_logs 只剩 abort/failover 半异常标记(错误审计 面在 /err_logs)。

limit 缺省/钳制走 httpface.LogLimit,limit+1 探测走 httpface.ClipLogPage (与 4 个 usage/errlog handler 同源语义,C2 消重)。

func (*AdminAPI) GetUsers

func (h *AdminAPI) GetUsers(w http.ResponseWriter, r *http.Request, params GetUsersParams)

GetUsers 用户列表(platform_admin 专属;/admin 组中间件已鉴权, ServerInterface)。

func (*AdminAPI) GetUsersIdBalanceLogs

func (h *AdminAPI) GetUsersIdBalanceLogs(w http.ResponseWriter, r *http.Request, id int64, params GetUsersIdBalanceLogsParams)

GetUsersIdBalanceLogs 某用户的余额变动记录(platform_admin 专属;分页; limit 经 ClampLimit 上限 200 裁剪,≤0 由 repo 归一 20,ServerInterface)。 先 GetUser 校验用户存在(缺失 → 404,对齐 GetRedemptionCodesIdUses 取码范式)。

func (*AdminAPI) GetUsersIdGroups

func (h *AdminAPI) GetUsersIdGroups(w http.ResponseWriter, r *http.Request, id int64)

GetUsersIdGroups 读取用户被授予的组与各专属倍率(platform_admin;用户视角, 与 /groups/{id}/assignments 对称;ServerInterface)。mults 只含有专属倍率的 组(null/缺省 = 未设置 → 用组倍率)。

func (*AdminAPI) ListRules

func (h *AdminAPI) ListRules(w http.ResponseWriter, r *http.Request, params ListRulesParams)

ListRules 规则列表(enabled 过滤 + priority 升序,ServerInterface)。

func (*AdminAPI) PatchAccountsId

func (h *AdminAPI) PatchAccountsId(w http.ResponseWriter, r *http.Request, id int64, params PatchAccountsIdParams)

PatchAccountsId 账号配置的部分更新(ServerInterface)。三态见 accountPatchFromBody;If-Match 可选(缺席 = 不做前置条件检查),陈旧 → 412, 语法非法 → 400。

func (*AdminAPI) PatchAdminSupplierBalancesUid

func (h *AdminAPI) PatchAdminSupplierBalancesUid(w http.ResponseWriter, r *http.Request, uid int64)

PatchAdminSupplierBalancesUid PATCH /api/admin/supplier/balances/{uid}(§6.3/§6.4 A16⑤):仅 share_bp/freeze_hours(不接受金额)。

func (*AdminAPI) PostAccounts

func (h *AdminAPI) PostAccounts(w http.ResponseWriter, r *http.Request)

PostAccounts 创建账号(ServerInterface)。创建体是唯一字段模型的别名 (AccountCreate = AccountConfigPatch + required[name,template_id]),直接复用 同一个三态转换;Name/TemplateID 必填由 service 收口判定。

func (*AdminAPI) PostAccountsBatchDelete

func (h *AdminAPI) PostAccountsBatchDelete(w http.ResponseWriter, r *http.Request)

PostAccountsBatchDelete 批量删除账号(事务,全成或全败;删除后调度快照 失效由 service invalidate 完成,ServerInterface)。

func (*AdminAPI) PostAccountsBatchImportCodexOauth

func (h *AdminAPI) PostAccountsBatchImportCodexOauth(w http.ResponseWriter, r *http.Request)

PostAccountsBatchImportCodexOauth 批量导入 codex-oauth 凭据(ServerInterface)。 结构错误(items 空/超 100、template_id 缺)→ 400;行级失败归 failed(HTTP 恒 200——行级语义,全部失败也 200)。

func (*AdminAPI) PostAccountsBatchImportCodexPat

func (h *AdminAPI) PostAccountsBatchImportCodexPat(w http.ResponseWriter, r *http.Request)

PostAccountsBatchImportCodexPat 批量导入 codex-pat 凭据(ServerInterface; 结构校验与响应组装同 oauth 端点)。

func (*AdminAPI) PostAccountsBatchUpdate

func (h *AdminAPI) PostAccountsBatchUpdate(w http.ResponseWriter, r *http.Request)

PostAccountsBatchUpdate 批量更新账号(fields 任意子集;更新后调度快照 失效由 service invalidate 完成,ServerInterface)。响应携带每账号的新配置 代际。

func (*AdminAPI) PostAccountsIdRecover

func (h *AdminAPI) PostAccountsIdRecover(w http.ResponseWriter, r *http.Request, id int64)

PostAccountsIdRecover 失效恢复(fenced CAS):清失效三字段 + revision +1 → 新代际置 PROBING;stale → 409(ServerInterface)。

func (*AdminAPI) PostAdminSupplierSettlementsAdminRequest

func (h *AdminAPI) PostAdminSupplierSettlementsAdminRequest(w http.ResponseWriter, r *http.Request)

PostAdminSupplierSettlementsAdminRequest 代申请(kind=admin_request;§6.3)。

func (*AdminAPI) PostAdminSupplierSettlementsIdApprove

func (h *AdminAPI) PostAdminSupplierSettlementsIdApprove(w http.ResponseWriter, r *http.Request, id int64)

PostAdminSupplierSettlementsIdApprove pending → approved(§6.3)。

func (*AdminAPI) PostAdminSupplierSettlementsIdClaim

func (h *AdminAPI) PostAdminSupplierSettlementsIdClaim(w http.ResponseWriter, r *http.Request, id int64)

PostAdminSupplierSettlementsIdClaim approved → paying(认领 + 风控门;§6.5)。

func (*AdminAPI) PostAdminSupplierSettlementsIdConfirmFailed

func (h *AdminAPI) PostAdminSupplierSettlementsIdConfirmFailed(w http.ResponseWriter, r *http.Request, id int64)

PostAdminSupplierSettlementsIdConfirmFailed paying → approved(仅结构化「确定未支付」 +「旧执行已停止」核验;未知 ⇒ 失败闭合保留 paying)。

func (*AdminAPI) PostAdminSupplierSettlementsIdPaid

func (h *AdminAPI) PostAdminSupplierSettlementsIdPaid(w http.ResponseWriter, r *http.Request, id int64)

PostAdminSupplierSettlementsIdPaid 仅 paying → paid(lifetime_paid 累加;external_ref 必须非空)。

func (*AdminAPI) PostAdminSupplierSettlementsIdReject

func (h *AdminAPI) PostAdminSupplierSettlementsIdReject(w http.ResponseWriter, r *http.Request, id int64)

PostAdminSupplierSettlementsIdReject pending|approved → rejected(退还 available)。

func (*AdminAPI) PostGroups

func (h *AdminAPI) PostGroups(w http.ResponseWriter, r *http.Request)

PostGroups 创建分组(平台容量池;key 为独立表,用户面 /api/user/keys 创建, ServerInterface)。price_multiplier(正常值 0~10,API 边界换算万分数): 缺省/null = 不设置(×1);显式 0 = 免费组(恒写入:API 可表达 显式 0,repo 不再把 0 当未指定)。

func (*AdminAPI) PostGroupsBatchDelete

func (h *AdminAPI) PostGroupsBatchDelete(w http.ResponseWriter, r *http.Request)

PostGroupsBatchDelete 批量删除分组(事务,全成或全败;key 清理由 service 完成,ServerInterface)。

func (*AdminAPI) PostGroupsBatchUpdate

func (h *AdminAPI) PostGroupsBatchUpdate(w http.ResponseWriter, r *http.Request)

PostGroupsBatchUpdate 批量更新分组(fields 任意子集,ServerInterface)。

func (*AdminAPI) PostMailChannelTest

func (h *AdminAPI) PostMailChannelTest(w http.ResponseWriter, r *http.Request)

func (*AdminAPI) PostPricingSync

func (h *AdminAPI) PostPricingSync(w http.ResponseWriter, r *http.Request)

func (*AdminAPI) PostPricingSyncPreview

func (h *AdminAPI) PostPricingSyncPreview(w http.ResponseWriter, r *http.Request)

func (*AdminAPI) PostRedemptionCodes

func (h *AdminAPI) PostRedemptionCodes(w http.ResponseWriter, r *http.Request)

PostRedemptionCodes 生成兑换码(1..count 个;count 默认 1,上限 1000, ServerInterface)。

func (*AdminAPI) PostRedemptionCodesBatchDeactivate

func (h *AdminAPI) PostRedemptionCodesBatchDeactivate(w http.ResponseWriter, r *http.Request)

PostRedemptionCodesBatchDeactivate 批量失效(单事务;已失效 no-op;缺失 id → 404 含缺失详情,ServerInterface)。

func (*AdminAPI) PostRedemptionCodesIdDeactivate

func (h *AdminAPI) PostRedemptionCodesIdDeactivate(w http.ResponseWriter, r *http.Request, id int64)

PostRedemptionCodesIdDeactivate 单码失效(已失效 no-op 成功;缺失 → 404, ServerInterface)。

func (*AdminAPI) PostRulesBatchDelete

func (h *AdminAPI) PostRulesBatchDelete(w http.ResponseWriter, r *http.Request)

PostRulesBatchDelete 批量删除规则(事务,全成或全败,ServerInterface)。

func (*AdminAPI) PostSupplierSettlement

func (h *AdminAPI) PostSupplierSettlement(w http.ResponseWriter, r *http.Request)

PostSupplierSettlement POST /api/user/supplier/settlements(申请结算 §6.2)。 具名 JWT 操作者(I5):actor 从已验证 claims 构造(缺 ⇒ 403,fail-closed)。

func (*AdminAPI) PostTemplates

func (h *AdminAPI) PostTemplates(w http.ResponseWriter, r *http.Request)

PostTemplates 创建模板(ServerInterface)。

func (*AdminAPI) PostTemplatesBatchDelete

func (h *AdminAPI) PostTemplatesBatchDelete(w http.ResponseWriter, r *http.Request)

PostTemplatesBatchDelete 批量删除模板(事务,全成或全败,ServerInterface)。

func (*AdminAPI) PostTemplatesBatchUpdate

func (h *AdminAPI) PostTemplatesBatchUpdate(w http.ResponseWriter, r *http.Request)

PostTemplatesBatchUpdate 批量更新模板(fields 任意子集,ServerInterface)。

func (*AdminAPI) PostUsers

func (h *AdminAPI) PostUsers(w http.ResponseWriter, r *http.Request)

PostUsers 创建用户(platform_admin 专属;email 唯一/密码长度校验在 service;balance 输入 USD 换算毫分,ServerInterface)。

func (*AdminAPI) PutAccountsIdExt

func (h *AdminAPI) PutAccountsIdExt(w http.ResponseWriter, r *http.Request, id int64)

PutAccountsIdExt 幂等写入账号类型化鉴权扩展(Create/Update 合一;全列更新 含 NULL 清空,ServerInterface)。credential_type ∈ {codex-oauth, codex-pat}; 持久身份(codex_identity 对象——仅 installation_id)首次写入缺省 → service 自动生成并持久化(账号存在期间稳定);类型-列组约束与账号缺 id → 400/404(service 校验)。

请求体空值语义(显式空串统一——breaking 内契约):

  • 凭据/管理列(codex_oauth_* / codex_pat_key / codex_email / codex_account_id):null/缺省 = NULL 清空落库;空串 = 字面空值写入 (两者区分——空串是合法值,不归一 NULL);
  • codex_identity 对象字段:null 与空串同语义 = 未提供(handler 归一空串, service 自动生成/沿用——identity 无清空路径)。

func (*AdminAPI) PutAdminSettings

func (h *AdminAPI) PutAdminSettings(w http.ResponseWriter, r *http.Request)

PutAdminSettings 更新设置(类型化校验在 service;返回更新后全部设置, ServerInterface)。

func (*AdminAPI) PutGroupsId

func (h *AdminAPI) PutGroupsId(w http.ResponseWriter, r *http.Request, id int64)

PutGroupsId 全量更新分组(ServerInterface)。price_multiplier(正常值 0~10)提供(含 0 = 免费)即写入;缺省 = 保持原值。

func (*AdminAPI) PutGroupsIdAssignments

func (h *AdminAPI) PutGroupsIdAssignments(w http.ResponseWriter, r *http.Request, id int64)

PutGroupsIdAssignments 设置组的授予用户(platform_admin 专属;替换语义: 未列出即撤销,空数组 = 清空;ServerInterface)。multipliers 可选:user_id → 该用户在该组的专属价格倍率(正常值 0~10;null = 清除为未设置 → 回退组 倍率; 修正:用户专属倍率按组挂载)。

func (*AdminAPI) PutMailTemplate

func (h *AdminAPI) PutMailTemplate(w http.ResponseWriter, r *http.Request, purpose string)

PutMailTemplate 更新邮件模板(空 body_text 还原默认=删行)。

func (*AdminAPI) PutPriceEntry

func (h *AdminAPI) PutPriceEntry(w http.ResponseWriter, r *http.Request, params PutPriceEntryParams)

func (*AdminAPI) PutPriceVariants

func (h *AdminAPI) PutPriceVariants(w http.ResponseWriter, r *http.Request, params PutPriceVariantsParams)

func (*AdminAPI) PutTemplatesId

func (h *AdminAPI) PutTemplatesId(w http.ResponseWriter, r *http.Request, id int64)

PutTemplatesId 全量更新模板(ServerInterface)。

func (*AdminAPI) PutTemplatesIdExt

func (h *AdminAPI) PutTemplatesIdExt(w http.ResponseWriter, r *http.Request, id int64)

PutTemplatesIdExt 幂等写入模板类型化扩展(Create/Update 合一;全列更新含 NULL 清空,ServerInterface)。credential_type 必填;类型一致性(ext 行类型 必须 == 父模板类型)与模板缺 id → 400/404(service 校验)。模板是共享配置 面:唯一可配置列 strip_image_tools(三类型公共能力开关)——凭据(oauth/pat) 一律在账号级 account_ext。

func (*AdminAPI) PutUsersId

func (h *AdminAPI) PutUsersId(w http.ResponseWriter, r *http.Request, id int64)

PutUsersId 更新用户(role/status/max_concurrency/balance;变更即时生效—— Auth 快照刷新,ServerInterface)。 patch 形态(v02 核实修复):只把请求显式提供的字段传给更新——请求不带 balance 时不再把 GET 快照陈旧值全量写回(与 flusher 扣费双向覆盖、余额凭空 复活);balance/max_concurrency 显式设置时带 GET 快照旧值条件(期间有扣费 → 0 行 → service 重读重试,new 保持管理员显式意图)。

func (*AdminAPI) PutUsersIdGroups

func (h *AdminAPI) PutUsersIdGroups(w http.ResponseWriter, r *http.Request, id int64)

PutUsersIdGroups 设置用户的授予分组(platform_admin;替换语义:group_ids = 完整授予组列表(未列出即撤销,空数组 = 清空);ServerInterface)。 multipliers 可选:group_id → 该用户在该组的专属价格倍率(正常值 0~10; null = 清除为未设置 → 回退组倍率;键必须 ∈ group_ids)。

func (*AdminAPI) Router

func (h *AdminAPI) Router() http.Handler

Router 返回带 /api/admin 前缀的 chi 路由(替代原 Routes/RoutesMux)。 ErrorHandlerFunc 覆盖生成的默认 http.Error 纯文本 400:参数绑定失败 (InvalidParamFormatError 等)统一输出契约 ErrorResponse({"error": ...})。

func (*AdminAPI) SupplierSurfaceHandler

func (h *AdminAPI) SupplierSurfaceHandler() http.Handler

SupplierSurfaceHandler 供应商面生成路由(tag `supplier` 的 22 op,绝对路径、 无 BaseURL;故 HandlerWithOptions 直接按 spec 路径注册)。业务 op 走本包 handler, 账号/分组/模板 op 由生成 wrapper 解析一次参数后类型化直调同一批 AdminAPI 实现 ——**暴露面唯一事实源 = openapi**。

func (*AdminAPI) UpdateRule

func (h *AdminAPI) UpdateRule(w http.ResponseWriter, r *http.Request, id int64)

UpdateRule 部分更新规则(未提供字段保持原值,ServerInterface)。

type AdminKey

type AdminKey struct {
	CreatedAt *time.Time `json:"CreatedAt,omitempty"`
	DeletedAt *time.Time `json:"DeletedAt"`
	GroupID   *int64     `json:"GroupID,omitempty"`

	// GroupName 归属分组名(只读投影;组非存活/未加载 → 空串)
	GroupName      *string `json:"GroupName,omitempty"`
	ID             *int64  `json:"ID,omitempty"`
	MaxConcurrency *int    `json:"MaxConcurrency,omitempty"`
	Name           *string `json:"Name,omitempty"`

	// Quota 累计最终计费金额上限(毫分,1 USD = 100,000 毫分);0 = 不限
	Quota *int64 `json:"Quota,omitempty"`

	// QuotaUsed 已消耗计费金额(毫分;后扣;无额度 key 恒 0)
	QuotaUsed *int64     `json:"QuotaUsed,omitempty"`
	Status    *KeyStatus `json:"Status,omitempty"`
	UpdatedAt *time.Time `json:"UpdatedAt,omitempty"`
	UserID    *int64     `json:"UserID,omitempty"`
}

AdminKey defines model for AdminKey.

type AdminKeyListResponse

type AdminKeyListResponse struct {
	Rows  []AdminKey `json:"rows"`
	Total int64      `json:"total"`
}

AdminKeyListResponse defines model for AdminKeyListResponse.

type AdminRequestSettlementBody

type AdminRequestSettlementBody struct {
	// AmountMillis 金额(> 0)
	AmountMillis int64   `json:"amount_millis"`
	Note         *string `json:"note,omitempty"`

	// RequestKey 业务幂等键
	RequestKey string `json:"request_key"`

	// SupplierUserId 目标供应商(须已有余额行,否则 404)
	SupplierUserId int64 `json:"supplier_user_id"`
}

AdminRequestSettlementBody defines model for AdminRequestSettlementBody.

type AdminTempBalanceRow

type AdminTempBalanceRow struct {
	// AmountUsd 金额 USD(毫分 /1e5;1 USD = 100,000 毫分)
	AmountUsd float64   `json:"amount_usd"`
	CreatedAt time.Time `json:"created_at"`

	// ExpiresAt 到期时间;null = 永久额度
	ExpiresAt *time.Time `json:"expires_at"`
	Id        int64      `json:"id"`
	Note      *string    `json:"note"`
	UserId    int64      `json:"user_id"`
}

AdminTempBalanceRow defines model for AdminTempBalanceRow.

type AdminTempBalancesResponse

type AdminTempBalancesResponse struct {
	Rows  []AdminTempBalanceRow `json:"rows"`
	Total int64                 `json:"total"`
}

AdminTempBalancesResponse defines model for AdminTempBalancesResponse.

type BalanceLog

type BalanceLog struct {
	// Amount 变动额 USD(有符号:正=增加/负=减少;1 USD = 100,000 毫分)
	Amount float64 `json:"Amount"`

	// BalanceAfter 变更后余额 USD(毫分快照 /1e5)
	BalanceAfter float64   `json:"BalanceAfter"`
	CreatedAt    time.Time `json:"CreatedAt"`
	ID           int64     `json:"ID"`

	// Note 附加说明(兑换→兑换码文本;其余可空)
	Note *string `json:"Note"`

	// OperatorID 0 = 系统/用户自助;>0 = platform_admin 用户 id
	OperatorID int64            `json:"OperatorID"`
	Source     BalanceLogSource `json:"Source"`
	UserID     int64            `json:"UserID"`
}

BalanceLog defines model for BalanceLog.

type BalanceLogListResponse

type BalanceLogListResponse struct {
	Rows  []BalanceLog `json:"rows"`
	Total int64        `json:"total"`
}

BalanceLogListResponse defines model for BalanceLogListResponse.

type BalanceLogSource

type BalanceLogSource string

BalanceLogSource defines model for BalanceLogSource.

const (
	AdminAdjust   BalanceLogSource = "admin_adjust"
	AdminCreate   BalanceLogSource = "admin_create"
	Redemption    BalanceLogSource = "redemption"
	SignupDefault BalanceLogSource = "signup_default"
)

Defines values for BalanceLogSource.

type BatchDeactivateRequest

type BatchDeactivateRequest struct {
	Ids []int64 `json:"ids"`
}

BatchDeactivateRequest defines model for BatchDeactivateRequest.

type BatchDeactivateResponse

type BatchDeactivateResponse struct {
	// Deactivated 新失效数(已 disabled no-op 不计)
	Deactivated int `json:"deactivated"`
}

BatchDeactivateResponse defines model for BatchDeactivateResponse.

type BatchDeleteBody

type BatchDeleteBody struct {
	Ids []int64 `json:"ids"`
}

BatchDeleteBody defines model for BatchDeleteBody.

type BatchDeleteResponse

type BatchDeleteResponse struct {
	Deleted int `json:"deleted"`
}

BatchDeleteResponse defines model for BatchDeleteResponse.

type BatchUpdateAccountsBody

type BatchUpdateAccountsBody struct {
	// Fields 账号写面唯一字段模型(创建 / PATCH / 批量共用)。三态:字段缺席 = 不变(永不清空); 可空标量 null = 清空;集合 null = 不变、[] = 清空;不可空标量 null = 400; 可空标量 "" = 400(空串哨兵已取消——清空只有一个拼法 null)。
	Fields AccountConfigPatch `json:"fields"`
	Ids    []int64            `json:"ids"`
}

BatchUpdateAccountsBody defines model for BatchUpdateAccountsBody.

type BatchUpdateGroupsBody

type BatchUpdateGroupsBody struct {
	Fields GroupPatch `json:"fields"`
	Ids    []int64    `json:"ids"`
}

BatchUpdateGroupsBody defines model for BatchUpdateGroupsBody.

type BatchUpdateResponse

type BatchUpdateResponse struct {
	Updated int `json:"updated"`
}

BatchUpdateResponse defines model for BatchUpdateResponse.

type BatchUpdateTemplatesBody

type BatchUpdateTemplatesBody struct {
	Fields TemplatePatch `json:"fields"`
	Ids    []int64       `json:"ids"`
}

BatchUpdateTemplatesBody defines model for BatchUpdateTemplatesBody.

type BillingAlerts

type BillingAlerts struct {
	LagMs           int64
	UnbilledRows    int64
	QuarantinedRows int64
}

BillingAlerts overview.alerts 数据(billing 游标积压 lag 族三真值原样直出 ——每周期收尾 refreshLag 原子写,见 billing.FlusherStats)。

type ChiServerOptions

type ChiServerOptions struct {
	BaseURL          string
	BaseRouter       chi.Router
	Middlewares      []MiddlewareFunc
	ErrorHandlerFunc func(w http.ResponseWriter, r *http.Request, err error)
}

type CodexCredits

type CodexCredits struct {
	Balance *string `json:"balance"`
}

CodexCredits 充值余额(金额字符串,如 "12.50";上游空串 → null,非空串占位)

type CodexIdentity

type CodexIdentity struct {
	// InstallationId 身份:账号级唯一(UUIDv4;响应恒有——首次写入自动生成;空/缺省 → service 自动生成)
	InstallationId *string `json:"installation_id,omitempty"`
}

CodexIdentity codex 账号持久身份(account_ext.codex_identity jsonb 契约形态;对象字段请求语义:null 与空串同 = 未提供)。仅 installation_id——会话级 session/thread/window 已退役为运行时槽状态,不再持久化/暴露。

type CodexOAuthImportBody

type CodexOAuthImportBody struct {
	// CacheDomain 可选:新建账号的共享缓存域(缺省/空串 = 账号私有域;非空须为合法小写域名 ≤253——非法 → 400 整批拒绝)
	CacheDomain *string `json:"cache_domain,omitempty"`

	// Enabled 可选:新建账号的管理面启停(缺省 true = 启用;仅新建行生效)
	Enabled *bool `json:"enabled,omitempty"`

	// GroupId 可选:新建账号归组(缺省不归组;不存在 → 行级 failed——FK 违反归行级不整批 400)
	GroupId *int64                 `json:"group_id"`
	Items   []CodexOAuthImportItem `json:"items"`

	// SupplierUserId 保留:供应商面出现 ⇒ 400(归属恒为 JWT 本人;导入不分配归属)
	SupplierUserId *int64 `json:"supplier_user_id"`

	// TemplateId 必填:codex 账号归属模板(credential_type 必须 == 端点类型 codex-oauth)
	TemplateId int64 `json:"template_id"`

	// UpstreamCostMultiplier 可选:新建账号的采购成本倍率(缺省 ×1;0–10,0 = 免费;越界 → 400 整批拒绝)
	UpstreamCostMultiplier *float64 `json:"upstream_cost_multiplier,omitempty"`
}

CodexOAuthImportBody 批量导入 codex-oauth 请求体(items 1-100 原始条数——空/超限 → 400;template_id 必填——缺失 → 400 / 不存在 → 404;**credential_type 必须 == codex-oauth——错配 → 400 整批拒绝**;group_id 可选——不存在 → 行级 failed)

type CodexOAuthImportItem

type CodexOAuthImportItem struct {
	// CodexAccountId 组合幂等键②:上游账号/空间标识(必填)
	CodexAccountId string `json:"codex_account_id"`

	// CodexEmail 组合幂等键①:codex 账号登录邮箱(必填;格式非法 → 行级 failed)
	CodexEmail string `json:"codex_email"`

	// CodexOauthExpiresAt 凭据:oauth 访问令牌过期时间(可选;RFC3339 格式——解析失败 → 行级 failed)
	CodexOauthExpiresAt *string `json:"codex_oauth_expires_at,omitempty"`

	// CodexOauthRefreshToken 凭据:oauth 刷新令牌(必填;与 token 成对)
	CodexOauthRefreshToken string `json:"codex_oauth_refresh_token"`

	// CodexOauthToken 凭据:oauth 访问令牌(必填;与 refresh 成对)
	CodexOauthToken string `json:"codex_oauth_token"`

	// MaxConcurrency 可选;缺省 25(导入面裁决——非账号表默认 8);<1 → 归 25
	MaxConcurrency *int `json:"max_concurrency,omitempty"`
}

CodexOAuthImportItem 批量导入 codex-oauth 单行(组合幂等键 codex_email + codex_account_id;token+refresh 成对必填)

type CodexPATImportBody

type CodexPATImportBody struct {
	// CacheDomain 可选:新建账号的共享缓存域(缺省/空串 = 账号私有域;非空须为合法小写域名 ≤253——非法 → 400 整批拒绝)
	CacheDomain *string `json:"cache_domain,omitempty"`

	// Enabled 可选:新建账号的管理面启停(缺省 true = 启用;仅新建行生效)
	Enabled *bool `json:"enabled,omitempty"`

	// GroupId 可选:新建账号归组(不存在 → 行级 failed)
	GroupId *int64               `json:"group_id"`
	Items   []CodexPATImportItem `json:"items"`

	// SupplierUserId 保留:供应商面出现 ⇒ 400(归属恒为 JWT 本人;导入不分配归属)
	SupplierUserId *int64 `json:"supplier_user_id"`

	// TemplateId 必填:codex 账号归属模板(credential_type 必须 == 端点类型 codex-pat)
	TemplateId int64 `json:"template_id"`

	// UpstreamCostMultiplier 可选:新建账号的采购成本倍率(缺省 ×1;0–10,0 = 免费;越界 → 400 整批拒绝)
	UpstreamCostMultiplier *float64 `json:"upstream_cost_multiplier,omitempty"`
}

CodexPATImportBody 批量导入 codex-pat 请求体(items 1-100 原始条数——空/超限 → 400;template_id 必填——缺失 → 400 / 不存在 → 404;**credential_type 必须 == codex-pat——错配 → 400 整批拒绝**;group_id 可选——不存在 → 行级 failed)

type CodexPATImportItem

type CodexPATImportItem struct {
	// CodexAccountId 组合幂等键②:上游账号/空间标识(必填)
	CodexAccountId string `json:"codex_account_id"`

	// CodexEmail 组合幂等键①:codex 账号登录邮箱(必填;格式非法 → 行级 failed)
	CodexEmail string `json:"codex_email"`

	// CodexPatKey 凭据:pat(必填非空)
	CodexPatKey string `json:"codex_pat_key"`

	// MaxConcurrency 可选;缺省 25(导入面裁决);<1 → 归 25
	MaxConcurrency *int `json:"max_concurrency,omitempty"`
}

CodexPATImportItem 批量导入 codex-pat 单行(组合幂等键同上)

type CodexRateLimit

type CodexRateLimit struct {
	ResetAt     *time.Time `json:"reset_at"`
	UsedPercent int        `json:"used_percent"`
}

CodexRateLimit 主窗口用量(reset_at RFC3339——上游主窗口省略时 null,非虚假 0001-01-01)

type CodexSpendControl

type CodexSpendControl struct {
	Limit            string `json:"limit"`
	Remaining        string `json:"remaining"`
	RemainingPercent int    `json:"remaining_percent"`
	Used             string `json:"used"`
	UsedPercent      int    `json:"used_percent"`
}

CodexSpendControl 消费控制额度(金额字符串)

type CodexUsageProber

type CodexUsageProber interface {
	GetUsageSnapshot(ctx context.Context, cred *domain.AccountCredential) (*domain.CodexUsageSnapshot, error)
}

CodexUsageProber codex 额度快照数据源(*sdkbridge.Codex 满足——组合根经 OpsOptions.UsageSnap 构造注入;接口化供测试注入)。

type CodexUsageSnapshot

type CodexUsageSnapshot struct {
	// Credits 充值余额(金额字符串,如 "12.50";上游空串 → null,非空串占位)
	Credits  *CodexCredits `json:"credits,omitempty"`
	PlanType *string       `json:"plan_type,omitempty"`

	// RateLimit 主窗口用量(reset_at RFC3339——上游主窗口省略时 null,非虚假 0001-01-01)
	RateLimit *CodexRateLimit `json:"rate_limit,omitempty"`

	// SpendControl 消费控制额度(金额字符串)
	SpendControl *CodexSpendControl `json:"spend_control,omitempty"`
}

CodexUsageSnapshot 账号 codex 额度快照(sdkbridge;每块可选——上游没返回就不出字段;金额为字符串不解析保精度)

type CreateRuleJSONRequestBody

type CreateRuleJSONRequestBody = RuleCreate

CreateRuleJSONRequestBody defines body for CreateRule for application/json ContentType.

type DeactivateRequest

type DeactivateRequest = map[string]interface{}

DeactivateRequest 单码失效无请求体(保留空 schema 对齐批量端点命名)

type DeactivateResponse

type DeactivateResponse struct {
	Deactivated bool `json:"deactivated"`
}

DeactivateResponse defines model for DeactivateResponse.

type DeletePriceEntryParams

type DeletePriceEntryParams struct {
	Model string `form:"model" json:"model"`
}

DeletePriceEntryParams defines parameters for DeletePriceEntry.

type DeletePriceVariantsParams

type DeletePriceVariantsParams struct {
	Model string `form:"model" json:"model"`
}

DeletePriceVariantsParams defines parameters for DeletePriceVariants.

type DeletedResponse

type DeletedResponse struct {
	Deleted bool `json:"deleted"`
}

DeletedResponse defines model for DeletedResponse.

type ErrLog

type ErrLog struct {
	AccountID *int64 `json:"AccountID,omitempty"`

	// BillingTier 计费档位(service_tier 归一化:priority/flex/fast/auto);null = 未计费路径
	BillingTier *string `json:"BillingTier"`

	// ClientIP 客户端 IP(CF-Connecting-IP / True-Client-IP / X-Real-IP 按序识别;无则 RemoteAddr 剥端口);空 = 无
	ClientIP  *string    `json:"ClientIP,omitempty"`
	CreatedAt *time.Time `json:"CreatedAt,omitempty"`

	// ErrorMessage 错误文本(拒绝文案/上游 body,域内截断 500 字符);null = 无错误文本
	ErrorMessage *string        `json:"ErrorMessage"`
	ErrorType    *ErrorType     `json:"ErrorType,omitempty"`
	Format       *RequestFormat `json:"Format,omitempty"`
	GroupID      *int64         `json:"GroupID,omitempty"`
	ID           *int64         `json:"ID,omitempty"`

	// KeyID 鉴权归属 key;0 = 无
	KeyID     *int64  `json:"KeyID,omitempty"`
	LatencyMS *int64  `json:"LatencyMS,omitempty"`
	Model     *string `json:"Model,omitempty"`
	RequestID *string `json:"RequestID,omitempty"`

	// StatusCode 错误状态码(完整错误面;0 = 连接级)
	StatusCode *int   `json:"StatusCode,omitempty"`
	TemplateID *int64 `json:"TemplateID,omitempty"`

	// UserID 鉴权归属用户;0 = 无
	UserID *int64 `json:"UserID,omitempty"`
}

ErrLog 错误明细审计(err_logs 瘦表:拒绝 + 异常双轨;无 token/价格列)

type ErrLogsResponse

type ErrLogsResponse struct {
	// NextCursor 下一页游标(本页最后一条 id);null = 无更多行
	NextCursor *int64   `json:"next_cursor"`
	Rows       []ErrLog `json:"rows"`
}

ErrLogsResponse defines model for ErrLogsResponse.

type Error

type Error = ErrorResponse

Error defines model for Error.

type ErrorResponse

type ErrorResponse struct {
	// EffectiveFrom 判定后的生效窗口下界(`window_invalid`/`window_ambiguous` 不携带)
	EffectiveFrom *time.Time `json:"effective_from,omitempty"`

	// EffectiveTo 判定后的生效窗口上界(`window_invalid`/`window_ambiguous` 不携带)
	EffectiveTo *time.Time `json:"effective_to,omitempty"`
	Error       string     `json:"error"`

	// LimitSeconds 成本上限秒数(`window_too_long` 携带;0 = 无上限)
	LimitSeconds *int64 `json:"limit_seconds,omitempty"`

	// Reason 统计窗口被拒的机读原因(仅统计端点可能携带)。取值词表取自规划层原因与
	// 拒绝原因的**全量映射表**(唯一来源),本版实际会发出的有五个:
	// raw_horizon/cube_horizon = 起点早于所要读表的保留截止;
	// window_too_long = 请求跨度超过该形状的成本上限;window_invalid =
	// 必填/倒序/`window` 时长串不可解析等参数本身非法;window_ambiguous =
	// `from`/`to`/`window` 三者的"恰择一"未被满足(两态都给、只给一端、
	// 或两态都不给)。offset/dst/span_below_grid 是"该窗口无法用卷积表精确
	// 表达、已降级到原始行"的派生原因(只用于降级告警日志,不作为拒绝原因
	// 发出)。
	Reason *ErrorResponseReason `json:"reason,omitempty"`

	// RetentionDays 覆盖判定所依据的最保守保留天数(`*_horizon` 携带)
	RetentionDays *int `json:"retention_days,omitempty"`

	// Storage 判定所依据的实际存储(`window_invalid`/`window_ambiguous` 不携带)
	Storage *ErrorResponseStorage `json:"storage,omitempty"`
}

ErrorResponse defines model for ErrorResponse.

type ErrorResponseReason

type ErrorResponseReason string

ErrorResponseReason 统计窗口被拒的机读原因(仅统计端点可能携带)。取值词表取自规划层原因与 拒绝原因的**全量映射表**(唯一来源),本版实际会发出的有五个: raw_horizon/cube_horizon = 起点早于所要读表的保留截止; window_too_long = 请求跨度超过该形状的成本上限;window_invalid = 必填/倒序/`window` 时长串不可解析等参数本身非法;window_ambiguous = `from`/`to`/`window` 三者的"恰择一"未被满足(两态都给、只给一端、 或两态都不给)。offset/dst/span_below_grid 是"该窗口无法用卷积表精确 表达、已降级到原始行"的派生原因(只用于降级告警日志,不作为拒绝原因 发出)。

const (
	CubeHorizon     ErrorResponseReason = "cube_horizon"
	Dst             ErrorResponseReason = "dst"
	Offset          ErrorResponseReason = "offset"
	RawHorizon      ErrorResponseReason = "raw_horizon"
	SpanBelowGrid   ErrorResponseReason = "span_below_grid"
	WindowAmbiguous ErrorResponseReason = "window_ambiguous"
	WindowInvalid   ErrorResponseReason = "window_invalid"
	WindowTooLong   ErrorResponseReason = "window_too_long"
)

Defines values for ErrorResponseReason.

type ErrorResponseStorage

type ErrorResponseStorage string

ErrorResponseStorage 判定所依据的实际存储(`window_invalid`/`window_ambiguous` 不携带)

const (
	ErrorResponseStorageCube ErrorResponseStorage = "cube"
	ErrorResponseStorageRaw  ErrorResponseStorage = "raw"
)

Defines values for ErrorResponseStorage.

type ErrorType

type ErrorType string

ErrorType defines model for ErrorType.

const (
	Abort     ErrorType = "abort"
	Auth      ErrorType = "auth"
	Billing   ErrorType = "billing"
	N429      ErrorType = "429"
	N4xx      ErrorType = "4xx"
	N5xx      ErrorType = "5xx"
	Network   ErrorType = "network"
	NoAccount ErrorType = "no_account"
	None      ErrorType = "none"
)

Defines values for ErrorType.

type GenerateRequest

type GenerateRequest struct {
	// Count 生成个数 1-1000(缺省 1)
	Count *int `json:"count,omitempty"`

	// ExpiresAt 码未兑换即过期;缺省 = 永久
	ExpiresAt *time.Time `json:"expires_at,omitempty"`

	// MaxUses 1 = 单次码(缺省);>1 = 多人码
	MaxUses *int    `json:"max_uses,omitempty"`
	Remark  *string `json:"remark,omitempty"`

	// ResourceExpiresAt 兑换后资源到期;temp_balance 必填(决策 4)
	ResourceExpiresAt *time.Time     `json:"resource_expires_at,omitempty"`
	Type              RedemptionType `json:"type"`

	// Value 面值:balance/temp_balance = USD;concurrency = 并发数(整数)。> 0
	Value float64 `json:"value"`
}

GenerateRequest defines model for GenerateRequest.

type GenerateResponse

type GenerateResponse struct {
	Codes []RedemptionCode `json:"codes"`
}

GenerateResponse defines model for GenerateResponse.

type GetAccountsParams

type GetAccountsParams struct {
	// Limit 每页条数(上限 200,超限裁剪到 200)
	Limit      *ListLimit              `form:"limit,omitempty" json:"limit,omitempty"`
	Offset     *ListOffset             `form:"offset,omitempty" json:"offset,omitempty"`
	Name       *ListName               `form:"name,omitempty" json:"name,omitempty"`
	Sort       *ListSort               `form:"sort,omitempty" json:"sort,omitempty"`
	Order      *GetAccountsParamsOrder `form:"order,omitempty" json:"order,omitempty"`
	TemplateId *AccountTemplateId      `form:"template_id,omitempty" json:"template_id,omitempty"`

	// Enabled 管理面启停过滤:true = 仅启用,false = 仅禁用;缺省 = 不过滤(与运行时失效 failed_at 无关)
	Enabled *AccountEnabled `form:"enabled,omitempty" json:"enabled,omitempty"`
}

GetAccountsParams defines parameters for GetAccounts.

type GetAccountsParamsOrder

type GetAccountsParamsOrder string

GetAccountsParamsOrder defines parameters for GetAccounts.

const (
	GetAccountsParamsOrderAsc  GetAccountsParamsOrder = "asc"
	GetAccountsParamsOrderDesc GetAccountsParamsOrder = "desc"
)

Defines values for GetAccountsParamsOrder.

type GetAccountsUsageParams

type GetAccountsUsageParams struct {
	AccountIds string `form:"account_ids" json:"account_ids"`

	// From 绝对窗口下界(含,RFC3339)。窗口两形态**恰择一**(from+to,或 window 单独):与 window 同给 / 只给一端 / 都不给 → 400 `reason=window_ambiguous`。给出 from/to 时不做时区改写;服务端按判定把两端向后取整到整点(生效窗口见响应头 X-Stats-Effective-From/To)
	From *StatsFrom `form:"from,omitempty" json:"from,omitempty"`

	// To 绝对窗口上界(不含,RFC3339)。与 from 同生共死:只给一端 → 400 `reason=window_ambiguous`;from 不早于 to → 400 `reason=window_invalid`
	To *StatsTo `form:"to,omitempty" json:"to,omitempty"`

	// Window 相对窗口(时长串,Go `time.ParseDuration` 形态,如 `24h`/`168h`/`2160h`)。
	// 给出它时**必须**省略 `from`/`to`(同时给出 → 400 `reason=window_ambiguous`)。
	// 服务端自持时钟:`to` = 当前时刻向上取整到 UTC 整点、`from` = `to` − `window`
	// ⇒ 两端恒整点,命中卷积表的精确分支(零对齐位移、零桶丢失),这就是 UI 预设
	// 走这条形态的理由。
	//
	// **只收时长,不收日历天**:`d` 不是 `time.ParseDuration` 的单位,`7d` → 400
	// (`reason=window_invalid`)。理由:`24h` 与"一个日历天"在 DST 切换日不相等,
	// 而本 API 的唯一对齐基准是固定 1h 网格;另立 `AddDate` 日历语义会引入第二套
	// 窗口长度语义。预设即网格整倍数:24h / 168h / 720h / 2160h。
	Window *StatsWindow `form:"window,omitempty" json:"window,omitempty"`

	// Timezone IANA 时区名(如 Asia/Shanghai / America/New_York;控制台取浏览器时区)。
	// 仅影响**分组读**:时间桶按该时区的本地小时/日界聚合。显式 from/to 恒为
	// 绝对时刻直透,不受时区改写;排行/TTFT 等无分组数值端点接受并校验该参数
	// 但不改变数值。空/缺省 = UTC(兼容旧客户端);未知名 → 400。overview 的
	// 「今日」日界仍按该时区本地零点计算(窗口是 days,不是 from/to)。
	//
	// 窗口上限**不是一个固定天数**:界不齐时服务端把两端向后取整到整点以换取
	// 卷积表快路径(生效窗口用 X-Stats-Effective-From/To 回显),能否用卷积表
	// 取决于**时区偏移是否恒整点且窗内无 DST 跳变**;DST 或 :30/:45 偏移时区的
	// 分组读只能扫原始明细行。成本上限是保留期无关的纯常量(分组原始行固定
	// 8 天、卷积表 90 天),覆盖上限另有 per-table 保留期闸门(起点早于保留
	// 截止 → 400)。两者的**真实数值见 GET /api/admin/stats/capabilities**。
	Timezone *StatsTimezone `form:"timezone,omitempty" json:"timezone,omitempty"`
}

GetAccountsUsageParams defines parameters for GetAccountsUsage.

type GetAdminOverviewParams

type GetAdminOverviewParams struct {
	Days    *int   `form:"days,omitempty" json:"days,omitempty"`
	GroupId *int64 `form:"group_id,omitempty" json:"group_id,omitempty"`

	// Timezone IANA 时区名(如 Asia/Shanghai / America/New_York;控制台取浏览器时区)。
	// 仅影响**分组读**:时间桶按该时区的本地小时/日界聚合。显式 from/to 恒为
	// 绝对时刻直透,不受时区改写;排行/TTFT 等无分组数值端点接受并校验该参数
	// 但不改变数值。空/缺省 = UTC(兼容旧客户端);未知名 → 400。overview 的
	// 「今日」日界仍按该时区本地零点计算(窗口是 days,不是 from/to)。
	//
	// 窗口上限**不是一个固定天数**:界不齐时服务端把两端向后取整到整点以换取
	// 卷积表快路径(生效窗口用 X-Stats-Effective-From/To 回显),能否用卷积表
	// 取决于**时区偏移是否恒整点且窗内无 DST 跳变**;DST 或 :30/:45 偏移时区的
	// 分组读只能扫原始明细行。成本上限是保留期无关的纯常量(分组原始行固定
	// 8 天、卷积表 90 天),覆盖上限另有 per-table 保留期闸门(起点早于保留
	// 截止 → 400)。两者的**真实数值见 GET /api/admin/stats/capabilities**。
	Timezone *StatsTimezone `form:"timezone,omitempty" json:"timezone,omitempty"`
}

GetAdminOverviewParams defines parameters for GetAdminOverview.

type GetAdminSupplierBalancesParams

type GetAdminSupplierBalancesParams struct {
	Limit  *int `form:"limit,omitempty" json:"limit,omitempty"`
	Offset *int `form:"offset,omitempty" json:"offset,omitempty"`
}

GetAdminSupplierBalancesParams defines parameters for GetAdminSupplierBalances.

type GetAdminSupplierSettlementsParams

type GetAdminSupplierSettlementsParams struct {
	Status *GetAdminSupplierSettlementsParamsStatus `form:"status,omitempty" json:"status,omitempty"`
	Kind   *GetAdminSupplierSettlementsParamsKind   `form:"kind,omitempty" json:"kind,omitempty"`
	Limit  *int                                     `form:"limit,omitempty" json:"limit,omitempty"`
	Offset *int                                     `form:"offset,omitempty" json:"offset,omitempty"`
}

GetAdminSupplierSettlementsParams defines parameters for GetAdminSupplierSettlements.

type GetAdminSupplierSettlementsParamsKind

type GetAdminSupplierSettlementsParamsKind string

GetAdminSupplierSettlementsParamsKind defines parameters for GetAdminSupplierSettlements.

const (
	GetAdminSupplierSettlementsParamsKindAdminRequest    GetAdminSupplierSettlementsParamsKind = "admin_request"
	GetAdminSupplierSettlementsParamsKindSupplierRequest GetAdminSupplierSettlementsParamsKind = "supplier_request"
)

Defines values for GetAdminSupplierSettlementsParamsKind.

type GetAdminSupplierSettlementsParamsStatus

type GetAdminSupplierSettlementsParamsStatus string

GetAdminSupplierSettlementsParamsStatus defines parameters for GetAdminSupplierSettlements.

const (
	GetAdminSupplierSettlementsParamsStatusApproved GetAdminSupplierSettlementsParamsStatus = "approved"
	GetAdminSupplierSettlementsParamsStatusPaid     GetAdminSupplierSettlementsParamsStatus = "paid"
	GetAdminSupplierSettlementsParamsStatusPaying   GetAdminSupplierSettlementsParamsStatus = "paying"
	GetAdminSupplierSettlementsParamsStatusPending  GetAdminSupplierSettlementsParamsStatus = "pending"
	GetAdminSupplierSettlementsParamsStatusRejected GetAdminSupplierSettlementsParamsStatus = "rejected"
)

Defines values for GetAdminSupplierSettlementsParamsStatus.

type GetAdminUsersTopParams

type GetAdminUsersTopParams struct {
	Top *int `form:"top,omitempty" json:"top,omitempty"`
}

GetAdminUsersTopParams defines parameters for GetAdminUsersTop.

type GetErrLogsParams

type GetErrLogsParams struct {
	Limit      *int           `form:"limit,omitempty" json:"limit,omitempty"`
	Cursor     *int64         `form:"cursor,omitempty" json:"cursor,omitempty"`
	GroupId    *int64         `form:"group_id,omitempty" json:"group_id,omitempty"`
	AccountId  *int64         `form:"account_id,omitempty" json:"account_id,omitempty"`
	UserId     *int64         `form:"user_id,omitempty" json:"user_id,omitempty"`
	KeyId      *int64         `form:"key_id,omitempty" json:"key_id,omitempty"`
	Model      *string        `form:"model,omitempty" json:"model,omitempty"`
	Format     *RequestFormat `form:"format,omitempty" json:"format,omitempty"`
	StatusCode *int           `form:"status_code,omitempty" json:"status_code,omitempty"`
	ErrorType  *string        `form:"error_type,omitempty" json:"error_type,omitempty"`
	From       time.Time      `form:"from" json:"from"`
	To         time.Time      `form:"to" json:"to"`
}

GetErrLogsParams defines parameters for GetErrLogs.

type GetGroupsParams

type GetGroupsParams struct {
	// Limit 每页条数(上限 200,超限裁剪到 200)
	Limit  *ListLimit            `form:"limit,omitempty" json:"limit,omitempty"`
	Offset *ListOffset           `form:"offset,omitempty" json:"offset,omitempty"`
	Name   *ListName             `form:"name,omitempty" json:"name,omitempty"`
	Sort   *ListSort             `form:"sort,omitempty" json:"sort,omitempty"`
	Order  *GetGroupsParamsOrder `form:"order,omitempty" json:"order,omitempty"`
}

GetGroupsParams defines parameters for GetGroups.

type GetGroupsParamsOrder

type GetGroupsParamsOrder string

GetGroupsParamsOrder defines parameters for GetGroups.

const (
	GetGroupsParamsOrderAsc  GetGroupsParamsOrder = "asc"
	GetGroupsParamsOrderDesc GetGroupsParamsOrder = "desc"
)

Defines values for GetGroupsParamsOrder.

type GetKeysParams

type GetKeysParams struct {
	Name    *string             `form:"name,omitempty" json:"name,omitempty"`
	UserId  *int64              `form:"user_id,omitempty" json:"user_id,omitempty"`
	GroupId *int64              `form:"group_id,omitempty" json:"group_id,omitempty"`
	Limit   *int                `form:"limit,omitempty" json:"limit,omitempty"`
	Offset  *int                `form:"offset,omitempty" json:"offset,omitempty"`
	Sort    *string             `form:"sort,omitempty" json:"sort,omitempty"`
	Order   *GetKeysParamsOrder `form:"order,omitempty" json:"order,omitempty"`
}

GetKeysParams defines parameters for GetKeys.

type GetKeysParamsOrder

type GetKeysParamsOrder string

GetKeysParamsOrder defines parameters for GetKeys.

const (
	GetKeysParamsOrderAsc  GetKeysParamsOrder = "asc"
	GetKeysParamsOrderDesc GetKeysParamsOrder = "desc"
)

Defines values for GetKeysParamsOrder.

type GetPriceEntryParams

type GetPriceEntryParams struct {
	Model string `form:"model" json:"model"`
}

GetPriceEntryParams defines parameters for GetPriceEntry.

type GetPriceVariantsParams

type GetPriceVariantsParams struct {
	Model string `form:"model" json:"model"`
}

GetPriceVariantsParams defines parameters for GetPriceVariants.

type GetPricesParams

type GetPricesParams struct {
	Page     *int                   `form:"page,omitempty" json:"page,omitempty"`
	PageSize *int                   `form:"page_size,omitempty" json:"page_size,omitempty"`
	Mode     *GetPricesParamsMode   `form:"mode,omitempty" json:"mode,omitempty"`
	Source   *GetPricesParamsSource `form:"source,omitempty" json:"source,omitempty"`
	Provider *string                `form:"provider,omitempty" json:"provider,omitempty"`
	Model    *string                `form:"model,omitempty" json:"model,omitempty"`
	Sort     *string                `form:"sort,omitempty" json:"sort,omitempty"`
	Order    *GetPricesParamsOrder  `form:"order,omitempty" json:"order,omitempty"`
}

GetPricesParams defines parameters for GetPrices.

type GetPricesParamsMode

type GetPricesParamsMode string

GetPricesParamsMode defines parameters for GetPrices.

const (
	GetPricesParamsModeCall  GetPricesParamsMode = "call"
	GetPricesParamsModeImage GetPricesParamsMode = "image"
	GetPricesParamsModeToken GetPricesParamsMode = "token"
)

Defines values for GetPricesParamsMode.

type GetPricesParamsOrder

type GetPricesParamsOrder string

GetPricesParamsOrder defines parameters for GetPrices.

const (
	GetPricesParamsOrderAsc  GetPricesParamsOrder = "asc"
	GetPricesParamsOrderDesc GetPricesParamsOrder = "desc"
)

Defines values for GetPricesParamsOrder.

type GetPricesParamsSource

type GetPricesParamsSource string

GetPricesParamsSource defines parameters for GetPrices.

const (
	GetPricesParamsSourceLitellm GetPricesParamsSource = "litellm"
	GetPricesParamsSourceManual  GetPricesParamsSource = "manual"
)

Defines values for GetPricesParamsSource.

type GetRedemptionCodesIdUsesParams

type GetRedemptionCodesIdUsesParams struct {
	Limit  *int `form:"limit,omitempty" json:"limit,omitempty"`
	Offset *int `form:"offset,omitempty" json:"offset,omitempty"`
}

GetRedemptionCodesIdUsesParams defines parameters for GetRedemptionCodesIdUses.

type GetRedemptionCodesParams

type GetRedemptionCodesParams struct {
	Page     *int                            `form:"page,omitempty" json:"page,omitempty"`
	PageSize *int                            `form:"page_size,omitempty" json:"page_size,omitempty"`
	Type     *GetRedemptionCodesParamsType   `form:"type,omitempty" json:"type,omitempty"`
	Status   *GetRedemptionCodesParamsStatus `form:"status,omitempty" json:"status,omitempty"`
	Sort     *string                         `form:"sort,omitempty" json:"sort,omitempty"`
	Order    *GetRedemptionCodesParamsOrder  `form:"order,omitempty" json:"order,omitempty"`
}

GetRedemptionCodesParams defines parameters for GetRedemptionCodes.

type GetRedemptionCodesParamsOrder

type GetRedemptionCodesParamsOrder string

GetRedemptionCodesParamsOrder defines parameters for GetRedemptionCodes.

const (
	GetRedemptionCodesParamsOrderAsc  GetRedemptionCodesParamsOrder = "asc"
	GetRedemptionCodesParamsOrderDesc GetRedemptionCodesParamsOrder = "desc"
)

Defines values for GetRedemptionCodesParamsOrder.

type GetRedemptionCodesParamsStatus

type GetRedemptionCodesParamsStatus string

GetRedemptionCodesParamsStatus defines parameters for GetRedemptionCodes.

const (
	GetRedemptionCodesParamsStatusActive   GetRedemptionCodesParamsStatus = "active"
	GetRedemptionCodesParamsStatusDisabled GetRedemptionCodesParamsStatus = "disabled"
)

Defines values for GetRedemptionCodesParamsStatus.

type GetRedemptionCodesParamsType

type GetRedemptionCodesParamsType string

GetRedemptionCodesParamsType defines parameters for GetRedemptionCodes.

const (
	GetRedemptionCodesParamsTypeBalance     GetRedemptionCodesParamsType = "balance"
	GetRedemptionCodesParamsTypeConcurrency GetRedemptionCodesParamsType = "concurrency"
	GetRedemptionCodesParamsTypeTempBalance GetRedemptionCodesParamsType = "temp_balance"
)

Defines values for GetRedemptionCodesParamsType.

type GetRoutingFlowParams

type GetRoutingFlowParams struct {
	Route    string    `form:"route" json:"route"`
	From     time.Time `form:"from" json:"from"`
	To       time.Time `form:"to" json:"to"`
	Offset   *int      `form:"offset,omitempty" json:"offset,omitempty"`
	Limit    *int      `form:"limit,omitempty" json:"limit,omitempty"`
	Accounts *int      `form:"accounts,omitempty" json:"accounts,omitempty"`
}

GetRoutingFlowParams defines parameters for GetRoutingFlow.

type GetRoutingFrontierParams

type GetRoutingFrontierParams struct {
	Route  string    `form:"route" json:"route"`
	From   time.Time `form:"from" json:"from"`
	To     time.Time `form:"to" json:"to"`
	Offset *int      `form:"offset,omitempty" json:"offset,omitempty"`
	Limit  *int      `form:"limit,omitempty" json:"limit,omitempty"`
}

GetRoutingFrontierParams defines parameters for GetRoutingFrontier.

type GetRoutingPlanParams

type GetRoutingPlanParams struct {
	Search           *string    `form:"search,omitempty" json:"search,omitempty"`
	Route            *string    `form:"route,omitempty" json:"route,omitempty"`
	ObservedFrom     *time.Time `form:"observed_from,omitempty" json:"observed_from,omitempty"`
	ObservedTo       *time.Time `form:"observed_to,omitempty" json:"observed_to,omitempty"`
	Offset           *int       `form:"offset,omitempty" json:"offset,omitempty"`
	Limit            *int       `form:"limit,omitempty" json:"limit,omitempty"`
	CandidatesOffset *int       `form:"candidates_offset,omitempty" json:"candidates_offset,omitempty"`
	CandidatesLimit  *int       `form:"candidates_limit,omitempty" json:"candidates_limit,omitempty"`
}

GetRoutingPlanParams defines parameters for GetRoutingPlan.

type GetStatsEntityTrendParams

type GetStatsEntityTrendParams struct {
	Entity GetStatsEntityTrendParamsEntity `form:"entity" json:"entity"`
	Id     int64                           `form:"id" json:"id"`
	From   *time.Time                      `form:"from,omitempty" json:"from,omitempty"`
	To     *time.Time                      `form:"to,omitempty" json:"to,omitempty"`

	// Window 相对窗口(时长串,Go `time.ParseDuration` 形态,如 `24h`/`168h`/`2160h`)。
	// 给出它时**必须**省略 `from`/`to`(同时给出 → 400 `reason=window_ambiguous`)。
	// 服务端自持时钟:`to` = 当前时刻向上取整到 UTC 整点、`from` = `to` − `window`
	// ⇒ 两端恒整点,命中卷积表的精确分支(零对齐位移、零桶丢失),这就是 UI 预设
	// 走这条形态的理由。
	//
	// **只收时长,不收日历天**:`d` 不是 `time.ParseDuration` 的单位,`7d` → 400
	// (`reason=window_invalid`)。理由:`24h` 与"一个日历天"在 DST 切换日不相等,
	// 而本 API 的唯一对齐基准是固定 1h 网格;另立 `AddDate` 日历语义会引入第二套
	// 窗口长度语义。预设即网格整倍数:24h / 168h / 720h / 2160h。
	Window      *StatsWindow                         `form:"window,omitempty" json:"window,omitempty"`
	Granularity GetStatsEntityTrendParamsGranularity `form:"granularity" json:"granularity"`
	Model       *string                              `form:"model,omitempty" json:"model,omitempty"`

	// Timezone IANA 时区名(如 Asia/Shanghai / America/New_York;控制台取浏览器时区)。
	// 仅影响**分组读**:时间桶按该时区的本地小时/日界聚合。显式 from/to 恒为
	// 绝对时刻直透,不受时区改写;排行/TTFT 等无分组数值端点接受并校验该参数
	// 但不改变数值。空/缺省 = UTC(兼容旧客户端);未知名 → 400。overview 的
	// 「今日」日界仍按该时区本地零点计算(窗口是 days,不是 from/to)。
	//
	// 窗口上限**不是一个固定天数**:界不齐时服务端把两端向后取整到整点以换取
	// 卷积表快路径(生效窗口用 X-Stats-Effective-From/To 回显),能否用卷积表
	// 取决于**时区偏移是否恒整点且窗内无 DST 跳变**;DST 或 :30/:45 偏移时区的
	// 分组读只能扫原始明细行。成本上限是保留期无关的纯常量(分组原始行固定
	// 8 天、卷积表 90 天),覆盖上限另有 per-table 保留期闸门(起点早于保留
	// 截止 → 400)。两者的**真实数值见 GET /api/admin/stats/capabilities**。
	Timezone *StatsTimezone `form:"timezone,omitempty" json:"timezone,omitempty"`
}

GetStatsEntityTrendParams defines parameters for GetStatsEntityTrend.

type GetStatsEntityTrendParamsEntity

type GetStatsEntityTrendParamsEntity string

GetStatsEntityTrendParamsEntity defines parameters for GetStatsEntityTrend.

const (
	GetStatsEntityTrendParamsEntityAccount GetStatsEntityTrendParamsEntity = "account"
	GetStatsEntityTrendParamsEntityKey     GetStatsEntityTrendParamsEntity = "key"
	GetStatsEntityTrendParamsEntityUser    GetStatsEntityTrendParamsEntity = "user"
)

Defines values for GetStatsEntityTrendParamsEntity.

type GetStatsEntityTrendParamsGranularity

type GetStatsEntityTrendParamsGranularity string

GetStatsEntityTrendParamsGranularity defines parameters for GetStatsEntityTrend.

const (
	GetStatsEntityTrendParamsGranularityDay  GetStatsEntityTrendParamsGranularity = "day"
	GetStatsEntityTrendParamsGranularityHour GetStatsEntityTrendParamsGranularity = "hour"
)

Defines values for GetStatsEntityTrendParamsGranularity.

type GetStatsTTFTParams

type GetStatsTTFTParams struct {
	From *time.Time `form:"from,omitempty" json:"from,omitempty"`
	To   *time.Time `form:"to,omitempty" json:"to,omitempty"`

	// Window 相对窗口(时长串,Go `time.ParseDuration` 形态,如 `24h`/`168h`/`2160h`)。
	// 给出它时**必须**省略 `from`/`to`(同时给出 → 400 `reason=window_ambiguous`)。
	// 服务端自持时钟:`to` = 当前时刻向上取整到 UTC 整点、`from` = `to` − `window`
	// ⇒ 两端恒整点,命中卷积表的精确分支(零对齐位移、零桶丢失),这就是 UI 预设
	// 走这条形态的理由。
	//
	// **只收时长,不收日历天**:`d` 不是 `time.ParseDuration` 的单位,`7d` → 400
	// (`reason=window_invalid`)。理由:`24h` 与"一个日历天"在 DST 切换日不相等,
	// 而本 API 的唯一对齐基准是固定 1h 网格;另立 `AddDate` 日历语义会引入第二套
	// 窗口长度语义。预设即网格整倍数:24h / 168h / 720h / 2160h。
	Window *StatsWindow              `form:"window,omitempty" json:"window,omitempty"`
	Entity *GetStatsTTFTParamsEntity `form:"entity,omitempty" json:"entity,omitempty"`
	Id     *int64                    `form:"id,omitempty" json:"id,omitempty"`
	Model  *string                   `form:"model,omitempty" json:"model,omitempty"`

	// Timezone IANA 时区名(如 Asia/Shanghai / America/New_York;控制台取浏览器时区)。
	// 仅影响**分组读**:时间桶按该时区的本地小时/日界聚合。显式 from/to 恒为
	// 绝对时刻直透,不受时区改写;排行/TTFT 等无分组数值端点接受并校验该参数
	// 但不改变数值。空/缺省 = UTC(兼容旧客户端);未知名 → 400。overview 的
	// 「今日」日界仍按该时区本地零点计算(窗口是 days,不是 from/to)。
	//
	// 窗口上限**不是一个固定天数**:界不齐时服务端把两端向后取整到整点以换取
	// 卷积表快路径(生效窗口用 X-Stats-Effective-From/To 回显),能否用卷积表
	// 取决于**时区偏移是否恒整点且窗内无 DST 跳变**;DST 或 :30/:45 偏移时区的
	// 分组读只能扫原始明细行。成本上限是保留期无关的纯常量(分组原始行固定
	// 8 天、卷积表 90 天),覆盖上限另有 per-table 保留期闸门(起点早于保留
	// 截止 → 400)。两者的**真实数值见 GET /api/admin/stats/capabilities**。
	Timezone *StatsTimezone `form:"timezone,omitempty" json:"timezone,omitempty"`
}

GetStatsTTFTParams defines parameters for GetStatsTTFT.

type GetStatsTTFTParamsEntity

type GetStatsTTFTParamsEntity string

GetStatsTTFTParamsEntity defines parameters for GetStatsTTFT.

const (
	GetStatsTTFTParamsEntityAccount GetStatsTTFTParamsEntity = "account"
	GetStatsTTFTParamsEntityKey     GetStatsTTFTParamsEntity = "key"
	GetStatsTTFTParamsEntityUser    GetStatsTTFTParamsEntity = "user"
)

Defines values for GetStatsTTFTParamsEntity.

type GetStatsTopParams

type GetStatsTopParams struct {
	From   time.Time               `form:"from" json:"from"`
	To     time.Time               `form:"to" json:"to"`
	Entity GetStatsTopParamsEntity `form:"entity" json:"entity"`
	By     GetStatsTopParamsBy     `form:"by" json:"by"`
	Limit  *int                    `form:"limit,omitempty" json:"limit,omitempty"`

	// Timezone IANA 时区名(如 Asia/Shanghai / America/New_York;控制台取浏览器时区)。
	// 仅影响**分组读**:时间桶按该时区的本地小时/日界聚合。显式 from/to 恒为
	// 绝对时刻直透,不受时区改写;排行/TTFT 等无分组数值端点接受并校验该参数
	// 但不改变数值。空/缺省 = UTC(兼容旧客户端);未知名 → 400。overview 的
	// 「今日」日界仍按该时区本地零点计算(窗口是 days,不是 from/to)。
	//
	// 窗口上限**不是一个固定天数**:界不齐时服务端把两端向后取整到整点以换取
	// 卷积表快路径(生效窗口用 X-Stats-Effective-From/To 回显),能否用卷积表
	// 取决于**时区偏移是否恒整点且窗内无 DST 跳变**;DST 或 :30/:45 偏移时区的
	// 分组读只能扫原始明细行。成本上限是保留期无关的纯常量(分组原始行固定
	// 8 天、卷积表 90 天),覆盖上限另有 per-table 保留期闸门(起点早于保留
	// 截止 → 400)。两者的**真实数值见 GET /api/admin/stats/capabilities**。
	Timezone *StatsTimezone `form:"timezone,omitempty" json:"timezone,omitempty"`
}

GetStatsTopParams defines parameters for GetStatsTop.

type GetStatsTopParamsBy

type GetStatsTopParamsBy string

GetStatsTopParamsBy defines parameters for GetStatsTop.

const (
	Cost     GetStatsTopParamsBy = "cost"
	Requests GetStatsTopParamsBy = "requests"
	Tokens   GetStatsTopParamsBy = "tokens"
)

Defines values for GetStatsTopParamsBy.

type GetStatsTopParamsEntity

type GetStatsTopParamsEntity string

GetStatsTopParamsEntity defines parameters for GetStatsTop.

const (
	GetStatsTopParamsEntityAccount GetStatsTopParamsEntity = "account"
	GetStatsTopParamsEntityKey     GetStatsTopParamsEntity = "key"
	GetStatsTopParamsEntityUser    GetStatsTopParamsEntity = "user"
)

Defines values for GetStatsTopParamsEntity.

type GetStatsTrendParams

type GetStatsTrendParams struct {
	From *time.Time `form:"from,omitempty" json:"from,omitempty"`
	To   *time.Time `form:"to,omitempty" json:"to,omitempty"`

	// Window 相对窗口(时长串,Go `time.ParseDuration` 形态,如 `24h`/`168h`/`2160h`)。
	// 给出它时**必须**省略 `from`/`to`(同时给出 → 400 `reason=window_ambiguous`)。
	// 服务端自持时钟:`to` = 当前时刻向上取整到 UTC 整点、`from` = `to` − `window`
	// ⇒ 两端恒整点,命中卷积表的精确分支(零对齐位移、零桶丢失),这就是 UI 预设
	// 走这条形态的理由。
	//
	// **只收时长,不收日历天**:`d` 不是 `time.ParseDuration` 的单位,`7d` → 400
	// (`reason=window_invalid`)。理由:`24h` 与"一个日历天"在 DST 切换日不相等,
	// 而本 API 的唯一对齐基准是固定 1h 网格;另立 `AddDate` 日历语义会引入第二套
	// 窗口长度语义。预设即网格整倍数:24h / 168h / 720h / 2160h。
	Window      *StatsWindow                    `form:"window,omitempty" json:"window,omitempty"`
	Granularity *GetStatsTrendParamsGranularity `form:"granularity,omitempty" json:"granularity,omitempty"`
	GroupId     *int64                          `form:"group_id,omitempty" json:"group_id,omitempty"`
	Model       *string                         `form:"model,omitempty" json:"model,omitempty"`

	// Timezone IANA 时区名(如 Asia/Shanghai / America/New_York;控制台取浏览器时区)。
	// 仅影响**分组读**:时间桶按该时区的本地小时/日界聚合。显式 from/to 恒为
	// 绝对时刻直透,不受时区改写;排行/TTFT 等无分组数值端点接受并校验该参数
	// 但不改变数值。空/缺省 = UTC(兼容旧客户端);未知名 → 400。overview 的
	// 「今日」日界仍按该时区本地零点计算(窗口是 days,不是 from/to)。
	//
	// 窗口上限**不是一个固定天数**:界不齐时服务端把两端向后取整到整点以换取
	// 卷积表快路径(生效窗口用 X-Stats-Effective-From/To 回显),能否用卷积表
	// 取决于**时区偏移是否恒整点且窗内无 DST 跳变**;DST 或 :30/:45 偏移时区的
	// 分组读只能扫原始明细行。成本上限是保留期无关的纯常量(分组原始行固定
	// 8 天、卷积表 90 天),覆盖上限另有 per-table 保留期闸门(起点早于保留
	// 截止 → 400)。两者的**真实数值见 GET /api/admin/stats/capabilities**。
	Timezone *StatsTimezone `form:"timezone,omitempty" json:"timezone,omitempty"`
}

GetStatsTrendParams defines parameters for GetStatsTrend.

type GetStatsTrendParamsGranularity

type GetStatsTrendParamsGranularity string

GetStatsTrendParamsGranularity defines parameters for GetStatsTrend.

const (
	GetStatsTrendParamsGranularityDay  GetStatsTrendParamsGranularity = "day"
	GetStatsTrendParamsGranularityHour GetStatsTrendParamsGranularity = "hour"
)

Defines values for GetStatsTrendParamsGranularity.

type GetTempBalancesParams

type GetTempBalancesParams struct {
	Page     *int                        `form:"page,omitempty" json:"page,omitempty"`
	PageSize *int                        `form:"page_size,omitempty" json:"page_size,omitempty"`
	UserId   *int64                      `form:"user_id,omitempty" json:"user_id,omitempty"`
	Sort     *string                     `form:"sort,omitempty" json:"sort,omitempty"`
	Order    *GetTempBalancesParamsOrder `form:"order,omitempty" json:"order,omitempty"`
}

GetTempBalancesParams defines parameters for GetTempBalances.

type GetTempBalancesParamsOrder

type GetTempBalancesParamsOrder string

GetTempBalancesParamsOrder defines parameters for GetTempBalances.

const (
	GetTempBalancesParamsOrderAsc  GetTempBalancesParamsOrder = "asc"
	GetTempBalancesParamsOrderDesc GetTempBalancesParamsOrder = "desc"
)

Defines values for GetTempBalancesParamsOrder.

type GetTemplatesParams

type GetTemplatesParams struct {
	// Limit 每页条数(上限 200,超限裁剪到 200)
	Limit  *ListLimit               `form:"limit,omitempty" json:"limit,omitempty"`
	Offset *ListOffset              `form:"offset,omitempty" json:"offset,omitempty"`
	Name   *ListName                `form:"name,omitempty" json:"name,omitempty"`
	Sort   *ListSort                `form:"sort,omitempty" json:"sort,omitempty"`
	Order  *GetTemplatesParamsOrder `form:"order,omitempty" json:"order,omitempty"`
}

GetTemplatesParams defines parameters for GetTemplates.

type GetTemplatesParamsOrder

type GetTemplatesParamsOrder string

GetTemplatesParamsOrder defines parameters for GetTemplates.

const (
	GetTemplatesParamsOrderAsc  GetTemplatesParamsOrder = "asc"
	GetTemplatesParamsOrderDesc GetTemplatesParamsOrder = "desc"
)

Defines values for GetTemplatesParamsOrder.

type GetUsageLogsParams

type GetUsageLogsParams struct {
	Limit     *int           `form:"limit,omitempty" json:"limit,omitempty"`
	Cursor    *int64         `form:"cursor,omitempty" json:"cursor,omitempty"`
	GroupId   *int64         `form:"group_id,omitempty" json:"group_id,omitempty"`
	AccountId *int64         `form:"account_id,omitempty" json:"account_id,omitempty"`
	UserId    *int64         `form:"user_id,omitempty" json:"user_id,omitempty"`
	KeyId     *int64         `form:"key_id,omitempty" json:"key_id,omitempty"`
	Model     *string        `form:"model,omitempty" json:"model,omitempty"`
	Format    *RequestFormat `form:"format,omitempty" json:"format,omitempty"`
	ErrorType *string        `form:"error_type,omitempty" json:"error_type,omitempty"`
	From      time.Time      `form:"from" json:"from"`
	To        time.Time      `form:"to" json:"to"`
}

GetUsageLogsParams defines parameters for GetUsageLogs.

type GetUsersIdBalanceLogsParams

type GetUsersIdBalanceLogsParams struct {
	Limit  *int `form:"limit,omitempty" json:"limit,omitempty"`
	Offset *int `form:"offset,omitempty" json:"offset,omitempty"`
}

GetUsersIdBalanceLogsParams defines parameters for GetUsersIdBalanceLogs.

type GetUsersParams

type GetUsersParams struct {
	Limit           *int                 `form:"limit,omitempty" json:"limit,omitempty"`
	Offset          *int                 `form:"offset,omitempty" json:"offset,omitempty"`
	Email           *string              `form:"email,omitempty" json:"email,omitempty"`
	Sort            *string              `form:"sort,omitempty" json:"sort,omitempty"`
	Order           *GetUsersParamsOrder `form:"order,omitempty" json:"order,omitempty"`
	Role            *GetUsersParamsRole  `form:"role,omitempty" json:"role,omitempty"`
	SupplierSurface *bool                `form:"supplier_surface,omitempty" json:"supplier_surface,omitempty"`
}

GetUsersParams defines parameters for GetUsers.

type GetUsersParamsOrder

type GetUsersParamsOrder string

GetUsersParamsOrder defines parameters for GetUsers.

const (
	Asc  GetUsersParamsOrder = "asc"
	Desc GetUsersParamsOrder = "desc"
)

Defines values for GetUsersParamsOrder.

type GetUsersParamsRole

type GetUsersParamsRole string

GetUsersParamsRole defines parameters for GetUsers.

const (
	GetUsersParamsRolePlatformAdmin GetUsersParamsRole = "platform_admin"
	GetUsersParamsRoleSupplier      GetUsersParamsRole = "supplier"
	GetUsersParamsRoleUser          GetUsersParamsRole = "user"
)

Defines values for GetUsersParamsRole.

type Group

type Group struct {
	CreatedAt *time.Time `json:"CreatedAt,omitempty"`

	// DeletedAt 软删除时间戳;null = 存活(列表/消费路径过滤已删;GET 单个可查已删项)
	DeletedAt *time.Time `json:"DeletedAt"`

	// Description 分组描述(空串 = 无描述)
	Description *string `json:"Description,omitempty"`
	ID          *int64  `json:"ID,omitempty"`
	Name        *string `json:"Name,omitempty"`

	// PriceMultiplier 价格倍率(正常值,1 = ×1,0 = 免费,上限 10 = ×10;API 边界与万分数换算——存储 15000 ↔ 显示 1.5)
	PriceMultiplier *float64 `json:"PriceMultiplier,omitempty"`

	// ProtocolConvert 协议转换方向集合(空数组 = off = 不转换;多方向按客户端格式命中)
	ProtocolConvert *[]GroupProtocolConvert `json:"ProtocolConvert,omitempty"`
	UpdatedAt       *time.Time              `json:"UpdatedAt,omitempty"`
	Visibility      *GroupVisibility        `json:"Visibility,omitempty"`
}

Group defines model for Group.

type GroupAssignmentsBody

type GroupAssignmentsBody struct {
	// Multipliers 可选:user_id → 该用户在该组的专属价格倍率(正常值,1 = ×1,0 = 免费,上限 10 = ×10;API 边界与万分数换算)。仅对 user_ids 中列出的用户生效;null = 清除为未设置(回退组倍率);未列出的用户沿用当前值
	Multipliers *map[string]*float64 `json:"multipliers,omitempty"`

	// UserIds 替换语义:完整授予列表(未列出即撤销;空数组 = 清空)
	UserIds []int64 `json:"user_ids"`
}

GroupAssignmentsBody defines model for GroupAssignmentsBody.

type GroupAssignmentsResponse

type GroupAssignmentsResponse struct {
	// Multipliers 该组当前各用户的专属价格倍率(正常值;null/缺省 = 未设置 → 用组倍率)
	Multipliers *map[string]*float64 `json:"multipliers,omitempty"`
	UserIds     []int64              `json:"user_ids"`
}

GroupAssignmentsResponse defines model for GroupAssignmentsResponse.

type GroupCreate

type GroupCreate struct {
	// Description 分组描述(可选)。POST:缺省/null = 空;PUT:缺省/null = 保持原值,显式空串 = 清空
	Description *string `json:"description"`
	Name        string  `json:"name"`

	// PriceMultiplier 价格倍率(正常值,1 = ×1,0 = 免费,上限 10 = ×10;API 边界与万分数换算——存储 15000 ↔ 显示 1.5)。缺省/null = 不设置(×1);显式 0 = 免费组;PUT 显式写(含 0)
	PriceMultiplier *float64 `json:"price_multiplier"`

	// ProtocolConvert 协议转换方向集合(多方向并存,按客户端格式命中——chat 请求走 chat_to_*、anthropic 请求走 mess_to_resp、resp 请求走 resp_to_mess)。空数组/缺省 = off = 不转换;同客户端格式多方向(chat_to_resp 与 chat_to_mess 并存)→ 400。PUT 语义:缺省(null/省略)= 保持原值;显式空数组 = 清空既有方向
	ProtocolConvert *[]GroupProtocolConvert `json:"protocol_convert,omitempty"`
	Visibility      *GroupVisibility        `json:"visibility,omitempty"`
}

GroupCreate defines model for GroupCreate.

type GroupListResponse

type GroupListResponse struct {
	Rows  []Group `json:"rows"`
	Total int64   `json:"total"`
}

GroupListResponse defines model for GroupListResponse.

type GroupPatch

type GroupPatch struct {
	Name       *string          `json:"name,omitempty"`
	Visibility *GroupVisibility `json:"visibility,omitempty"`
}

GroupPatch defines model for GroupPatch.

type GroupProtocolConvert

type GroupProtocolConvert string

GroupProtocolConvert 分组级协议转换方向(只补差,网关 internal/protoconv 消费):chat_to_resp = 客户端 chat → 模板 resp;mess_to_resp = anthropic messages → resp;resp_to_mess = resp → anthropic messages;chat_to_mess = chat → anthropic messages。off 不在枚举内——不转换 = 空数组(见 protocol_convert 字段说明)

const (
	ChatToMess GroupProtocolConvert = "chat_to_mess"
	ChatToResp GroupProtocolConvert = "chat_to_resp"
	MessToResp GroupProtocolConvert = "mess_to_resp"
	RespToMess GroupProtocolConvert = "resp_to_mess"
)

Defines values for GroupProtocolConvert.

type GroupVisibility

type GroupVisibility string

GroupVisibility defines model for GroupVisibility.

const (
	Private GroupVisibility = "private"
	Public  GroupVisibility = "public"
)

Defines values for GroupVisibility.

type ImportFailedItem

type ImportFailedItem struct {
	// Error 该行失败原因文案
	Error string `json:"error"`

	// Index items 原始下标
	Index int `json:"index"`
}

ImportFailedItem 行级失败条目(index = items 原始下标——行级定位契约)

type ImportResult

type ImportResult struct {
	Failed []ImportFailedItem `json:"failed"`

	// Imported 新建账号数
	Imported int `json:"imported"`

	// Updated 键存在更新凭据数
	Updated int `json:"updated"`
}

ImportResult 批量导入结果(单行失败不毁整批——整批不原子;有失败行也 200)

type InvalidParamFormatError

type InvalidParamFormatError struct {
	ParamName string
	Err       error
}

func (*InvalidParamFormatError) Error

func (e *InvalidParamFormatError) Error() string

func (*InvalidParamFormatError) Unwrap

func (e *InvalidParamFormatError) Unwrap() error

type KeyStatus

type KeyStatus string

KeyStatus defines model for KeyStatus.

const (
	KeyStatusActive   KeyStatus = "active"
	KeyStatusDisabled KeyStatus = "disabled"
)

Defines values for KeyStatus.

type ListLimit

type ListLimit = int

ListLimit defines model for ListLimit.

type ListName

type ListName = string

ListName defines model for ListName.

type ListOffset

type ListOffset = int

ListOffset defines model for ListOffset.

type ListOrder

type ListOrder string

ListOrder defines model for ListOrder.

const (
	ListOrderAsc  ListOrder = "asc"
	ListOrderDesc ListOrder = "desc"
)

Defines values for ListOrder.

type ListRulesParams

type ListRulesParams struct {
	Enabled *bool `form:"enabled,omitempty" json:"enabled,omitempty"`
}

ListRulesParams defines parameters for ListRules.

type ListSort

type ListSort = string

ListSort defines model for ListSort.

type LogsResponse

type LogsResponse struct {
	// NextCursor 下一页游标(本页最后一条 id);null = 无更多行
	NextCursor *int64     `json:"next_cursor"`
	Rows       []UsageLog `json:"rows"`
}

LogsResponse defines model for LogsResponse.

type MailChannelTestRequest

type MailChannelTestRequest struct {
	Email openapi_types.Email `json:"email"`
}

MailChannelTestRequest defines model for MailChannelTestRequest.

type MailChannelTestResponse

type MailChannelTestResponse struct {
	Sent bool `json:"sent"`
}

MailChannelTestResponse defines model for MailChannelTestResponse.

type MailTemplate

type MailTemplate struct {
	BodyText  string              `json:"body_text"`
	Purpose   MailTemplatePurpose `json:"purpose"`
	Subject   string              `json:"subject"`
	UpdatedAt *time.Time          `json:"updated_at"`
}

MailTemplate defines model for MailTemplate.

type MailTemplatePurpose

type MailTemplatePurpose string

MailTemplatePurpose defines model for MailTemplate.Purpose.

const (
	BalanceWarning MailTemplatePurpose = "balance_warning"
	RegisterCode   MailTemplatePurpose = "register_code"
	ResetCode      MailTemplatePurpose = "reset_code"
)

Defines values for MailTemplatePurpose.

type MailTemplateUpdate

type MailTemplateUpdate struct {
	// BodyText 空串=还原默认(删行)
	BodyText string `json:"body_text"`
	Subject  string `json:"subject"`
}

MailTemplateUpdate defines model for MailTemplateUpdate.

type MiddlewareFunc

type MiddlewareFunc func(http.Handler) http.Handler

type ModelMappingEntry

type ModelMappingEntry struct {
	MappedModel string                `json:"mapped_model"`
	Mode        ModelMappingEntryMode `json:"mode"`
}

ModelMappingEntry defines model for ModelMappingEntry.

type ModelMappingEntryMode

type ModelMappingEntryMode string

ModelMappingEntryMode defines model for ModelMappingEntry.Mode.

const (
	Explicit ModelMappingEntryMode = "explicit"
	Implicit ModelMappingEntryMode = "implicit"
)

Defines values for ModelMappingEntryMode.

type OpsOptions

type OpsOptions struct {
	Workers   []StatsProvider
	Snapshots func() []SnapshotState // nil = 快照区返回空
	// InFlightUsers 实时在途并发快照提供面(/api/admin/users-top;实现 =
	// proxy.Auth.InFlightUsers——门禁快照只读访问器,零锁冷面。nil = 未装配 →
	// 端点返回空列表)。
	InFlightUsers func() map[int64]int64
	// BillingAlerts 计费告警面(/api/admin/overview alerts 段;实现 = billing
	// 游标消费者 lag 族观测直读(ledger-cursor)。nil = 未装配 → alerts 全零)。
	BillingAlerts func() BillingAlerts
	// UsageSnap codex 额度快照数据源(/api/admin/accounts/usage 的
	// upstream 栏经构造直调(*sdkbridge.Codex 满足);nil = 未装配 → codex
	// 账号 null 快照,与旧 service nil-setter 降级语义一致)。
	UsageSnap CodexUsageProber
	// PricingSync 价格手动同步/预览编排面(POST /pricing/sync 与
	// /pricing/sync/preview 经构造直调(*pricing.SyncWorker 满足);nil =
	// 未装配 → 端点 500,与旧 service nil-fetcher 降级语义一致)。
	PricingSync *pricing.SyncWorker
	// Log fan-out 未知上游错误 Warn(nil = 静默;生产由组合根注入)。
	Log *logx.Logger
}

OpsOptions GET /api/admin/ops/workers 装配参数(New 变参注入;零值 = 端点返回空)。

type OverviewAccounts

type OverviewAccounts struct {
	N429   int `json:"429"`
	Active int `json:"active"`

	// Concurrency 在途并发合计
	Concurrency int64 `json:"concurrency"`
	Disabled    int   `json:"disabled"`

	// MaxConcurrency 并发上限合计(水位 = concurrency / max_concurrency)
	MaxConcurrency int `json:"max_concurrency"`
	Unhealthy      int `json:"unhealthy"`
}

OverviewAccounts 账号健康分布 + 并发水位(调度器快照同源——与账号列表运行时视图一致)

type OverviewAlerts

type OverviewAlerts struct {
	// BillingLagMs 游标积压时滞(毫秒)= 最近周期探测的 now − 最老 unbilled 行 created_at;0 = 游标空/未探测
	BillingLagMs int64 `json:"billing_lag_ms"`

	// BillingQuarantinedRows 累计隔离行数(用户缺失组)
	BillingQuarantinedRows int64 `json:"billing_quarantined_rows"`

	// BillingUnbilledRows 当前未扣费账本行数(部分索引 WHERE NOT billed)
	BillingUnbilledRows int64 `json:"billing_unbilled_rows"`
}

OverviewAlerts 告警面(billing 游标消费者 lag 族观测,ledger-cursor;注入面读取,未装配 = 全零)

type OverviewErrTop

type OverviewErrTop struct {
	ErrCount int     `json:"err_count"`
	ErrRate  float64 `json:"err_rate"`

	// Name 账号名(非模型名——账号维度)
	Name string `json:"name"`
}

OverviewErrTop 账号维度错误率 Top5(调度器 EWMA err_rate 降序;name = 账号名)

type OverviewResources

type OverviewResources struct {
	Groups    int `json:"groups"`
	Templates int `json:"templates"`
	Users     int `json:"users"`
}

OverviewResources 资源计数(冷面 count;模板/分组排除软删)

type OverviewResponse

type OverviewResponse struct {
	// Accounts 账号健康分布 + 并发水位(调度器快照同源——与账号列表运行时视图一致)
	Accounts OverviewAccounts `json:"accounts"`

	// Alerts 告警面(billing 游标消费者 lag 族观测,ledger-cursor;注入面读取,未装配 = 全零)
	Alerts OverviewAlerts   `json:"alerts"`
	ErrTop []OverviewErrTop `json:"err_top"`

	// Resources 资源计数(冷面 count;模板/分组排除软删)
	Resources OverviewResources `json:"resources"`

	// Summary 今日汇总(请求 timezone 时区日界,缺省 UTC;cost_usd/raw_cost_usd = 毫分 /1e5 → USD;TTFT 指标仅含首 token 流式请求样本,无样本 = 0)
	Summary OverviewSummary `json:"summary"`
	Trend   []OverviewTrend `json:"trend"`
}

OverviewResponse defines model for OverviewResponse.

type OverviewSummary

type OverviewSummary struct {
	CacheReadTokens int64 `json:"cache_read_tokens"`

	// CallCount 按次调用(图片生成 = 张数、search = 1;usage_logs call_count 离线聚合 sum)
	CallCount int64 `json:"call_count"`

	// CostUsd 今日成本(USD,毫分 /1e5——与价格 API 口径一致)
	CostUsd float64 `json:"cost_usd"`

	// ErrRate 错误率(errors / requests;无请求 = 0)
	ErrRate      float64 `json:"err_rate"`
	Errors       int64   `json:"errors"`
	InputTokens  int64   `json:"input_tokens"`
	OutputTokens int64   `json:"output_tokens"`

	// RawCostUsd 今日原始成本(USD,毫分 /1e5——乘倍率前"实际消耗"口径;免费组 cost 为 0 但 raw 有值)
	RawCostUsd  float64 `json:"raw_cost_usd"`
	Requests    int64   `json:"requests"`
	TotalTokens int64   `json:"total_tokens"`

	// TtftAvgMs TTFT 均值(ttft_total_ms / ttft_count,查询侧 Go 除)
	TtftAvgMs float64 `json:"ttft_avg_ms"`

	// TtftMaxMs TTFT 最大值
	TtftMaxMs int64 `json:"ttft_max_ms"`

	// TtftP50Ms TTFT p50(直方图桶内线性插值,nearest-rank;顶桶回落 12800)
	TtftP50Ms int64 `json:"ttft_p50_ms"`
	TtftP90Ms int64 `json:"ttft_p90_ms"`
	TtftP95Ms int64 `json:"ttft_p95_ms"`
	TtftP99Ms int64 `json:"ttft_p99_ms"`
}

OverviewSummary 今日汇总(请求 timezone 时区日界,缺省 UTC;cost_usd/raw_cost_usd = 毫分 /1e5 → USD;TTFT 指标仅含首 token 流式请求样本,无样本 = 0)

type OverviewTrend

type OverviewTrend struct {
	// CallCount 按次调用(图片生成 = 张数、search = 1)
	CallCount int64 `json:"call_count"`

	// CostUsd 当日成本(USD,毫分 /1e5)
	CostUsd float64 `json:"cost_usd"`

	// Date 日桶日期(请求 timezone 的本地日期,缺省 UTC)
	Date   openapi_types.Date `json:"date"`
	Errors int64              `json:"errors"`

	// RawCostUsd 当日原始成本(USD,毫分 /1e5——乘倍率前"实际消耗"口径)
	RawCostUsd float64 `json:"raw_cost_usd"`
	Requests   int64   `json:"requests"`

	// Tokens 当日总 token(usage_stats total_tokens 列聚合)
	Tokens int64 `json:"tokens"`

	// TtftAvgMs 当日 TTFT 均值(查询侧 Go 除)
	TtftAvgMs float64 `json:"ttft_avg_ms"`
	TtftMaxMs int64   `json:"ttft_max_ms"`
	TtftP50Ms int64   `json:"ttft_p50_ms"`
	TtftP90Ms int64   `json:"ttft_p90_ms"`
	TtftP95Ms int64   `json:"ttft_p95_ms"`
	TtftP99Ms int64   `json:"ttft_p99_ms"`
}

OverviewTrend 近 N 天日桶(SQL 侧按请求 timezone 的本地日界分组,缺省 UTC;TTFT 指标仅含首 token 流式请求样本,无样本 = 0)

type PatchAccountsIdJSONRequestBody

type PatchAccountsIdJSONRequestBody = AccountConfigPatch

PatchAccountsIdJSONRequestBody defines body for PatchAccountsId for application/json ContentType.

type PatchAccountsIdParams

type PatchAccountsIdParams struct {
	IfMatch *string `json:"If-Match,omitempty"`
}

PatchAccountsIdParams defines parameters for PatchAccountsId.

type PatchAdminSupplierBalancesUidJSONRequestBody

type PatchAdminSupplierBalancesUidJSONRequestBody = SupplierBalancePatchBody

PatchAdminSupplierBalancesUidJSONRequestBody defines body for PatchAdminSupplierBalancesUid for application/json ContentType.

type PostAccountsBatchDeleteJSONRequestBody

type PostAccountsBatchDeleteJSONRequestBody = BatchDeleteBody

PostAccountsBatchDeleteJSONRequestBody defines body for PostAccountsBatchDelete for application/json ContentType.

type PostAccountsBatchImportCodexOauthJSONRequestBody

type PostAccountsBatchImportCodexOauthJSONRequestBody = CodexOAuthImportBody

PostAccountsBatchImportCodexOauthJSONRequestBody defines body for PostAccountsBatchImportCodexOauth for application/json ContentType.

type PostAccountsBatchImportCodexPatJSONRequestBody

type PostAccountsBatchImportCodexPatJSONRequestBody = CodexPATImportBody

PostAccountsBatchImportCodexPatJSONRequestBody defines body for PostAccountsBatchImportCodexPat for application/json ContentType.

type PostAccountsBatchUpdateJSONRequestBody

type PostAccountsBatchUpdateJSONRequestBody = BatchUpdateAccountsBody

PostAccountsBatchUpdateJSONRequestBody defines body for PostAccountsBatchUpdate for application/json ContentType.

type PostAccountsIdRecoverJSONRequestBody

type PostAccountsIdRecoverJSONRequestBody = AccountRecoverBody

PostAccountsIdRecoverJSONRequestBody defines body for PostAccountsIdRecover for application/json ContentType.

type PostAccountsJSONRequestBody

type PostAccountsJSONRequestBody = AccountCreate

PostAccountsJSONRequestBody defines body for PostAccounts for application/json ContentType.

type PostAdminSupplierSettlementsAdminRequestJSONRequestBody

type PostAdminSupplierSettlementsAdminRequestJSONRequestBody = AdminRequestSettlementBody

PostAdminSupplierSettlementsAdminRequestJSONRequestBody defines body for PostAdminSupplierSettlementsAdminRequest for application/json ContentType.

type PostAdminSupplierSettlementsIdApproveJSONRequestBody

type PostAdminSupplierSettlementsIdApproveJSONRequestBody = SettlementTransitionBody

PostAdminSupplierSettlementsIdApproveJSONRequestBody defines body for PostAdminSupplierSettlementsIdApprove for application/json ContentType.

type PostAdminSupplierSettlementsIdClaimJSONRequestBody

type PostAdminSupplierSettlementsIdClaimJSONRequestBody = SettlementClaimBody

PostAdminSupplierSettlementsIdClaimJSONRequestBody defines body for PostAdminSupplierSettlementsIdClaim for application/json ContentType.

type PostAdminSupplierSettlementsIdConfirmFailedJSONRequestBody

type PostAdminSupplierSettlementsIdConfirmFailedJSONRequestBody = SettlementConfirmFailedBody

PostAdminSupplierSettlementsIdConfirmFailedJSONRequestBody defines body for PostAdminSupplierSettlementsIdConfirmFailed for application/json ContentType.

type PostAdminSupplierSettlementsIdPaidJSONRequestBody

type PostAdminSupplierSettlementsIdPaidJSONRequestBody = SettlementPaidBody

PostAdminSupplierSettlementsIdPaidJSONRequestBody defines body for PostAdminSupplierSettlementsIdPaid for application/json ContentType.

type PostAdminSupplierSettlementsIdRejectJSONRequestBody

type PostAdminSupplierSettlementsIdRejectJSONRequestBody = SettlementRejectBody

PostAdminSupplierSettlementsIdRejectJSONRequestBody defines body for PostAdminSupplierSettlementsIdReject for application/json ContentType.

type PostGroupsBatchDeleteJSONRequestBody

type PostGroupsBatchDeleteJSONRequestBody = BatchDeleteBody

PostGroupsBatchDeleteJSONRequestBody defines body for PostGroupsBatchDelete for application/json ContentType.

type PostGroupsBatchUpdateJSONRequestBody

type PostGroupsBatchUpdateJSONRequestBody = BatchUpdateGroupsBody

PostGroupsBatchUpdateJSONRequestBody defines body for PostGroupsBatchUpdate for application/json ContentType.

type PostGroupsJSONRequestBody

type PostGroupsJSONRequestBody = GroupCreate

PostGroupsJSONRequestBody defines body for PostGroups for application/json ContentType.

type PostMailChannelTestJSONRequestBody

type PostMailChannelTestJSONRequestBody = MailChannelTestRequest

PostMailChannelTestJSONRequestBody defines body for PostMailChannelTest for application/json ContentType.

type PostRedemptionCodesBatchDeactivateJSONRequestBody

type PostRedemptionCodesBatchDeactivateJSONRequestBody = BatchDeactivateRequest

PostRedemptionCodesBatchDeactivateJSONRequestBody defines body for PostRedemptionCodesBatchDeactivate for application/json ContentType.

type PostRedemptionCodesIdDeactivateJSONRequestBody

type PostRedemptionCodesIdDeactivateJSONRequestBody = DeactivateRequest

PostRedemptionCodesIdDeactivateJSONRequestBody defines body for PostRedemptionCodesIdDeactivate for application/json ContentType.

type PostRedemptionCodesJSONRequestBody

type PostRedemptionCodesJSONRequestBody = GenerateRequest

PostRedemptionCodesJSONRequestBody defines body for PostRedemptionCodes for application/json ContentType.

type PostRulesBatchDeleteJSONRequestBody

type PostRulesBatchDeleteJSONRequestBody = BatchDeleteBody

PostRulesBatchDeleteJSONRequestBody defines body for PostRulesBatchDelete for application/json ContentType.

type PostTemplatesBatchDeleteJSONRequestBody

type PostTemplatesBatchDeleteJSONRequestBody = BatchDeleteBody

PostTemplatesBatchDeleteJSONRequestBody defines body for PostTemplatesBatchDelete for application/json ContentType.

type PostTemplatesBatchUpdateJSONRequestBody

type PostTemplatesBatchUpdateJSONRequestBody = BatchUpdateTemplatesBody

PostTemplatesBatchUpdateJSONRequestBody defines body for PostTemplatesBatchUpdate for application/json ContentType.

type PostTemplatesJSONRequestBody

type PostTemplatesJSONRequestBody = TemplateCreate

PostTemplatesJSONRequestBody defines body for PostTemplates for application/json ContentType.

type PostUsersJSONRequestBody

type PostUsersJSONRequestBody = UserCreate

PostUsersJSONRequestBody defines body for PostUsers for application/json ContentType.

type PriceEntry

type PriceEntry struct {
	CacheReadPerM  *float64       `json:"CacheReadPerM"`
	CacheWritePerM *float64       `json:"CacheWritePerM"`
	CreatedAt      time.Time      `json:"CreatedAt"`
	ImgInTokPerM   *float64       `json:"ImgInTokPerM"`
	ImgOutTokPerM  *float64       `json:"ImgOutTokPerM"`
	InputPerM      *float64       `json:"InputPerM"`
	Mode           PriceEntryMode `json:"Mode"`
	Model          string         `json:"Model"`
	OutputPerM     *float64       `json:"OutputPerM"`
	PricePerCall   *float64       `json:"PricePerCall"`
	PricePerImage  *float64       `json:"PricePerImage"`
	Provider       *Provider      `json:"Provider"`
	Source         PricingSource  `json:"Source"`
	UpdatedAt      time.Time      `json:"UpdatedAt"`
}

PriceEntry defines model for PriceEntry.

type PriceEntryListResponse

type PriceEntryListResponse struct {
	Rows  []PriceEntry `json:"rows"`
	Total int64        `json:"total"`
}

PriceEntryListResponse defines model for PriceEntryListResponse.

type PriceEntryMode

type PriceEntryMode string

PriceEntryMode defines model for PriceEntry.Mode.

const (
	PriceEntryModeCall  PriceEntryMode = "call"
	PriceEntryModeImage PriceEntryMode = "image"
	PriceEntryModeToken PriceEntryMode = "token"
)

Defines values for PriceEntryMode.

type PriceEntryUpsert

type PriceEntryUpsert struct {
	CacheReadPerM  *float64             `json:"cache_read_per_m"`
	CacheWritePerM *float64             `json:"cache_write_per_m"`
	ImgInTokPerM   *float64             `json:"img_in_tok_per_m"`
	ImgOutTokPerM  *float64             `json:"img_out_tok_per_m"`
	InputPerM      *float64             `json:"input_per_m"`
	Mode           PriceEntryUpsertMode `json:"mode"`
	OutputPerM     *float64             `json:"output_per_m"`
	PricePerCall   *float64             `json:"price_per_call"`
	PricePerImage  *float64             `json:"price_per_image"`
}

PriceEntryUpsert defines model for PriceEntryUpsert.

type PriceEntryUpsertMode

type PriceEntryUpsertMode string

PriceEntryUpsertMode defines model for PriceEntryUpsert.Mode.

const (
	PriceEntryUpsertModeCall  PriceEntryUpsertMode = "call"
	PriceEntryUpsertModeImage PriceEntryUpsertMode = "image"
	PriceEntryUpsertModeToken PriceEntryUpsertMode = "token"
)

Defines values for PriceEntryUpsertMode.

type PriceVariant

type PriceVariant struct {
	CreatedAt            time.Time `json:"CreatedAt"`
	CtxMax               *int64    `json:"CtxMax"`
	CtxMin               *int64    `json:"CtxMin"`
	DowMask              *int      `json:"DowMask"`
	Model                string    `json:"Model"`
	Seq                  int       `json:"Seq"`
	ServiceTier          *string   `json:"ServiceTier"`
	SetCacheCreationPerM *float64  `json:"SetCacheCreationPerM"`
	SetCacheReadPerM     *float64  `json:"SetCacheReadPerM"`
	SetImgInTokPerM      *float64  `json:"SetImgInTokPerM"`
	SetImgOutTokPerM     *float64  `json:"SetImgOutTokPerM"`
	SetInputPerM         *float64  `json:"SetInputPerM"`
	SetOutputPerM        *float64  `json:"SetOutputPerM"`
	SetPricePerCall      *float64  `json:"SetPricePerCall"`
	SetPricePerImage     *float64  `json:"SetPricePerImage"`
	TimeEnd              *string   `json:"TimeEnd"`
	TimeStart            *string   `json:"TimeStart"`
	UpdatedAt            time.Time `json:"UpdatedAt"`

	// Multiplier 价格倍率(正常值,1 = ×1,0 = 免费,上限 10 = ×10;API 边界倍数小数——存储 mult_bp 万分:存储 15000 ↔ 显示 1.5)
	Multiplier *float64 `json:"multiplier"`
}

PriceVariant defines model for PriceVariant.

type PriceVariantListRequest

type PriceVariantListRequest struct {
	Variants *[]PriceVariantUpsert `json:"variants,omitempty"`
}

PriceVariantListRequest defines model for PriceVariantListRequest.

type PriceVariantListResponse

type PriceVariantListResponse struct {
	Rows *[]PriceVariant `json:"rows,omitempty"`
}

PriceVariantListResponse defines model for PriceVariantListResponse.

type PriceVariantUpsert

type PriceVariantUpsert struct {
	CtxMax  *int64 `json:"ctx_max"`
	CtxMin  *int64 `json:"ctx_min"`
	DowMask *int   `json:"dow_mask"`

	// Multiplier 价格倍率(正常值,1 = ×1,0 = 免费,上限 10 = ×10;API 边界倍数小数——存储 mult_bp 万分:存储 15000 ↔ 显示 1.5)
	Multiplier           *float64 `json:"multiplier"`
	Seq                  *int     `json:"seq,omitempty"`
	ServiceTier          *string  `json:"service_tier"`
	SetCacheCreationPerM *float64 `json:"set_cache_creation_per_m"`
	SetCacheReadPerM     *float64 `json:"set_cache_read_per_m"`
	SetImgInTokPerM      *float64 `json:"set_img_in_tok_per_m"`
	SetImgOutTokPerM     *float64 `json:"set_img_out_tok_per_m"`
	SetInputPerM         *float64 `json:"set_input_per_m"`
	SetOutputPerM        *float64 `json:"set_output_per_m"`
	SetPricePerCall      *float64 `json:"set_price_per_call"`
	SetPricePerImage     *float64 `json:"set_price_per_image"`
	TimeEnd              *string  `json:"time_end"`
	TimeStart            *string  `json:"time_start"`
}

PriceVariantUpsert defines model for PriceVariantUpsert.

type PricingPreviewEntry

type PricingPreviewEntry struct {
	Action PricingPreviewEntryAction `json:"action"`
	Mode   PricingPreviewEntryMode   `json:"mode"`
	Model  string                    `json:"model"`
}

PricingPreviewEntry defines model for PricingPreviewEntry.

type PricingPreviewEntryAction

type PricingPreviewEntryAction string

PricingPreviewEntryAction defines model for PricingPreviewEntry.Action.

const (
	Add    PricingPreviewEntryAction = "add"
	Update PricingPreviewEntryAction = "update"
)

Defines values for PricingPreviewEntryAction.

type PricingPreviewEntryMode

type PricingPreviewEntryMode string

PricingPreviewEntryMode defines model for PricingPreviewEntry.Mode.

const (
	PricingPreviewEntryModeCall  PricingPreviewEntryMode = "call"
	PricingPreviewEntryModeImage PricingPreviewEntryMode = "image"
	PricingPreviewEntryModeToken PricingPreviewEntryMode = "token"
)

Defines values for PricingPreviewEntryMode.

type PricingSource

type PricingSource string

PricingSource defines model for PricingSource.

const (
	PricingSourceLitellm PricingSource = "litellm"
	PricingSourceManual  PricingSource = "manual"
)

Defines values for PricingSource.

type PricingSyncPreviewResponse

type PricingSyncPreviewResponse struct {
	Entries         *[]PricingPreviewEntry `json:"entries,omitempty"`
	Skipped         int                    `json:"skipped"`
	ToAdd           int                    `json:"to_add"`
	ToUpdate        int                    `json:"to_update"`
	VariantsChanged *int                   `json:"variants_changed,omitempty"`
}

PricingSyncPreviewResponse defines model for PricingSyncPreviewResponse.

type PricingSyncResponse

type PricingSyncResponse struct {
	// Rows 拉取到的有效模型行数
	Rows int `json:"rows"`

	// Skipped 解析时跳过的非法条目数(文本价、image 价与 function 价均无效,计一次)
	Skipped int `json:"skipped"`

	// Updated 文本价 upsert 落库数(manual 行不计)
	Updated int `json:"updated"`
}

PricingSyncResponse defines model for PricingSyncResponse.

type Provider

type Provider string

Provider 主流厂商枚举(litellm_provider 实际字符串,服务前端下拉框)。**litellm_provider 动态**——litellm 更新会加新厂商,此 enum 为主流集合;新厂商出现时扩 enum(DB 筛选不受限——自由字符串等值)

const (
	ProviderAlibaba     Provider = "alibaba"
	ProviderAnthropic   Provider = "anthropic"
	ProviderAzure       Provider = "azure"
	ProviderBaidu       Provider = "baidu"
	ProviderBedrock     Provider = "bedrock"
	ProviderCerebras    Provider = "cerebras"
	ProviderCohere      Provider = "cohere"
	ProviderDeepseek    Provider = "deepseek"
	ProviderFireworksAi Provider = "fireworks_ai"
	ProviderGroq        Provider = "groq"
	ProviderHuggingface Provider = "huggingface"
	ProviderMeta        Provider = "meta"
	ProviderMistral     Provider = "mistral"
	ProviderMoonshot    Provider = "moonshot"
	ProviderNvidia      Provider = "nvidia"
	ProviderOpenai      Provider = "openai"
	ProviderOpenrouter  Provider = "openrouter"
	ProviderPerplexity  Provider = "perplexity"
	ProviderReplicate   Provider = "replicate"
	ProviderTogetherAi  Provider = "together_ai"
	ProviderVertexAi    Provider = "vertex_ai"
	ProviderXai         Provider = "xai"
	ProviderZhipu       Provider = "zhipu"
)

Defines values for Provider.

type PutAccountsIdExtJSONRequestBody

type PutAccountsIdExtJSONRequestBody = AccountExt

PutAccountsIdExtJSONRequestBody defines body for PutAccountsIdExt for application/json ContentType.

type PutAdminSettingsJSONRequestBody

type PutAdminSettingsJSONRequestBody = SettingUpdate

PutAdminSettingsJSONRequestBody defines body for PutAdminSettings for application/json ContentType.

type PutGroupsIdAssignmentsJSONRequestBody

type PutGroupsIdAssignmentsJSONRequestBody = GroupAssignmentsBody

PutGroupsIdAssignmentsJSONRequestBody defines body for PutGroupsIdAssignments for application/json ContentType.

type PutGroupsIdJSONRequestBody

type PutGroupsIdJSONRequestBody = GroupCreate

PutGroupsIdJSONRequestBody defines body for PutGroupsId for application/json ContentType.

type PutMailTemplateJSONRequestBody

type PutMailTemplateJSONRequestBody = MailTemplateUpdate

PutMailTemplateJSONRequestBody defines body for PutMailTemplate for application/json ContentType.

type PutPriceEntryJSONRequestBody

type PutPriceEntryJSONRequestBody = PriceEntryUpsert

PutPriceEntryJSONRequestBody defines body for PutPriceEntry for application/json ContentType.

type PutPriceEntryParams

type PutPriceEntryParams struct {
	Model string `form:"model" json:"model"`
}

PutPriceEntryParams defines parameters for PutPriceEntry.

type PutPriceVariantsJSONRequestBody

type PutPriceVariantsJSONRequestBody = PriceVariantListRequest

PutPriceVariantsJSONRequestBody defines body for PutPriceVariants for application/json ContentType.

type PutPriceVariantsParams

type PutPriceVariantsParams struct {
	Model string `form:"model" json:"model"`
}

PutPriceVariantsParams defines parameters for PutPriceVariants.

type PutTemplatesIdExtJSONRequestBody

type PutTemplatesIdExtJSONRequestBody = TemplateExt

PutTemplatesIdExtJSONRequestBody defines body for PutTemplatesIdExt for application/json ContentType.

type PutTemplatesIdJSONRequestBody

type PutTemplatesIdJSONRequestBody = TemplateCreate

PutTemplatesIdJSONRequestBody defines body for PutTemplatesId for application/json ContentType.

type PutUsersIdGroupsJSONRequestBody

type PutUsersIdGroupsJSONRequestBody = UserGroupsBody

PutUsersIdGroupsJSONRequestBody defines body for PutUsersIdGroups for application/json ContentType.

type PutUsersIdJSONRequestBody

type PutUsersIdJSONRequestBody = UserUpdate

PutUsersIdJSONRequestBody defines body for PutUsersId for application/json ContentType.

type RedemptionCode

type RedemptionCode struct {
	// Code XXXX-XXXX-XXXX-XXXX(16 字符,生成后不可编辑,仅可失效)
	Code      string    `json:"Code"`
	CreatedAt time.Time `json:"CreatedAt"`

	// CreatedBy platform_admin 用户 id(adminAuth 鉴权路径恒注入 owner id);0 = 系统/无归属
	CreatedBy int64 `json:"CreatedBy"`

	// ExpiresAt 码未兑换即过期;null = 永久
	ExpiresAt *time.Time `json:"ExpiresAt"`
	ID        int64      `json:"ID"`

	// MaxUses 1 = 单次码;>1 = 多人码
	MaxUses int     `json:"MaxUses"`
	Remark  *string `json:"Remark"`

	// ResourceExpiresAt 兑换后资源到期;temp_balance 必有,其余恒 null
	ResourceExpiresAt *time.Time       `json:"ResourceExpiresAt"`
	Status            RedemptionStatus `json:"Status"`
	Type              RedemptionType   `json:"Type"`
	UpdatedAt         time.Time        `json:"UpdatedAt"`

	// UsedCount 已兑换次数
	UsedCount int `json:"UsedCount"`

	// Value 面值:balance/temp_balance = USD(1 = $1);concurrency = 并发数(整数)。存储毫分(API 边界换算)
	Value float64 `json:"Value"`
}

RedemptionCode defines model for RedemptionCode.

type RedemptionCodeListResponse

type RedemptionCodeListResponse struct {
	Rows  []RedemptionCode `json:"rows"`
	Total int64            `json:"total"`
}

RedemptionCodeListResponse defines model for RedemptionCodeListResponse.

type RedemptionStatus

type RedemptionStatus string

RedemptionStatus defines model for RedemptionStatus.

const (
	RedemptionStatusActive   RedemptionStatus = "active"
	RedemptionStatusDisabled RedemptionStatus = "disabled"
)

Defines values for RedemptionStatus.

type RedemptionType

type RedemptionType string

RedemptionType defines model for RedemptionType.

const (
	RedemptionTypeBalance     RedemptionType = "balance"
	RedemptionTypeConcurrency RedemptionType = "concurrency"
	RedemptionTypeTempBalance RedemptionType = "temp_balance"
)

Defines values for RedemptionType.

type RedemptionUse

type RedemptionUse struct {
	CodeID            int64      `json:"CodeID"`
	CreatedAt         time.Time  `json:"CreatedAt"`
	ID                int64      `json:"ID"`
	ResourceExpiresAt *time.Time `json:"ResourceExpiresAt"`
	UserID            int64      `json:"UserID"`

	// Value 兑换时的值快照(同面值单位语义)
	Value float64 `json:"Value"`
}

RedemptionUse defines model for RedemptionUse.

type RedemptionUseListResponse

type RedemptionUseListResponse struct {
	Rows  []RedemptionUse `json:"rows"`
	Total int64           `json:"total"`
}

RedemptionUseListResponse defines model for RedemptionUseListResponse.

type RequestFormat

type RequestFormat string

RequestFormat defines model for RequestFormat.

const (
	RequestFormatAnthropic         RequestFormat = "anthropic"
	RequestFormatOpenaiChat        RequestFormat = "openai-chat"
	RequestFormatOpenaiImages      RequestFormat = "openai-images"
	RequestFormatOpenaiResponses   RequestFormat = "openai-responses"
	RequestFormatOpenaiResponsesWs RequestFormat = "openai-responses-ws"
	RequestFormatOpenaiSearch      RequestFormat = "openai-search"
)

Defines values for RequestFormat.

type RequiredHeaderError

type RequiredHeaderError struct {
	ParamName string
	Err       error
}

func (*RequiredHeaderError) Error

func (e *RequiredHeaderError) Error() string

func (*RequiredHeaderError) Unwrap

func (e *RequiredHeaderError) Unwrap() error

type RequiredParamError

type RequiredParamError struct {
	ParamName string
}

func (*RequiredParamError) Error

func (e *RequiredParamError) Error() string

type RoutingFlowEdge

type RoutingFlowEdge struct {
	AccountId int64 `json:"account_id"`

	// ChainCount 同身份链数(SUM)
	ChainCount int64 `json:"chain_count"`

	// IsTerminal true = 该链 Final
	IsTerminal bool `json:"is_terminal"`

	// Lane 通道(primary/explore/degraded)
	Lane string `json:"lane"`

	// MinGeneration 本边链最早计划代际(同边多代折叠的最小值)
	MinGeneration int64 `json:"min_generation"`

	// Ordinal 链内第几次尝试(1 = 首发)
	Ordinal int `json:"ordinal"`

	// Outcome 本边结局(success/429/4xx/5xx/network…)
	Outcome string `json:"outcome"`

	// PreviousAccountId 前驱账号(首发边 null)
	PreviousAccountId *int64 `json:"previous_account_id"`

	// PreviousOutcome 前驱结局(首发边空串)
	PreviousOutcome string `json:"previous_outcome"`

	// TransitionReason 迁移原因(failover 等;首发边空串)
	TransitionReason string `json:"transition_reason"`
}

RoutingFlowEdge 一条聚合边(合并层行;最早代际为同边多代折叠的最小值)

type RoutingFlowGraph

type RoutingFlowGraph struct {
	// AccountLimit 每层保留的账号数 N(实际生效值)
	AccountLimit int                    `json:"account_limit"`
	Edges        []RoutingFlowGraphEdge `json:"edges"`

	// Folded folded_accounts > 0 的冗余布尔,便于消费方直读
	Folded bool `json:"folded"`

	// FoldedAccounts 各 (ordinal
	FoldedAccounts int64 `json:"folded_accounts"`
}

RoutingFlowGraph 桑基图边集(已按 (ordinal,lane,account,outcome,is_terminal) 聚合)

type RoutingFlowGraphEdge

type RoutingFlowGraphEdge struct {
	// AccountId 本跳账号;0 = 「其他」聚合节点
	AccountId int64 `json:"account_id"`

	// ChainCount 同身份链数(SUM)
	ChainCount int64 `json:"chain_count"`

	// Folded true = 该边是折叠后的「其他」聚合(account_id 恒 0)
	Folded bool `json:"folded"`

	// IsTerminal true = 该链 Final
	IsTerminal bool `json:"is_terminal"`

	// Lane 通道(primary/explore/degraded)
	Lane string `json:"lane"`

	// Ordinal 链内第几次尝试(1 = 首发)
	Ordinal int `json:"ordinal"`

	// Outcome 本边结局(success/429/4xx/5xx/network…)
	Outcome string `json:"outcome"`

	// PreviousAccounts 到达链的 previous_account_id 去重集(升序);折叠节点为空
	PreviousAccounts []int64 `json:"previous_accounts"`

	// PreviousOutcomes 到达链的 previous_outcome 去重集(升序)
	PreviousOutcomes []string `json:"previous_outcomes"`

	// TransitionReasons 到达链的 transition_reason 去重集(升序)
	TransitionReasons []string `json:"transition_reasons"`
}

RoutingFlowGraphEdge 一条桑基边;account_id=0 且 folded=true 表示「其他」聚合节点

type RoutingFlowLane

type RoutingFlowLane struct {
	Edges   []RoutingFlowEdge `json:"edges"`
	Lane    string            `json:"lane"`
	Ordinal int               `json:"ordinal"`
}

RoutingFlowLane (ordinal, lane) 分组;组间按 (ordinal, lane) 全序,组内保持仓储确定性行序

type RoutingFlowResponse

type RoutingFlowResponse struct {
	// FirstDispatchChains Attempt1 = ordinal=1 链数和(守恒左端;完整边集聚合,不受分页影响)
	FirstDispatchChains int64 `json:"first_dispatch_chains"`

	// FlowOverflowDroppedChains 故障预算淘汰链(容量/入队拒绝;非上游失败)
	FlowOverflowDroppedChains int64 `json:"flow_overflow_dropped_chains"`

	// IncompleteChainDropped 本进程已观察 cleanup 缺 terminal 的链(非上游失败)
	IncompleteChainDropped int64 `json:"incomplete_chain_dropped"`

	// Lanes 边表的当前页(offset/limit 切片后仍按 (ordinal,lane) 分组,组内保持仓储确定性行序)
	Lanes []RoutingFlowLane `json:"lanes"`

	// PlanGeneration 当前发布计划 generation(边行各自 generation 不混入)
	PlanGeneration int64 `json:"plan_generation"`

	// ProcessCrashLossUnobservable 硬崩丢失不可量化标记,恒 true
	ProcessCrashLossUnobservable bool   `json:"process_crash_loss_unobservable"`
	RouteClassId                 string `json:"route_class_id"`

	// Sankey 桑基图边集(已按 (ordinal,lane,account,outcome,is_terminal) 聚合)
	Sankey RoutingFlowGraph `json:"sankey"`

	// StaleGenerationPresent 完整边集内是否存在 min_generation != plan_generation 的边行(行级谓词,精确——无高估无低估;不受 offset/limit 影响)。精确性前提:generation 随发布单调不减,故存量行恒有 min_generation ≤ plan_generation;未来代际竞态不在目标场景内)
	StaleGenerationPresent bool `json:"stale_generation_present"`

	// TerminalChains 保留 terminal 链数和(守恒右端,恒等于 first_dispatch_chains;完整边集聚合)
	TerminalChains int64 `json:"terminal_chains"`

	// TotalEdges 窗口内完整边行数(行单位,驱动前端翻页器;不受 offset/limit 影响)
	TotalEdges int64 `json:"total_edges"`
}

RoutingFlowResponse defines model for RoutingFlowResponse.

type RoutingFrontierCandidate

type RoutingFrontierCandidate struct {
	// AccountId unknown 候选为 0
	AccountId            int64  `json:"account_id"`
	Attempts             int64  `json:"attempts"`
	CandidateFingerprint string `json:"candidate_fingerprint"`

	// CostKnown known + 有成功样本 + 价格可解析
	CostKnown bool `json:"cost_known"`

	// IdentityRevision 候选内容代际 K(identity_revision)——非客户端 CAS 令牌 C(lifecycle_revision);C 只围栏管理员写入
	IdentityRevision int64 `json:"identity_revision"`

	// InputUnitCost 输入侧单位采购价(毫分/1M 输入侧 token,1 USD = 100,000 毫分,与 compiler 同式;cost_known=false 时无意义)
	InputUnitCost int64 `json:"input_unit_cost"`

	// Insufficient 样本 <30(与 explore 同门槛)
	Insufficient bool `json:"insufficient"`

	// Known 指纹在当前发布计划该路由候选目录内;false = 只呈现观测事实
	Known       bool   `json:"known"`
	MappedModel string `json:"mapped_model"`

	// OnFrontier Pareto 非支配(仅 known 且 cost_known 间扫描)
	OnFrontier     bool   `json:"on_frontier"`
	QualityClassId string `json:"quality_class_id"`

	// SuccessLcb Wilson95 下界
	SuccessLcb float64 `json:"success_lcb"`

	// SuccessUcb Wilson95 上界
	SuccessUcb float64 `json:"success_ucb"`
	Successes  int64   `json:"successes"`
	TemplateId int64   `json:"template_id"`

	// TtftKnown 样本量足以给出区间
	TtftKnown bool `json:"ttft_known"`

	// TtftLcb TTFT 对数区间下界(ttft_known=false 时无意义)
	TtftLcb float64 `json:"ttft_lcb"`
	TtftUcb float64 `json:"ttft_ucb"`
}

RoutingFrontierCandidate defines model for RoutingFrontierCandidate.

type RoutingFrontierResponse

type RoutingFrontierResponse struct {
	// Candidates 排序后的一页候选
	Candidates     []RoutingFrontierCandidate `json:"candidates"`
	PlanGeneration int64                      `json:"plan_generation"`
	RouteClassId   string                     `json:"route_class_id"`

	// TotalCandidates 排序后候选总条数(分页用;不受 offset/limit 影响)
	TotalCandidates int64 `json:"total_candidates"`
}

RoutingFrontierResponse defines model for RoutingFrontierResponse.

type RoutingPlanCandidate

type RoutingPlanCandidate struct {
	AccountId int64 `json:"account_id"`

	// Fingerprint 真实候选指纹 hex(不可导出 = 空串)
	Fingerprint string `json:"fingerprint"`

	// IdentityFingerprint rollup join 身份指纹 hex(compiler 合成规则同源)
	IdentityFingerprint string `json:"identity_fingerprint"`

	// IdentityRevision 候选内容代际 K(identity_revision)——与编译器事实、wire 同源;非客户端 CAS 令牌 C
	IdentityRevision int64  `json:"identity_revision"`
	MappedModel      string `json:"mapped_model"`
	QualityClassId   string `json:"quality_class_id"`
	TemplateId       int64  `json:"template_id"`

	// UpstreamCostMultiplierBp 采购倍率 basis points(10000 = ×1)
	UpstreamCostMultiplierBp int `json:"upstream_cost_multiplier_bp"`
}

RoutingPlanCandidate 候选静态身份(缺叶子引用时 identity-only,其余字段零值)

type RoutingPlanExplore

type RoutingPlanExplore struct {
	Cumulative []int64 `json:"cumulative"`
	Fallback   []int64 `json:"fallback"`
	Ids        []int64 `json:"ids"`
	Total      int64   `json:"total"`

	// Weights account_id(十进制字符串键)→ 权重
	Weights map[string]int `json:"weights"`
}

RoutingPlanExplore explore 决策表(发布序 + 权重 + 累积轮盘;序是语义不重排)

type RoutingPlanIncident

type RoutingPlanIncident struct {
	Active bool `json:"active"`

	// Comparable 可比候选数(current/baseline attempts≥30 且 TTFT≥30)
	Comparable int `json:"comparable"`

	// Degraded 退化候选数(Wilson 成功区间不重叠)
	Degraded int `json:"degraded"`

	// Domains 可比去重 failure-domain 数
	Domains int `json:"domains"`

	// EvaluatedMinute 证据分钟 M(unix 秒;窗口边界可由 M 推导)
	EvaluatedMinute int64 `json:"evaluated_minute"`

	// Kind "domain"|"model"|"both"(inactive 时为空串)
	Kind string `json:"kind"`
}

RoutingPlanIncident 路由 expose-only 事故标记(detect+surface:不改通道、不节流、不探针;零值 = 无事故)

type RoutingPlanRef

type RoutingPlanRef struct {
	Format       string `json:"format"`
	GroupId      int64  `json:"group_id"`
	Model        string `json:"model"`
	OperationTag string `json:"operation_tag"`
	RouteClassId string `json:"route_class_id"`
}

RoutingPlanRef 路由全身份(group+format+model+operation+route class)

type RoutingPlanResponse

type RoutingPlanResponse struct {
	Generation int64 `json:"generation"`

	// PlanTotalRoutes 未过滤的当前计划路由总数(区分「空计划」与「窗口内无流量」)
	PlanTotalRoutes int64 `json:"plan_total_routes"`

	// Routes 全身份确定性路由序(与发布字节守卫同序)
	Routes []RoutingPlanRoute `json:"routes"`

	// TotalRoutes 过滤后(search ∩ observed 窗口;route 给定时恒为 1)的路由总数(分页用)
	TotalRoutes int64 `json:"total_routes"`
}

RoutingPlanResponse 当前发布计划快照(无历史 generation 查询面;空视图 = generation 0 + routes [])

type RoutingPlanRoute

type RoutingPlanRoute struct {
	// Candidates 通道账号并集(升序 AccountID)的当前页;candidates_limit=0 时为空数组
	Candidates []RoutingPlanCandidate `json:"candidates"`

	// CandidatesTotal 该路由候选总数(分页用;不受 candidates_offset/candidates_limit 影响)
	CandidatesTotal int64 `json:"candidates_total"`

	// Degraded degraded 候选发布序
	Degraded []int64 `json:"degraded"`

	// Explore explore 决策表(发布序 + 权重 + 累积轮盘;序是语义不重排)
	Explore RoutingPlanExplore `json:"explore"`

	// Incident 路由 expose-only 事故标记(detect+surface:不改通道、不节流、不探针;零值 = 无事故)
	Incident RoutingPlanIncident `json:"incident"`

	// Primary primary 候选发布序
	Primary []int64 `json:"primary"`

	// Ref 路由全身份(group+format+model+operation+route class)
	Ref RoutingPlanRef `json:"ref"`
}

RoutingPlanRoute defines model for RoutingPlanRoute.

type Rule

type Rule struct {
	CreatedAt time.Time `json:"CreatedAt"`

	// DeletedAt 软删除时间戳;null = 存活(列表/规则引擎重载过滤已删;GET 单个可查已删项)
	DeletedAt *time.Time `json:"DeletedAt"`
	Enabled   bool       `json:"Enabled"`
	ID        int64      `json:"ID"`
	Name      string     `json:"Name"`
	Priority  int        `json:"Priority"`

	// Then 动作集(只读回显;字段集与语义同 RuleCreate.then——throttle/fail_account/response_code/custom_message;全空 {} = 纯透传规则:命中后码/文双透、零惩罚)
	Then      map[string]interface{} `json:"Then"`
	UpdatedAt time.Time              `json:"UpdatedAt"`

	// When 事件匹配条件(只读回显;字段集与语义同 RuleCreate.when——kind/http_status(_in)/model/model_in/error_message_contains(_in)/account_id/template_id/group_id/window_seconds/count_*/ratio_*;model 口径为映射后最终请求模型,区分大小写)
	When map[string]interface{} `json:"When"`
}

Rule defines model for Rule.

type RuleCreate

type RuleCreate struct {
	Enabled  *bool  `json:"enabled,omitempty"`
	Name     string `json:"name"`
	Priority int    `json:"priority"`

	// Then 动作集(指针即意图:键缺省/null = 该维度透传不改)。全空对象 {} 合法 =
	// 纯透传规则:命中后零惩罚、响应码与文案双透传上游原样返回、
	// 不计惩罚(不投递状态事件)。可用键:
	// - throttle:typed 限流动作(与 fail_account 互斥;
	//   response_code/custom_message 塑形可并存)——
	//   {scope: account|account_route, mode: retry_after|open, duration_ms?, use_reset};
	//   scope=account 作用该账号全部 RouteClass,account_route 作用单 RouteClass
	//   (匹配时事件须携带账号+路由定位);mode=retry_after 要求 use_reset=true
	//   (上游 Reset 头优先,duration_ms 可选为回退);mode=open 要求 use_reset=false
	//   且 duration_ms > 0(固定摘除窗口)
	// - fail_account:true = 命中即判死(终态失效:failed_at + failure_source=rule,CAS fenced,
	//   恢复唯一入口 /accounts/{id}/recover);与 throttle 互斥
	// - response_code:缺省/null = 透传上游状态码;设置 = 覆写为指定码(400-599)
	// - custom_message:缺省/null = 透传上游错误文案;设置 = 覆写为固定文案(禁止空串)
	// 错误响应面无任何规则命中时默认归一为 502 "upstream rejected request"
	// (安全默认,未知错误不透传);可用本对象的 response_code/custom_message 覆写该默认。
	Then *map[string]interface{} `json:"then,omitempty"`

	// When 事件匹配条件(自由对象,未知键拒绝 → 400)。规则按 priority 升序首中匹配,
	// 全部条件 AND 组合,缺省键不参与匹配。可用键:
	// - kind:事件类别,ok/429/4xx/5xx/network 之一;network = 连接级失败(独立类别,不吃 5xx 冷却)
	// - http_status:精确匹配响应码(400-599);与 http_status_in 互斥(同现 → 400)
	// - http_status_in:响应码集合任一命中即匹配(OR;值限 400-599、去重、禁止空数组——传空数组 → 400);与 http_status 互斥
	// - model:精确匹配最终请求模型名——映射后 sel.Model/MappedModel 口径(非客户端原始请求名),响应分类/状态事件/日志脱敏各事件面统一;区分大小写;空串非法;事件未携带模型时不命中;与 model_in 互斥
	// - model_in:最终请求模型名集合任一精确命中(OR;口径同 model、区分大小写、去重、元素禁止空串、禁止空数组——传空数组 → 400);与 model 互斥
	// - error_message_contains:上游错误文本子串匹配;与 kind=ok 不兼容(ok 事件错误信息恒空,永不命中 → 400)
	// - error_message_contains_in:子串集合任一命中(OR;去重、元素禁止空串、禁止空数组);与 error_message_contains 互斥、与 kind=ok 不兼容
	// - account_id / template_id / group_id:按账号/模板/分组过滤事件(精确匹配)
	// - window_seconds:计数/比例条件的滑动统计窗口秒数(≥1;缺省 60)
	// - count_429_ge / count_failure_ge / count_ok_ge / count_total_ge:窗口内计数阈值(≥0;failure 桶 = 非 ok 非 429 的失败事件,5xx/network/4xx 并入)
	// - ratio_429_ge / ratio_failure_ge:窗口内比例阈值 ∈ [0,1],必须同时配置 count_total_ge 作为样本下限
	When *map[string]interface{} `json:"when,omitempty"`
}

RuleCreate defines model for RuleCreate.

type RuleListResponse

type RuleListResponse struct {
	Rows  []Rule `json:"rows"`
	Total int64  `json:"total"`
}

RuleListResponse defines model for RuleListResponse.

type RulePatch

type RulePatch struct {
	Enabled  *bool   `json:"enabled,omitempty"`
	Name     *string `json:"name,omitempty"`
	Priority *int    `json:"priority,omitempty"`

	// Then 动作集(指针即意图:键缺省/null = 该维度透传不改)。PUT 部分更新语义:
	// 键缺省(null/省略)= 保持原值;显式提供时整体替换该对象(显式 {} = 清空),
	// 并对合并后的完整 when/then 重新校验。全空对象 {} 合法 = 纯透传规则:
	// 命中后零惩罚、响应码与文案双透传上游原样返回、不计惩罚
	// (不投递状态事件)。可用键:
	// - throttle:typed 限流动作(与 fail_account 互斥;
	//   response_code/custom_message 塑形可并存)——
	//   {scope: account|account_route, mode: retry_after|open, duration_ms?, use_reset};
	//   scope=account 作用该账号全部 RouteClass,account_route 作用单 RouteClass
	//   (匹配时事件须携带账号+路由定位);mode=retry_after 要求 use_reset=true
	//   (上游 Reset 头优先,duration_ms 可选为回退);mode=open 要求 use_reset=false
	//   且 duration_ms > 0(固定摘除窗口)
	// - fail_account:true = 命中即判死(终态失效:failed_at + failure_source=rule,CAS fenced,
	//   恢复唯一入口 /accounts/{id}/recover);与 throttle 互斥
	// - response_code:缺省/null = 透传上游状态码;设置 = 覆写为指定码(400-599)
	// - custom_message:缺省/null = 透传上游错误文案;设置 = 覆写为固定文案(禁止空串)
	// 错误响应面无任何规则命中时默认归一为 502 "upstream rejected request"
	// (安全默认,未知错误不透传);可用本对象的 response_code/custom_message 覆写该默认。
	Then *map[string]interface{} `json:"then,omitempty"`

	// When 事件匹配条件(自由对象,未知键拒绝 → 400)。PUT 部分更新语义:键缺省
	// (null/省略)= 保持原值;显式提供时整体替换该对象(显式 {} = 清空),
	// 并对合并后的完整 when/then 重新校验。规则按 priority 升序首中匹配,
	// 全部条件 AND 组合,缺省键不参与匹配。可用键:
	// - kind:事件类别,ok/429/4xx/5xx/network 之一;network = 连接级失败(独立类别,不吃 5xx 冷却)
	// - http_status:精确匹配响应码(400-599);与 http_status_in 互斥(同现 → 400)
	// - http_status_in:响应码集合任一命中即匹配(OR;值限 400-599、去重、禁止空数组——传空数组 → 400);与 http_status 互斥
	// - model:精确匹配最终请求模型名——映射后 sel.Model/MappedModel 口径(非客户端原始请求名),响应分类/状态事件/日志脱敏各事件面统一;区分大小写;空串非法;事件未携带模型时不命中;与 model_in 互斥
	// - model_in:最终请求模型名集合任一精确命中(OR;口径同 model、区分大小写、去重、元素禁止空串、禁止空数组——传空数组 → 400);与 model 互斥
	// - error_message_contains:上游错误文本子串匹配;与 kind=ok 不兼容(ok 事件错误信息恒空,永不命中 → 400)
	// - error_message_contains_in:子串集合任一命中(OR;去重、元素禁止空串、禁止空数组);与 error_message_contains 互斥、与 kind=ok 不兼容
	// - account_id / template_id / group_id:按账号/模板/分组过滤事件(精确匹配)
	// - window_seconds:计数/比例条件的滑动统计窗口秒数(≥1;缺省 60)
	// - count_429_ge / count_failure_ge / count_ok_ge / count_total_ge:窗口内计数阈值(≥0;failure 桶 = 非 ok 非 429 的失败事件,5xx/network/4xx 并入)
	// - ratio_429_ge / ratio_failure_ge:窗口内比例阈值 ∈ [0,1],必须同时配置 count_total_ge 作为样本下限
	When *map[string]interface{} `json:"when,omitempty"`
}

RulePatch defines model for RulePatch.

type ServerInterface

type ServerInterface interface {
	// 账号列表(分页/筛选/排序,含运行时视图)
	// (GET /accounts)
	GetAccounts(w http.ResponseWriter, r *http.Request, params GetAccountsParams)
	// 创建账号
	// (POST /accounts)
	PostAccounts(w http.ResponseWriter, r *http.Request)
	// 批量删除账号(事务,全成或全败)
	// (POST /accounts/batch-delete)
	PostAccountsBatchDelete(w http.ResponseWriter, r *http.Request)
	// 批量导入 codex-oauth 凭据(幂等组合键 codex_email + codex_account_id;items ≤100 原始条数;行级失败不毁整批)
	// (POST /accounts/batch-import-codex-oauth)
	PostAccountsBatchImportCodexOauth(w http.ResponseWriter, r *http.Request)
	// 批量导入 codex-pat 凭据(幂等组合键 codex_email + codex_account_id;items ≤100 原始条数;行级失败不毁整批)
	// (POST /accounts/batch-import-codex-pat)
	PostAccountsBatchImportCodexPat(w http.ResponseWriter, r *http.Request)
	// 批量更新账号(fields 为任意字段子集)
	// (POST /accounts/batch-update)
	PostAccountsBatchUpdate(w http.ResponseWriter, r *http.Request)
	// 账号用量聚合(统一 usage API——批量 ≤100 条;窗口 from/to 或 window 恰择一)
	// (GET /accounts/usage)
	GetAccountsUsage(w http.ResponseWriter, r *http.Request, params GetAccountsUsageParams)

	// (DELETE /accounts/{id})
	DeleteAccountsId(w http.ResponseWriter, r *http.Request, id int64)

	// (GET /accounts/{id})
	GetAccountsId(w http.ResponseWriter, r *http.Request, id int64)
	// 部分更新账号(三态:缺省=不变;可空标量 null=清空、""=400;不可空标量 null=400;有值=落值)
	// (PATCH /accounts/{id})
	PatchAccountsId(w http.ResponseWriter, r *http.Request, id int64, params PatchAccountsIdParams)
	// 读取账号类型化鉴权扩展(编辑回显;仅 codex-oauth/codex-pat 账号有 ext 行)
	// (GET /accounts/{id}/ext)
	GetAccountsIdExt(w http.ResponseWriter, r *http.Request, id int64)
	// 幂等写入账号类型化鉴权扩展(Create/Update 合一;全列更新含 NULL 清空)
	// (PUT /accounts/{id}/ext)
	PutAccountsIdExt(w http.ResponseWriter, r *http.Request, id int64)
	// 读取账号的全部分组 id(编辑回显;不随账号列表返回)
	// (GET /accounts/{id}/groups)
	GetAccountsIdGroups(w http.ResponseWriter, r *http.Request, id int64)
	// 失效恢复(fenced):清 failed_at/last_error/failure_source + revision CAS +1 → 新代际置 PROBING 待探针
	// (POST /accounts/{id}/recover)
	PostAccountsIdRecover(w http.ResponseWriter, r *http.Request, id int64)
	// 错误明细分页查询(err_logs 完整错误面:本地拒绝 + 半异常双轨;status_code/error_type 全值)
	// (GET /err_logs)
	GetErrLogs(w http.ResponseWriter, r *http.Request, params GetErrLogsParams)
	// 分组列表(分页/筛选/排序)
	// (GET /groups)
	GetGroups(w http.ResponseWriter, r *http.Request, params GetGroupsParams)
	// 创建分组(平台容量池;key 为独立表,由用户面 /user/keys 创建)
	// (POST /groups)
	PostGroups(w http.ResponseWriter, r *http.Request)
	// 批量删除分组(事务,全成或全败)
	// (POST /groups/batch-delete)
	PostGroupsBatchDelete(w http.ResponseWriter, r *http.Request)
	// 批量更新分组(fields 为任意字段子集)
	// (POST /groups/batch-update)
	PostGroupsBatchUpdate(w http.ResponseWriter, r *http.Request)

	// (DELETE /groups/{id})
	DeleteGroupsId(w http.ResponseWriter, r *http.Request, id int64)

	// (GET /groups/{id})
	GetGroupsId(w http.ResponseWriter, r *http.Request, id int64)

	// (PUT /groups/{id})
	PutGroupsId(w http.ResponseWriter, r *http.Request, id int64)
	// 读取组的授予用户与专属倍率(platform_admin;与 PUT 对称,供前端预填充与安全全量写回)
	// (GET /groups/{id}/assignments)
	GetGroupsIdAssignments(w http.ResponseWriter, r *http.Request, id int64)
	// 设置组的授予用户(platform_admin;替换语义:未列出即撤销,空数组 = 清空)
	// (PUT /groups/{id}/assignments)
	PutGroupsIdAssignments(w http.ResponseWriter, r *http.Request, id int64)
	// 密钥列表(platform_admin 专属;脱敏,不含 key 明文——密钥明文绝不下发管理端)
	// (GET /keys)
	GetKeys(w http.ResponseWriter, r *http.Request, params GetKeysParams)
	// 邮件通道测试(SMTP 验证;不触及余额预警事件/阈值/冷却)
	// (POST /mail/channel-test)
	PostMailChannelTest(w http.ResponseWriter, r *http.Request)
	// 邮件模板列表(缺行自动回退内置默认)
	// (GET /mail/templates)
	GetMailTemplates(w http.ResponseWriter, r *http.Request)
	// 更新邮件模板(空 body_text 还原内置默认=删行)
	// (PUT /mail/templates/{purpose})
	PutMailTemplate(w http.ResponseWriter, r *http.Request, purpose string)
	// 运维观测(worker 状态 + 快照注册表)
	// (GET /ops/workers)
	GetOpsWorkers(w http.ResponseWriter, r *http.Request)
	// 管理端总览(summary USD + trend 日桶 + 账号健康 + 资源 + err_top + 计费告警)
	// (GET /overview)
	GetAdminOverview(w http.ResponseWriter, r *http.Request, params GetAdminOverviewParams)
	// 统一价格列表(分页+筛选)
	// (GET /prices)
	GetPrices(w http.ResponseWriter, r *http.Request, params GetPricesParams)

	// (DELETE /prices/entry)
	DeletePriceEntry(w http.ResponseWriter, r *http.Request, params DeletePriceEntryParams)
	// 单条价格查询
	// (GET /prices/entry)
	GetPriceEntry(w http.ResponseWriter, r *http.Request, params GetPriceEntryParams)
	// 手动设价(upsert)
	// (PUT /prices/entry)
	PutPriceEntry(w http.ResponseWriter, r *http.Request, params PutPriceEntryParams)
	// 清空变体
	// (DELETE /prices/variants)
	DeletePriceVariants(w http.ResponseWriter, r *http.Request, params DeletePriceVariantsParams)
	// 变体列表(seq 升序)
	// (GET /prices/variants)
	GetPriceVariants(w http.ResponseWriter, r *http.Request, params GetPriceVariantsParams)
	// 整体替换变体(seq 升序首匹配)
	// (PUT /prices/variants)
	PutPriceVariants(w http.ResponseWriter, r *http.Request, params PutPriceVariantsParams)
	// 手动触发一次价格同步(fetch 官方价格表 → upsert → 快照重载;失败保留旧价)
	// (POST /pricing/sync)
	PostPricingSync(w http.ResponseWriter, r *http.Request)
	// 预览价格同步(零写库 diff 报告)
	// (POST /pricing/sync/preview)
	PostPricingSyncPreview(w http.ResponseWriter, r *http.Request)
	// 兑换码列表(增强分页范式 page/page_size;type/status 筛选;sort 白名单)
	// (GET /redemption-codes)
	GetRedemptionCodes(w http.ResponseWriter, r *http.Request, params GetRedemptionCodesParams)
	// 生成兑换码(1..count 个;count 默认 1,上限 1000;type 枚举/value>0/temp_balance 必填 resource_expires_at)
	// (POST /redemption-codes)
	PostRedemptionCodes(w http.ResponseWriter, r *http.Request)
	// 批量失效兑换码(单事务;已失效 no-op;缺失 id → 404 含缺失详情)
	// (POST /redemption-codes/batch-deactivate)
	PostRedemptionCodesBatchDeactivate(w http.ResponseWriter, r *http.Request)
	// 单码失效(已失效 no-op;缺失 → 404)
	// (POST /redemption-codes/{id}/deactivate)
	PostRedemptionCodesIdDeactivate(w http.ResponseWriter, r *http.Request, id int64)
	// 某码的兑换记录(审计;码缺失 → 404)
	// (GET /redemption-codes/{id}/uses)
	GetRedemptionCodesIdUses(w http.ResponseWriter, r *http.Request, id int64, params GetRedemptionCodesIdUsesParams)
	// 路由 flow 聚合(完整链边;按 terminal_at 归属窗口)
	// (GET /routing/flow)
	GetRoutingFlow(w http.ResponseWriter, r *http.Request, params GetRoutingFlowParams)
	// 质量-成本前沿(rollup 质量 × 当前计划候选目录连接)
	// (GET /routing/frontier)
	GetRoutingFrontier(w http.ResponseWriter, r *http.Request, params GetRoutingFrontierParams)
	// 当前发布路由计划解释(只读投影,无历史 generation 参数)
	// (GET /routing/plan)
	GetRoutingPlan(w http.ResponseWriter, r *http.Request, params GetRoutingPlanParams)
	// 规则列表(enabled 过滤,priority 升序)
	// (GET /rules)
	ListRules(w http.ResponseWriter, r *http.Request, params ListRulesParams)
	// 创建规则
	// (POST /rules)
	CreateRule(w http.ResponseWriter, r *http.Request)
	// 批量删除规则(事务,全成或全败)
	// (POST /rules/batch-delete)
	PostRulesBatchDelete(w http.ResponseWriter, r *http.Request)
	// 删除规则
	// (DELETE /rules/{id})
	DeleteRule(w http.ResponseWriter, r *http.Request, id int64)
	// 更新规则(fields 任意子集,未提供字段保持原值)
	// (PUT /rules/{id})
	UpdateRule(w http.ResponseWriter, r *http.Request, id int64)
	// 全部设置(默认值 + DB 覆盖)
	// (GET /settings)
	GetAdminSettings(w http.ResponseWriter, r *http.Request)
	// 更新设置(类型化校验:switch 必须 true/false、number 必须数字)
	// (PUT /settings)
	PutAdminSettings(w http.ResponseWriter, r *http.Request)
	// 统计能力(本部署能查多久——per-deployment 常量)
	// (GET /stats/capabilities)
	GetStatsCapabilities(w http.ResponseWriter, r *http.Request)
	// 实体趋势(entity 卷积)
	// (GET /stats/entity-trend)
	GetStatsEntityTrend(w http.ResponseWriter, r *http.Request, params GetStatsEntityTrendParams)
	// Top 排行(entity 卷积)
	// (GET /stats/top)
	GetStatsTop(w http.ResponseWriter, r *http.Request, params GetStatsTopParams)
	// 趋势聚合(cube/原始行——按请求时区判定)
	// (GET /stats/trend)
	GetStatsTrend(w http.ResponseWriter, r *http.Request, params GetStatsTrendParams)
	// TTFT 聚合(sketch 或 exact)
	// (GET /stats/ttft)
	GetStatsTTFT(w http.ResponseWriter, r *http.Request, params GetStatsTTFTParams)
	// 余额列表(含最晚 available_at / bucket_rows)
	// (GET /supplier/balances)
	GetAdminSupplierBalances(w http.ResponseWriter, r *http.Request, params GetAdminSupplierBalancesParams)
	// 仅 share_bp / freeze_hours(不接受金额)
	// (PATCH /supplier/balances/{uid})
	PatchAdminSupplierBalancesUid(w http.ResponseWriter, r *http.Request, uid int64)
	// 结算单列表(按 status / kind 过滤;pending 是工作台)
	// (GET /supplier/settlements)
	GetAdminSupplierSettlements(w http.ResponseWriter, r *http.Request, params GetAdminSupplierSettlementsParams)
	// 代申请(kind=admin_request;复用同一通道,目标须已有余额行)
	// (POST /supplier/settlements/admin-request)
	PostAdminSupplierSettlementsAdminRequest(w http.ResponseWriter, r *http.Request)
	// pending → approved(CAS)
	// (POST /supplier/settlements/{id}/approve)
	PostAdminSupplierSettlementsIdApprove(w http.ResponseWriter, r *http.Request, id int64)
	// approved → paying(认领 CAS;付款风控门 + 固定收款快照 + payment_key)
	// (POST /supplier/settlements/{id}/claim)
	PostAdminSupplierSettlementsIdClaim(w http.ResponseWriter, r *http.Request, id int64)
	// paying → approved(仅接受「确定未支付」的核验结果;留证)
	// (POST /supplier/settlements/{id}/confirm-failed)
	PostAdminSupplierSettlementsIdConfirmFailed(w http.ResponseWriter, r *http.Request, id int64)
	// 仅 paying → paid(lifetime_paid 累加;不重做风控门)
	// (POST /supplier/settlements/{id}/paid)
	PostAdminSupplierSettlementsIdPaid(w http.ResponseWriter, r *http.Request, id int64)
	// pending|approved → rejected(退还 available;paying 不可 reject)
	// (POST /supplier/settlements/{id}/reject)
	PostAdminSupplierSettlementsIdReject(w http.ResponseWriter, r *http.Request, id int64)
	// 临时额度列表(platform_admin 专属;全量视角含过期/用尽/负扣减行;user_id 筛选;sort 白名单 expires_at/amount/created_at,默认 expires_at asc——FEFO 同序)
	// (GET /temp-balances)
	GetTempBalances(w http.ResponseWriter, r *http.Request, params GetTempBalancesParams)
	// 模板列表(分页/筛选/排序)
	// (GET /templates)
	GetTemplates(w http.ResponseWriter, r *http.Request, params GetTemplatesParams)
	// 创建模板
	// (POST /templates)
	PostTemplates(w http.ResponseWriter, r *http.Request)
	// 批量删除模板(事务,全成或全败)
	// (POST /templates/batch-delete)
	PostTemplatesBatchDelete(w http.ResponseWriter, r *http.Request)
	// 批量更新模板(fields 为任意字段子集)
	// (POST /templates/batch-update)
	PostTemplatesBatchUpdate(w http.ResponseWriter, r *http.Request)

	// (DELETE /templates/{id})
	DeleteTemplatesId(w http.ResponseWriter, r *http.Request, id int64)

	// (GET /templates/{id})
	GetTemplatesId(w http.ResponseWriter, r *http.Request, id int64)

	// (PUT /templates/{id})
	PutTemplatesId(w http.ResponseWriter, r *http.Request, id int64)
	// 读取模板类型化扩展(编辑回显;仅生态三类型模板有 ext 行)
	// (GET /templates/{id}/ext)
	GetTemplatesIdExt(w http.ResponseWriter, r *http.Request, id int64)
	// 幂等写入模板类型化扩展(Create/Update 合一;全列更新含 NULL 清空)
	// (PUT /templates/{id}/ext)
	PutTemplatesIdExt(w http.ResponseWriter, r *http.Request, id int64)
	// 用量明细分页查询(usage_logs 放行路径明细——成功 none + abort 半异常,cost 不限;失败行(4xx/5xx/拒绝)归 /err_logs)
	// (GET /usage_logs)
	GetUsageLogs(w http.ResponseWriter, r *http.Request, params GetUsageLogsParams)
	// 用户列表(platform_admin 专属;分页/筛选/排序)
	// (GET /users)
	GetUsers(w http.ResponseWriter, r *http.Request, params GetUsersParams)
	// 创建用户(platform_admin 专属;email 唯一/格式、密码 ≤72 字节)
	// (POST /users)
	PostUsers(w http.ResponseWriter, r *http.Request)
	// 实时在途并发排行 TopN(本实例视角)
	// (GET /users-top)
	GetAdminUsersTop(w http.ResponseWriter, r *http.Request, params GetAdminUsersTopParams)
	// 更新用户(role/status/max_concurrency/balance;变更即时生效——Auth 快照刷新)
	// (PUT /users/{id})
	PutUsersId(w http.ResponseWriter, r *http.Request, id int64)
	// 某用户的余额变动记录(platform_admin 专属;永久余额的非 usage 变动:注册默认/管理面创建/管理面调整/兑换码;分页)
	// (GET /users/{id}/balance-logs)
	GetUsersIdBalanceLogs(w http.ResponseWriter, r *http.Request, id int64, params GetUsersIdBalanceLogsParams)
	// 读取用户被授予的分组与各专属倍率(platform_admin;用户视角,与 /groups/{id}/assignments 对称)
	// (GET /users/{id}/groups)
	GetUsersIdGroups(w http.ResponseWriter, r *http.Request, id int64)
	// 设置用户的授予分组(platform_admin;替换语义:未列出即撤销,空数组 = 清空)
	// (PUT /users/{id}/groups)
	PutUsersIdGroups(w http.ResponseWriter, r *http.Request, id int64)
}

ServerInterface represents all server handlers.

type ServerInterfaceWrapper

type ServerInterfaceWrapper struct {
	Handler            ServerInterface
	HandlerMiddlewares []MiddlewareFunc
	ErrorHandlerFunc   func(w http.ResponseWriter, r *http.Request, err error)
}

ServerInterfaceWrapper converts contexts to parameters.

func (*ServerInterfaceWrapper) CreateRule

func (siw *ServerInterfaceWrapper) CreateRule(w http.ResponseWriter, r *http.Request)

CreateRule operation middleware

func (*ServerInterfaceWrapper) DeleteAccountsId

func (siw *ServerInterfaceWrapper) DeleteAccountsId(w http.ResponseWriter, r *http.Request)

DeleteAccountsId operation middleware

func (*ServerInterfaceWrapper) DeleteGroupsId

func (siw *ServerInterfaceWrapper) DeleteGroupsId(w http.ResponseWriter, r *http.Request)

DeleteGroupsId operation middleware

func (*ServerInterfaceWrapper) DeletePriceEntry

func (siw *ServerInterfaceWrapper) DeletePriceEntry(w http.ResponseWriter, r *http.Request)

DeletePriceEntry operation middleware

func (*ServerInterfaceWrapper) DeletePriceVariants

func (siw *ServerInterfaceWrapper) DeletePriceVariants(w http.ResponseWriter, r *http.Request)

DeletePriceVariants operation middleware

func (*ServerInterfaceWrapper) DeleteRule

func (siw *ServerInterfaceWrapper) DeleteRule(w http.ResponseWriter, r *http.Request)

DeleteRule operation middleware

func (*ServerInterfaceWrapper) DeleteTemplatesId

func (siw *ServerInterfaceWrapper) DeleteTemplatesId(w http.ResponseWriter, r *http.Request)

DeleteTemplatesId operation middleware

func (*ServerInterfaceWrapper) GetAccounts

func (siw *ServerInterfaceWrapper) GetAccounts(w http.ResponseWriter, r *http.Request)

GetAccounts operation middleware

func (*ServerInterfaceWrapper) GetAccountsId

func (siw *ServerInterfaceWrapper) GetAccountsId(w http.ResponseWriter, r *http.Request)

GetAccountsId operation middleware

func (*ServerInterfaceWrapper) GetAccountsIdExt

func (siw *ServerInterfaceWrapper) GetAccountsIdExt(w http.ResponseWriter, r *http.Request)

GetAccountsIdExt operation middleware

func (*ServerInterfaceWrapper) GetAccountsIdGroups

func (siw *ServerInterfaceWrapper) GetAccountsIdGroups(w http.ResponseWriter, r *http.Request)

GetAccountsIdGroups operation middleware

func (*ServerInterfaceWrapper) GetAccountsUsage

func (siw *ServerInterfaceWrapper) GetAccountsUsage(w http.ResponseWriter, r *http.Request)

GetAccountsUsage operation middleware

func (*ServerInterfaceWrapper) GetAdminOverview

func (siw *ServerInterfaceWrapper) GetAdminOverview(w http.ResponseWriter, r *http.Request)

GetAdminOverview operation middleware

func (*ServerInterfaceWrapper) GetAdminSettings

func (siw *ServerInterfaceWrapper) GetAdminSettings(w http.ResponseWriter, r *http.Request)

GetAdminSettings operation middleware

func (*ServerInterfaceWrapper) GetAdminSupplierBalances

func (siw *ServerInterfaceWrapper) GetAdminSupplierBalances(w http.ResponseWriter, r *http.Request)

GetAdminSupplierBalances operation middleware

func (*ServerInterfaceWrapper) GetAdminSupplierSettlements

func (siw *ServerInterfaceWrapper) GetAdminSupplierSettlements(w http.ResponseWriter, r *http.Request)

GetAdminSupplierSettlements operation middleware

func (*ServerInterfaceWrapper) GetAdminUsersTop

func (siw *ServerInterfaceWrapper) GetAdminUsersTop(w http.ResponseWriter, r *http.Request)

GetAdminUsersTop operation middleware

func (*ServerInterfaceWrapper) GetErrLogs

func (siw *ServerInterfaceWrapper) GetErrLogs(w http.ResponseWriter, r *http.Request)

GetErrLogs operation middleware

func (*ServerInterfaceWrapper) GetGroups

func (siw *ServerInterfaceWrapper) GetGroups(w http.ResponseWriter, r *http.Request)

GetGroups operation middleware

func (*ServerInterfaceWrapper) GetGroupsId

func (siw *ServerInterfaceWrapper) GetGroupsId(w http.ResponseWriter, r *http.Request)

GetGroupsId operation middleware

func (*ServerInterfaceWrapper) GetGroupsIdAssignments

func (siw *ServerInterfaceWrapper) GetGroupsIdAssignments(w http.ResponseWriter, r *http.Request)

GetGroupsIdAssignments operation middleware

func (*ServerInterfaceWrapper) GetKeys

GetKeys operation middleware

func (*ServerInterfaceWrapper) GetMailTemplates

func (siw *ServerInterfaceWrapper) GetMailTemplates(w http.ResponseWriter, r *http.Request)

GetMailTemplates operation middleware

func (*ServerInterfaceWrapper) GetOpsWorkers

func (siw *ServerInterfaceWrapper) GetOpsWorkers(w http.ResponseWriter, r *http.Request)

GetOpsWorkers operation middleware

func (*ServerInterfaceWrapper) GetPriceEntry

func (siw *ServerInterfaceWrapper) GetPriceEntry(w http.ResponseWriter, r *http.Request)

GetPriceEntry operation middleware

func (*ServerInterfaceWrapper) GetPriceVariants

func (siw *ServerInterfaceWrapper) GetPriceVariants(w http.ResponseWriter, r *http.Request)

GetPriceVariants operation middleware

func (*ServerInterfaceWrapper) GetPrices

func (siw *ServerInterfaceWrapper) GetPrices(w http.ResponseWriter, r *http.Request)

GetPrices operation middleware

func (*ServerInterfaceWrapper) GetRedemptionCodes

func (siw *ServerInterfaceWrapper) GetRedemptionCodes(w http.ResponseWriter, r *http.Request)

GetRedemptionCodes operation middleware

func (*ServerInterfaceWrapper) GetRedemptionCodesIdUses

func (siw *ServerInterfaceWrapper) GetRedemptionCodesIdUses(w http.ResponseWriter, r *http.Request)

GetRedemptionCodesIdUses operation middleware

func (*ServerInterfaceWrapper) GetRoutingFlow

func (siw *ServerInterfaceWrapper) GetRoutingFlow(w http.ResponseWriter, r *http.Request)

GetRoutingFlow operation middleware

func (*ServerInterfaceWrapper) GetRoutingFrontier

func (siw *ServerInterfaceWrapper) GetRoutingFrontier(w http.ResponseWriter, r *http.Request)

GetRoutingFrontier operation middleware

func (*ServerInterfaceWrapper) GetRoutingPlan

func (siw *ServerInterfaceWrapper) GetRoutingPlan(w http.ResponseWriter, r *http.Request)

GetRoutingPlan operation middleware

func (*ServerInterfaceWrapper) GetStatsCapabilities

func (siw *ServerInterfaceWrapper) GetStatsCapabilities(w http.ResponseWriter, r *http.Request)

GetStatsCapabilities operation middleware

func (*ServerInterfaceWrapper) GetStatsEntityTrend

func (siw *ServerInterfaceWrapper) GetStatsEntityTrend(w http.ResponseWriter, r *http.Request)

GetStatsEntityTrend operation middleware

func (*ServerInterfaceWrapper) GetStatsTTFT

func (siw *ServerInterfaceWrapper) GetStatsTTFT(w http.ResponseWriter, r *http.Request)

GetStatsTTFT operation middleware

func (*ServerInterfaceWrapper) GetStatsTop

func (siw *ServerInterfaceWrapper) GetStatsTop(w http.ResponseWriter, r *http.Request)

GetStatsTop operation middleware

func (*ServerInterfaceWrapper) GetStatsTrend

func (siw *ServerInterfaceWrapper) GetStatsTrend(w http.ResponseWriter, r *http.Request)

GetStatsTrend operation middleware

func (*ServerInterfaceWrapper) GetTempBalances

func (siw *ServerInterfaceWrapper) GetTempBalances(w http.ResponseWriter, r *http.Request)

GetTempBalances operation middleware

func (*ServerInterfaceWrapper) GetTemplates

func (siw *ServerInterfaceWrapper) GetTemplates(w http.ResponseWriter, r *http.Request)

GetTemplates operation middleware

func (*ServerInterfaceWrapper) GetTemplatesId

func (siw *ServerInterfaceWrapper) GetTemplatesId(w http.ResponseWriter, r *http.Request)

GetTemplatesId operation middleware

func (*ServerInterfaceWrapper) GetTemplatesIdExt

func (siw *ServerInterfaceWrapper) GetTemplatesIdExt(w http.ResponseWriter, r *http.Request)

GetTemplatesIdExt operation middleware

func (*ServerInterfaceWrapper) GetUsageLogs

func (siw *ServerInterfaceWrapper) GetUsageLogs(w http.ResponseWriter, r *http.Request)

GetUsageLogs operation middleware

func (*ServerInterfaceWrapper) GetUsers

func (siw *ServerInterfaceWrapper) GetUsers(w http.ResponseWriter, r *http.Request)

GetUsers operation middleware

func (*ServerInterfaceWrapper) GetUsersIdBalanceLogs

func (siw *ServerInterfaceWrapper) GetUsersIdBalanceLogs(w http.ResponseWriter, r *http.Request)

GetUsersIdBalanceLogs operation middleware

func (*ServerInterfaceWrapper) GetUsersIdGroups

func (siw *ServerInterfaceWrapper) GetUsersIdGroups(w http.ResponseWriter, r *http.Request)

GetUsersIdGroups operation middleware

func (*ServerInterfaceWrapper) ListRules

func (siw *ServerInterfaceWrapper) ListRules(w http.ResponseWriter, r *http.Request)

ListRules operation middleware

func (*ServerInterfaceWrapper) PatchAccountsId

func (siw *ServerInterfaceWrapper) PatchAccountsId(w http.ResponseWriter, r *http.Request)

PatchAccountsId operation middleware

func (*ServerInterfaceWrapper) PatchAdminSupplierBalancesUid

func (siw *ServerInterfaceWrapper) PatchAdminSupplierBalancesUid(w http.ResponseWriter, r *http.Request)

PatchAdminSupplierBalancesUid operation middleware

func (*ServerInterfaceWrapper) PostAccounts

func (siw *ServerInterfaceWrapper) PostAccounts(w http.ResponseWriter, r *http.Request)

PostAccounts operation middleware

func (*ServerInterfaceWrapper) PostAccountsBatchDelete

func (siw *ServerInterfaceWrapper) PostAccountsBatchDelete(w http.ResponseWriter, r *http.Request)

PostAccountsBatchDelete operation middleware

func (*ServerInterfaceWrapper) PostAccountsBatchImportCodexOauth

func (siw *ServerInterfaceWrapper) PostAccountsBatchImportCodexOauth(w http.ResponseWriter, r *http.Request)

PostAccountsBatchImportCodexOauth operation middleware

func (*ServerInterfaceWrapper) PostAccountsBatchImportCodexPat

func (siw *ServerInterfaceWrapper) PostAccountsBatchImportCodexPat(w http.ResponseWriter, r *http.Request)

PostAccountsBatchImportCodexPat operation middleware

func (*ServerInterfaceWrapper) PostAccountsBatchUpdate

func (siw *ServerInterfaceWrapper) PostAccountsBatchUpdate(w http.ResponseWriter, r *http.Request)

PostAccountsBatchUpdate operation middleware

func (*ServerInterfaceWrapper) PostAccountsIdRecover

func (siw *ServerInterfaceWrapper) PostAccountsIdRecover(w http.ResponseWriter, r *http.Request)

PostAccountsIdRecover operation middleware

func (*ServerInterfaceWrapper) PostAdminSupplierSettlementsAdminRequest

func (siw *ServerInterfaceWrapper) PostAdminSupplierSettlementsAdminRequest(w http.ResponseWriter, r *http.Request)

PostAdminSupplierSettlementsAdminRequest operation middleware

func (*ServerInterfaceWrapper) PostAdminSupplierSettlementsIdApprove

func (siw *ServerInterfaceWrapper) PostAdminSupplierSettlementsIdApprove(w http.ResponseWriter, r *http.Request)

PostAdminSupplierSettlementsIdApprove operation middleware

func (*ServerInterfaceWrapper) PostAdminSupplierSettlementsIdClaim

func (siw *ServerInterfaceWrapper) PostAdminSupplierSettlementsIdClaim(w http.ResponseWriter, r *http.Request)

PostAdminSupplierSettlementsIdClaim operation middleware

func (*ServerInterfaceWrapper) PostAdminSupplierSettlementsIdConfirmFailed

func (siw *ServerInterfaceWrapper) PostAdminSupplierSettlementsIdConfirmFailed(w http.ResponseWriter, r *http.Request)

PostAdminSupplierSettlementsIdConfirmFailed operation middleware

func (*ServerInterfaceWrapper) PostAdminSupplierSettlementsIdPaid

func (siw *ServerInterfaceWrapper) PostAdminSupplierSettlementsIdPaid(w http.ResponseWriter, r *http.Request)

PostAdminSupplierSettlementsIdPaid operation middleware

func (*ServerInterfaceWrapper) PostAdminSupplierSettlementsIdReject

func (siw *ServerInterfaceWrapper) PostAdminSupplierSettlementsIdReject(w http.ResponseWriter, r *http.Request)

PostAdminSupplierSettlementsIdReject operation middleware

func (*ServerInterfaceWrapper) PostGroups

func (siw *ServerInterfaceWrapper) PostGroups(w http.ResponseWriter, r *http.Request)

PostGroups operation middleware

func (*ServerInterfaceWrapper) PostGroupsBatchDelete

func (siw *ServerInterfaceWrapper) PostGroupsBatchDelete(w http.ResponseWriter, r *http.Request)

PostGroupsBatchDelete operation middleware

func (*ServerInterfaceWrapper) PostGroupsBatchUpdate

func (siw *ServerInterfaceWrapper) PostGroupsBatchUpdate(w http.ResponseWriter, r *http.Request)

PostGroupsBatchUpdate operation middleware

func (*ServerInterfaceWrapper) PostMailChannelTest

func (siw *ServerInterfaceWrapper) PostMailChannelTest(w http.ResponseWriter, r *http.Request)

PostMailChannelTest operation middleware

func (*ServerInterfaceWrapper) PostPricingSync

func (siw *ServerInterfaceWrapper) PostPricingSync(w http.ResponseWriter, r *http.Request)

PostPricingSync operation middleware

func (*ServerInterfaceWrapper) PostPricingSyncPreview

func (siw *ServerInterfaceWrapper) PostPricingSyncPreview(w http.ResponseWriter, r *http.Request)

PostPricingSyncPreview operation middleware

func (*ServerInterfaceWrapper) PostRedemptionCodes

func (siw *ServerInterfaceWrapper) PostRedemptionCodes(w http.ResponseWriter, r *http.Request)

PostRedemptionCodes operation middleware

func (*ServerInterfaceWrapper) PostRedemptionCodesBatchDeactivate

func (siw *ServerInterfaceWrapper) PostRedemptionCodesBatchDeactivate(w http.ResponseWriter, r *http.Request)

PostRedemptionCodesBatchDeactivate operation middleware

func (*ServerInterfaceWrapper) PostRedemptionCodesIdDeactivate

func (siw *ServerInterfaceWrapper) PostRedemptionCodesIdDeactivate(w http.ResponseWriter, r *http.Request)

PostRedemptionCodesIdDeactivate operation middleware

func (*ServerInterfaceWrapper) PostRulesBatchDelete

func (siw *ServerInterfaceWrapper) PostRulesBatchDelete(w http.ResponseWriter, r *http.Request)

PostRulesBatchDelete operation middleware

func (*ServerInterfaceWrapper) PostTemplates

func (siw *ServerInterfaceWrapper) PostTemplates(w http.ResponseWriter, r *http.Request)

PostTemplates operation middleware

func (*ServerInterfaceWrapper) PostTemplatesBatchDelete

func (siw *ServerInterfaceWrapper) PostTemplatesBatchDelete(w http.ResponseWriter, r *http.Request)

PostTemplatesBatchDelete operation middleware

func (*ServerInterfaceWrapper) PostTemplatesBatchUpdate

func (siw *ServerInterfaceWrapper) PostTemplatesBatchUpdate(w http.ResponseWriter, r *http.Request)

PostTemplatesBatchUpdate operation middleware

func (*ServerInterfaceWrapper) PostUsers

func (siw *ServerInterfaceWrapper) PostUsers(w http.ResponseWriter, r *http.Request)

PostUsers operation middleware

func (*ServerInterfaceWrapper) PutAccountsIdExt

func (siw *ServerInterfaceWrapper) PutAccountsIdExt(w http.ResponseWriter, r *http.Request)

PutAccountsIdExt operation middleware

func (*ServerInterfaceWrapper) PutAdminSettings

func (siw *ServerInterfaceWrapper) PutAdminSettings(w http.ResponseWriter, r *http.Request)

PutAdminSettings operation middleware

func (*ServerInterfaceWrapper) PutGroupsId

func (siw *ServerInterfaceWrapper) PutGroupsId(w http.ResponseWriter, r *http.Request)

PutGroupsId operation middleware

func (*ServerInterfaceWrapper) PutGroupsIdAssignments

func (siw *ServerInterfaceWrapper) PutGroupsIdAssignments(w http.ResponseWriter, r *http.Request)

PutGroupsIdAssignments operation middleware

func (*ServerInterfaceWrapper) PutMailTemplate

func (siw *ServerInterfaceWrapper) PutMailTemplate(w http.ResponseWriter, r *http.Request)

PutMailTemplate operation middleware

func (*ServerInterfaceWrapper) PutPriceEntry

func (siw *ServerInterfaceWrapper) PutPriceEntry(w http.ResponseWriter, r *http.Request)

PutPriceEntry operation middleware

func (*ServerInterfaceWrapper) PutPriceVariants

func (siw *ServerInterfaceWrapper) PutPriceVariants(w http.ResponseWriter, r *http.Request)

PutPriceVariants operation middleware

func (*ServerInterfaceWrapper) PutTemplatesId

func (siw *ServerInterfaceWrapper) PutTemplatesId(w http.ResponseWriter, r *http.Request)

PutTemplatesId operation middleware

func (*ServerInterfaceWrapper) PutTemplatesIdExt

func (siw *ServerInterfaceWrapper) PutTemplatesIdExt(w http.ResponseWriter, r *http.Request)

PutTemplatesIdExt operation middleware

func (*ServerInterfaceWrapper) PutUsersId

func (siw *ServerInterfaceWrapper) PutUsersId(w http.ResponseWriter, r *http.Request)

PutUsersId operation middleware

func (*ServerInterfaceWrapper) PutUsersIdGroups

func (siw *ServerInterfaceWrapper) PutUsersIdGroups(w http.ResponseWriter, r *http.Request)

PutUsersIdGroups operation middleware

func (*ServerInterfaceWrapper) UpdateRule

func (siw *ServerInterfaceWrapper) UpdateRule(w http.ResponseWriter, r *http.Request)

UpdateRule operation middleware

type Setting

type Setting struct {
	Key       *string      `json:"Key,omitempty"`
	Type      *SettingType `json:"Type,omitempty"`
	UpdatedAt *time.Time   `json:"UpdatedAt,omitempty"`
	Value     *string      `json:"Value,omitempty"`
}

Setting defines model for Setting.

type SettingType

type SettingType string

SettingType defines model for Setting.Type.

const (
	Number SettingType = "number"
	String SettingType = "string"
	Switch SettingType = "switch"
)

Defines values for SettingType.

type SettingUpdate

type SettingUpdate struct {
	Key   string `json:"key"`
	Value string `json:"value"`
}

SettingUpdate defines model for SettingUpdate.

type SettlementClaimBody

type SettlementClaimBody struct {
	// AmountMillis 认领金额,必须 == 单据 amount_millis(不符 ⇒ 400)
	AmountMillis  int64 `json:"amount_millis"`
	SettlementRev int64 `json:"expected_revision"`

	// PayeeSnapshot 收款目标快照(结构化;副作用前固定、重试复用、不一致拒绝)
	PayeeSnapshot SettlementPayeeSnapshot `json:"payee_snapshot"`

	// RiskEvidence 风险核对证据(结构化;reference/摘要非空 + 绑定 approved revision;服务端派生 operator_id/decided_at/scope/decision/expires_at)
	RiskEvidence SettlementRiskEvidence `json:"risk_evidence"`
}

SettlementClaimBody 认领付款;金额必须等于单据金额 + 结构化收款目标快照固定 + 风险核对证据(服务端派生 operator_id/decided_at/expires_at)

type SettlementConfirmFailedBody

type SettlementConfirmFailedBody struct {
	// ConfirmedNotPaid 渠道/人工已核验「确定未支付」
	ConfirmedNotPaid bool `json:"confirmed_not_paid"`

	// Evidence 核验证据 reference(非空)
	Evidence      string `json:"evidence"`
	SettlementRev int64  `json:"expected_revision"`

	// OldExecutionStopped 已确认旧外部执行已停止(回收/等待/具名确认)
	OldExecutionStopped bool `json:"old_execution_stopped"`

	// Reason 确定未支付的原因(网络失败不算)
	Reason string `json:"reason"`
}

SettlementConfirmFailedBody paying→approved;仅接受结构化「确定未支付」+「旧执行已停止」核验(未知 ⇒ 失败闭合保留 paying)

type SettlementPaidBody

type SettlementPaidBody struct {
	SettlementRev int64 `json:"expected_revision"`

	// ExternalRef 银行/渠道回单号(非空)
	ExternalRef string `json:"external_ref"`
}

SettlementPaidBody 仅 paying→paid;必须提供非空银行/渠道回单号(未核验不得确认)

type SettlementPayeeSnapshot

type SettlementPayeeSnapshot struct {
	// Account 收款账号
	Account string `json:"account"`

	// PayeeName 收款人/开户名
	PayeeName string `json:"payee_name"`

	// Unit 金额单位/币种
	Unit string `json:"unit"`
}

SettlementPayeeSnapshot 收款目标快照(结构化;副作用前固定、重试复用、不一致拒绝)

type SettlementRejectBody

type SettlementRejectBody struct {
	SettlementRev int64   `json:"expected_revision"`
	Reason        *string `json:"reason"`
}

SettlementRejectBody defines model for SettlementRejectBody.

type SettlementRiskEvidence

type SettlementRiskEvidence struct {
	// ApprovedRevision 必须 == expected_revision(锁内当前 approved revision)
	ApprovedRevision int64 `json:"approved_revision"`

	// Reference 证据 reference(非空)
	Reference string `json:"reference"`

	// Summary 核对摘要(非空)
	Summary string `json:"summary"`
}

SettlementRiskEvidence 风险核对证据(结构化;reference/摘要非空 + 绑定 approved revision;服务端派生 operator_id/decided_at/scope/decision/expires_at)

type SettlementTransitionBody

type SettlementTransitionBody struct {
	SettlementRev int64 `json:"expected_revision"`
}

SettlementTransitionBody 状态迁移 CAS 令牌(陈旧 ⇒ 409;缺席 ⇒ 400)

type SnapshotState

type SnapshotState struct {
	// LastError 最近一次 reload 错误文本;缺省 = 成功
	LastError  *string   `json:"last_error,omitempty"`
	LastReload time.Time `json:"last_reload"`
	Name       string    `json:"name"`

	// Scopes 声明的变更 scope;null = 纯启动/状态快照
	Scopes *[]string `json:"scopes,omitempty"`
}

SnapshotState defines model for SnapshotState.

type StatTTFTSummary

type StatTTFTSummary struct {
	AvgMS  float64               `json:"AvgMS"`
	Count  int64                 `json:"Count"`
	MaxMS  int64                 `json:"MaxMS"`
	P50MS  int64                 `json:"P50MS"`
	P95MS  int64                 `json:"P95MS"`
	P99MS  int64                 `json:"P99MS"`
	Source StatTTFTSummarySource `json:"Source"`
}

StatTTFTSummary defines model for StatTTFTSummary.

type StatTTFTSummarySource

type StatTTFTSummarySource string

StatTTFTSummarySource defines model for StatTTFTSummary.Source.

const (
	Exact  StatTTFTSummarySource = "exact"
	Sketch StatTTFTSummarySource = "sketch"
)

Defines values for StatTTFTSummarySource.

type StatTopEntry

type StatTopEntry struct {
	CacheCreationTokens *int64 `json:"CacheCreationTokens,omitempty"`
	CacheReadTokens     *int64 `json:"CacheReadTokens,omitempty"`
	CallCount           *int64 `json:"CallCount,omitempty"`

	// Cost 成本 USD(毫分 /1e5)
	Cost         *float64                `json:"Cost,omitempty"`
	EntityID     *int64                  `json:"EntityID,omitempty"`
	EntityType   *StatTopEntryEntityType `json:"EntityType,omitempty"`
	ErrorCount   *int64                  `json:"ErrorCount,omitempty"`
	InputTokens  *int64                  `json:"InputTokens,omitempty"`
	OutputTokens *int64                  `json:"OutputTokens,omitempty"`

	// RawCost 原始成本 USD(毫分 /1e5)
	RawCost      *float64 `json:"RawCost,omitempty"`
	RequestCount *int64   `json:"RequestCount,omitempty"`
	TTFTAvgMS    *float64 `json:"TTFTAvgMS,omitempty"`
	TTFTMaxMS    *int64   `json:"TTFTMaxMS,omitempty"`
	TotalTokens  *int64   `json:"TotalTokens,omitempty"`
}

StatTopEntry defines model for StatTopEntry.

type StatTopEntryEntityType

type StatTopEntryEntityType string

StatTopEntryEntityType defines model for StatTopEntry.EntityType.

const (
	StatTopEntryEntityTypeAccount StatTopEntryEntityType = "account"
	StatTopEntryEntityTypeKey     StatTopEntryEntityType = "key"
	StatTopEntryEntityTypeUser    StatTopEntryEntityType = "user"
)

Defines values for StatTopEntryEntityType.

type StatTrendPoint

type StatTrendPoint struct {
	BucketTime          *time.Time `json:"BucketTime,omitempty"`
	CacheCreationTokens *int64     `json:"CacheCreationTokens,omitempty"`
	CacheReadTokens     *int64     `json:"CacheReadTokens,omitempty"`
	CallCount           *int64     `json:"CallCount,omitempty"`

	// Cost 成本 USD(毫分 /1e5)
	Cost         *float64 `json:"Cost,omitempty"`
	ErrorCount   *int64   `json:"ErrorCount,omitempty"`
	InputTokens  *int64   `json:"InputTokens,omitempty"`
	OutputTokens *int64   `json:"OutputTokens,omitempty"`

	// RawCost 原始成本 USD(毫分 /1e5)
	RawCost      *float64 `json:"RawCost,omitempty"`
	RequestCount *int64   `json:"RequestCount,omitempty"`

	// TTFTAvgMS TTFT 平均毫秒(TTFTTotalMS/TTFTCount,无样本 0)
	TTFTAvgMS *float64 `json:"TTFTAvgMS,omitempty"`

	// TTFTMaxMS TTFT 最大毫秒
	TTFTMaxMS   *int64 `json:"TTFTMaxMS,omitempty"`
	TotalTokens *int64 `json:"TotalTokens,omitempty"`
}

StatTrendPoint defines model for StatTrendPoint.

type StatsCapabilities

type StatsCapabilities struct {
	// BucketGridSeconds 卷积表桶网格单位(秒;恒 3600 = 1 小时)
	BucketGridSeconds int `json:"bucket_grid_seconds"`

	// Kinds 键 = 读形状标识(trend/entity_trend/summary/days/top/ttft_sketch/ttft_exact/usage_agg/usage_list/errlog_list)
	Kinds map[string]StatsKindCapability `json:"kinds"`
}

StatsCapabilities defines model for StatsCapabilities.

type StatsFrom

type StatsFrom = time.Time

StatsFrom defines model for StatsFrom.

type StatsKindCapability

type StatsKindCapability struct {
	// CostCapSeconds 每候选存储的最大跨度秒数(保留期无关的纯常量;0 = 无上限)
	CostCapSeconds map[string]int64 `json:"cost_cap_seconds"`

	// CoverageDays 每候选存储实际读表的保留天数(读多表取最保守者;0 = 该表未启用分区保留,覆盖守卫关闭)
	CoverageDays map[string]int `json:"coverage_days"`

	// Grouping 读形状的分组模式:`zoned` = 按请求时区分组(桶界随时区变);`none` =
	// 数值与请求时区无关。刻意不写 enum:enum 会为一个取值是 `none` 的字段
	// 生成名为 `None` 的常量,与既有 `ErrorType` 枚举的 `None` 撞名,触发
	// oapi-codegen 把该枚举九个常量全部改名(无关生成的额外改动)。
	Grouping string `json:"grouping"`

	// Storages 候选存储(按偏好序)
	Storages []StatsKindCapabilityStorages `json:"storages"`
}

StatsKindCapability defines model for StatsKindCapability.

type StatsKindCapabilityStorages

type StatsKindCapabilityStorages string

StatsKindCapabilityStorages defines model for StatsKindCapability.Storages.

const (
	StatsKindCapabilityStoragesCube StatsKindCapabilityStorages = "cube"
	StatsKindCapabilityStoragesRaw  StatsKindCapabilityStorages = "raw"
)

Defines values for StatsKindCapabilityStorages.

type StatsProvider

type StatsProvider interface {
	Name() string
	Stats() any
}

StatsProvider worker 可观测状态提供面。

同步义务:改 Stats() 返回的字段(增删改名)必须同步 openapi.yaml WorkerStatus.stats 的字段清单(description),否则契约 文档过期且无人知——清单是消费方(前端/运维脚本)的唯一依据。

type StatsTimezone

type StatsTimezone = string

StatsTimezone defines model for StatsTimezone.

type StatsTo

type StatsTo = time.Time

StatsTo defines model for StatsTo.

type StatsWindow

type StatsWindow = string

StatsWindow defines model for StatsWindow.

type SupplierBalance

type SupplierBalance struct {
	Available         int64      `json:"available"`
	BucketRows        int64      `json:"bucket_rows"`
	FreezeHours       *int       `json:"freeze_hours"`
	LatestAvailableAt *time.Time `json:"latest_available_at"`
	LifetimeCredited  int64      `json:"lifetime_credited"`
	LifetimePaid      int64      `json:"lifetime_paid"`
	ShareBp           *int       `json:"share_bp"`
	SupplierUserId    int64      `json:"supplier_user_id"`
}

SupplierBalance defines model for SupplierBalance.

type SupplierBalanceList

type SupplierBalanceList struct {
	Items []SupplierBalance `json:"items"`
	Total int64             `json:"total"`
}

SupplierBalanceList defines model for SupplierBalanceList.

type SupplierBalancePatchBody

type SupplierBalancePatchBody struct {
	FreezeHours nullable.Nullable[int] `json:"freeze_hours,omitempty"`
	ShareBp     nullable.Nullable[int] `json:"share_bp,omitempty"`
}

SupplierBalancePatchBody PATCH 逐供应商配置(仅 share_bp/freeze_hours;缺席 = 不变;null = 清空回继承)

type SupplierSettlement

type SupplierSettlement struct {
	AmountMillis       int64                  `json:"amount_millis"`
	ExternalRef        *string                `json:"external_ref"`
	Id                 int64                  `json:"id"`
	Kind               SupplierSettlementKind `json:"kind"`
	Note               *string                `json:"note"`
	PaidAt             *time.Time             `json:"paid_at"`
	PaidOperatorUserId *int64                 `json:"paid_operator_user_id"`

	// PayeeSnapshot 固定收款目标快照(结构化 JSON)
	PayeeSnapshot *string `json:"payee_snapshot"`

	// PaymentKey 首次 claim 生成、全局唯一、永久固定的付款键(重试/恢复复用不换键)
	PaymentKey           *string    `json:"payment_key"`
	PayoutFailedAt       *time.Time `json:"payout_failed_at"`
	PayoutFailureReason  *string    `json:"payout_failure_reason"`
	PayoutOperatorUserId *int64     `json:"payout_operator_user_id"`
	PayoutStartedAt      *time.Time `json:"payout_started_at"`
	PeriodEnd            time.Time  `json:"period_end"`
	PeriodStart          time.Time  `json:"period_start"`
	RejectReason         *string    `json:"reject_reason"`
	RequestKey           string     `json:"request_key"`
	RequestedAt          time.Time  `json:"requested_at"`
	RequestedOperator    int64      `json:"requested_operator"`
	ReviewedAt           *time.Time `json:"reviewed_at"`
	ReviewerUserId       *int64     `json:"reviewer_user_id"`
	Revision             int64      `json:"revision"`

	// RiskReview 风险核对记录(结构化 JSON)
	RiskReview     *string                  `json:"risk_review"`
	Status         SupplierSettlementStatus `json:"status"`
	SupplierUserId int64                    `json:"supplier_user_id"`
}

SupplierSettlement defines model for SupplierSettlement.

type SupplierSettlementKind

type SupplierSettlementKind string

SupplierSettlementKind defines model for SupplierSettlement.Kind.

const (
	SupplierSettlementKindAdminRequest    SupplierSettlementKind = "admin_request"
	SupplierSettlementKindSupplierRequest SupplierSettlementKind = "supplier_request"
)

Defines values for SupplierSettlementKind.

type SupplierSettlementList

type SupplierSettlementList struct {
	Items []SupplierSettlement `json:"items"`
	Total int64                `json:"total"`
}

SupplierSettlementList defines model for SupplierSettlementList.

type SupplierSettlementStatus

type SupplierSettlementStatus string

SupplierSettlementStatus defines model for SupplierSettlement.Status.

const (
	SupplierSettlementStatusApproved SupplierSettlementStatus = "approved"
	SupplierSettlementStatusPaid     SupplierSettlementStatus = "paid"
	SupplierSettlementStatusPaying   SupplierSettlementStatus = "paying"
	SupplierSettlementStatusPending  SupplierSettlementStatus = "pending"
	SupplierSettlementStatusRejected SupplierSettlementStatus = "rejected"
)

Defines values for SupplierSettlementStatus.

type Template

type Template struct {
	// BaseURL credential-type conditional: codex-oauth/codex-pat always empty (non-empty forbidden); api_key/responses-special may include a protocol prefix such as /zen but must not end in /v1 (non-empty override, or empty for default/route failure)
	BaseURL   string    `json:"BaseURL"`
	CreatedAt time.Time `json:"CreatedAt"`

	// CredentialType 模板号池类型;生态三类型只支持 resp / resp-ws / images / search 格式
	CredentialType *TemplateCredentialType `json:"CredentialType,omitempty"`

	// DeletedAt 软删除时间戳;null = 存活(列表过滤已删;GET 单个可查已删项)
	DeletedAt        *time.Time                    `json:"DeletedAt"`
	FormatModels     *map[string][]string          `json:"FormatModels,omitempty"`
	ID               int64                         `json:"ID"`
	ModelMapping     *map[string]ModelMappingEntry `json:"ModelMapping,omitempty"`
	Models           *[]string                     `json:"Models,omitempty"`
	Name             string                        `json:"Name"`
	SupportedFormats []TemplateSupportedFormats    `json:"SupportedFormats"`
	UpdatedAt        time.Time                     `json:"UpdatedAt"`
}

Template defines model for Template.

type TemplateCreate

type TemplateCreate struct {
	// BaseUrl credential-type conditional: codex-oauth/codex-pat must be empty (non-empty forbidden, SDK default endpoint); api_key/responses-special may include a protocol prefix such as /zen but must not end in /v1 (the gateway appends /v1; non-empty overrides, empty uses default or fails to route)
	BaseUrl          *string                          `json:"base_url,omitempty"`
	CredentialType   *TemplateCreateCredentialType    `json:"credential_type,omitempty"`
	FormatModels     *map[string][]string             `json:"format_models,omitempty"`
	ModelMapping     *map[string]ModelMappingEntry    `json:"model_mapping,omitempty"`
	Models           *[]string                        `json:"models,omitempty"`
	Name             string                           `json:"name"`
	SupportedFormats []TemplateCreateSupportedFormats `json:"supported_formats"`
}

TemplateCreate defines model for TemplateCreate.

type TemplateCreateCredentialType

type TemplateCreateCredentialType string

TemplateCreateCredentialType defines model for TemplateCreate.CredentialType.

const (
	TemplateCreateCredentialTypeApiKey           TemplateCreateCredentialType = "api_key"
	TemplateCreateCredentialTypeCodexOauth       TemplateCreateCredentialType = "codex-oauth"
	TemplateCreateCredentialTypeCodexPat         TemplateCreateCredentialType = "codex-pat"
	TemplateCreateCredentialTypeResponsesSpecial TemplateCreateCredentialType = "responses-special"
)

Defines values for TemplateCreateCredentialType.

type TemplateCreateSupportedFormats

type TemplateCreateSupportedFormats string

TemplateCreateSupportedFormats defines model for TemplateCreate.SupportedFormats.

const (
	TemplateCreateSupportedFormatsAnthropic         TemplateCreateSupportedFormats = "anthropic"
	TemplateCreateSupportedFormatsOpenaiChat        TemplateCreateSupportedFormats = "openai-chat"
	TemplateCreateSupportedFormatsOpenaiImages      TemplateCreateSupportedFormats = "openai-images"
	TemplateCreateSupportedFormatsOpenaiResponses   TemplateCreateSupportedFormats = "openai-responses"
	TemplateCreateSupportedFormatsOpenaiResponsesWs TemplateCreateSupportedFormats = "openai-responses-ws"
	TemplateCreateSupportedFormatsOpenaiSearch      TemplateCreateSupportedFormats = "openai-search"
)

Defines values for TemplateCreateSupportedFormats.

type TemplateCredentialType

type TemplateCredentialType string

TemplateCredentialType 模板号池类型;生态三类型只支持 resp / resp-ws / images / search 格式

const (
	TemplateCredentialTypeApiKey           TemplateCredentialType = "api_key"
	TemplateCredentialTypeCodexOauth       TemplateCredentialType = "codex-oauth"
	TemplateCredentialTypeCodexPat         TemplateCredentialType = "codex-pat"
	TemplateCredentialTypeResponsesSpecial TemplateCredentialType = "responses-special"
)

Defines values for TemplateCredentialType.

type TemplateExt

type TemplateExt struct {
	// CredentialType 类型声明;必须与父模板 credential_type 一致(不一致 → 400)
	CredentialType TemplateExtCredentialType `json:"credential_type"`

	// StripImageTools 三类型公共能力开关:模板级图像 tool 剥离(NULL = 未配置 = 关闭)
	StripImageTools *bool  `json:"strip_image_tools"`
	TemplateId      *int64 `json:"template_id,omitempty"`
}

TemplateExt defines model for TemplateExt.

type TemplateExtCredentialType

type TemplateExtCredentialType string

TemplateExtCredentialType 类型声明;必须与父模板 credential_type 一致(不一致 → 400)

const (
	TemplateExtCredentialTypeCodexOauth       TemplateExtCredentialType = "codex-oauth"
	TemplateExtCredentialTypeCodexPat         TemplateExtCredentialType = "codex-pat"
	TemplateExtCredentialTypeResponsesSpecial TemplateExtCredentialType = "responses-special"
)

Defines values for TemplateExtCredentialType.

type TemplateListResponse

type TemplateListResponse struct {
	Rows  []Template `json:"rows"`
	Total int64      `json:"total"`
}

TemplateListResponse defines model for TemplateListResponse.

type TemplatePatch

type TemplatePatch struct {
	// BaseUrl credential-type conditional: codex-oauth/codex-pat must be empty (non-empty forbidden); api_key/responses-special optional override, protocol prefix allowed, must not end in /v1
	BaseUrl          *string                          `json:"base_url,omitempty"`
	FormatModels     *map[string][]string             `json:"format_models,omitempty"`
	ModelMapping     *map[string]ModelMappingEntry    `json:"model_mapping,omitempty"`
	Models           *[]string                        `json:"models,omitempty"`
	Name             *string                          `json:"name,omitempty"`
	SupportedFormats *[]TemplatePatchSupportedFormats `json:"supported_formats,omitempty"`
}

TemplatePatch defines model for TemplatePatch.

type TemplatePatchSupportedFormats

type TemplatePatchSupportedFormats string

TemplatePatchSupportedFormats defines model for TemplatePatch.SupportedFormats.

const (
	Anthropic         TemplatePatchSupportedFormats = "anthropic"
	OpenaiChat        TemplatePatchSupportedFormats = "openai-chat"
	OpenaiImages      TemplatePatchSupportedFormats = "openai-images"
	OpenaiResponses   TemplatePatchSupportedFormats = "openai-responses"
	OpenaiResponsesWs TemplatePatchSupportedFormats = "openai-responses-ws"
	OpenaiSearch      TemplatePatchSupportedFormats = "openai-search"
)

Defines values for TemplatePatchSupportedFormats.

type TemplateSupportedFormats

type TemplateSupportedFormats string

TemplateSupportedFormats defines model for Template.SupportedFormats.

const (
	TemplateSupportedFormatsAnthropic         TemplateSupportedFormats = "anthropic"
	TemplateSupportedFormatsOpenaiChat        TemplateSupportedFormats = "openai-chat"
	TemplateSupportedFormatsOpenaiImages      TemplateSupportedFormats = "openai-images"
	TemplateSupportedFormatsOpenaiResponses   TemplateSupportedFormats = "openai-responses"
	TemplateSupportedFormatsOpenaiResponsesWs TemplateSupportedFormats = "openai-responses-ws"
	TemplateSupportedFormatsOpenaiSearch      TemplateSupportedFormats = "openai-search"
)

Defines values for TemplateSupportedFormats.

type TooManyValuesForParamError

type TooManyValuesForParamError struct {
	ParamName string
	Count     int
}

func (*TooManyValuesForParamError) Error

type UnescapedCookieParamError

type UnescapedCookieParamError struct {
	ParamName string
	Err       error
}

func (*UnescapedCookieParamError) Error

func (e *UnescapedCookieParamError) Error() string

func (*UnescapedCookieParamError) Unwrap

func (e *UnescapedCookieParamError) Unwrap() error

type Unimplemented

type Unimplemented struct{}

func (Unimplemented) CreateRule

func (_ Unimplemented) CreateRule(w http.ResponseWriter, r *http.Request)

创建规则 (POST /rules)

func (Unimplemented) DeleteAccountsId

func (_ Unimplemented) DeleteAccountsId(w http.ResponseWriter, r *http.Request, id int64)

(DELETE /accounts/{id})

func (Unimplemented) DeleteGroupsId

func (_ Unimplemented) DeleteGroupsId(w http.ResponseWriter, r *http.Request, id int64)

(DELETE /groups/{id})

func (Unimplemented) DeletePriceEntry

func (_ Unimplemented) DeletePriceEntry(w http.ResponseWriter, r *http.Request, params DeletePriceEntryParams)

(DELETE /prices/entry)

func (Unimplemented) DeletePriceVariants

func (_ Unimplemented) DeletePriceVariants(w http.ResponseWriter, r *http.Request, params DeletePriceVariantsParams)

清空变体 (DELETE /prices/variants)

func (Unimplemented) DeleteRule

func (_ Unimplemented) DeleteRule(w http.ResponseWriter, r *http.Request, id int64)

删除规则 (DELETE /rules/{id})

func (Unimplemented) DeleteTemplatesId

func (_ Unimplemented) DeleteTemplatesId(w http.ResponseWriter, r *http.Request, id int64)

(DELETE /templates/{id})

func (Unimplemented) GetAccounts

func (_ Unimplemented) GetAccounts(w http.ResponseWriter, r *http.Request, params GetAccountsParams)

账号列表(分页/筛选/排序,含运行时视图) (GET /accounts)

func (Unimplemented) GetAccountsId

func (_ Unimplemented) GetAccountsId(w http.ResponseWriter, r *http.Request, id int64)

(GET /accounts/{id})

func (Unimplemented) GetAccountsIdExt

func (_ Unimplemented) GetAccountsIdExt(w http.ResponseWriter, r *http.Request, id int64)

读取账号类型化鉴权扩展(编辑回显;仅 codex-oauth/codex-pat 账号有 ext 行) (GET /accounts/{id}/ext)

func (Unimplemented) GetAccountsIdGroups

func (_ Unimplemented) GetAccountsIdGroups(w http.ResponseWriter, r *http.Request, id int64)

读取账号的全部分组 id(编辑回显;不随账号列表返回) (GET /accounts/{id}/groups)

func (Unimplemented) GetAccountsUsage

func (_ Unimplemented) GetAccountsUsage(w http.ResponseWriter, r *http.Request, params GetAccountsUsageParams)

账号用量聚合(统一 usage API——批量 ≤100 条;窗口 from/to 或 window 恰择一) (GET /accounts/usage)

func (Unimplemented) GetAdminOverview

func (_ Unimplemented) GetAdminOverview(w http.ResponseWriter, r *http.Request, params GetAdminOverviewParams)

管理端总览(summary USD + trend 日桶 + 账号健康 + 资源 + err_top + 计费告警) (GET /overview)

func (Unimplemented) GetAdminSettings

func (_ Unimplemented) GetAdminSettings(w http.ResponseWriter, r *http.Request)

全部设置(默认值 + DB 覆盖) (GET /settings)

func (Unimplemented) GetAdminSupplierBalances

func (_ Unimplemented) GetAdminSupplierBalances(w http.ResponseWriter, r *http.Request, params GetAdminSupplierBalancesParams)

余额列表(含最晚 available_at / bucket_rows) (GET /supplier/balances)

func (Unimplemented) GetAdminSupplierSettlements

func (_ Unimplemented) GetAdminSupplierSettlements(w http.ResponseWriter, r *http.Request, params GetAdminSupplierSettlementsParams)

结算单列表(按 status / kind 过滤;pending 是工作台) (GET /supplier/settlements)

func (Unimplemented) GetAdminUsersTop

func (_ Unimplemented) GetAdminUsersTop(w http.ResponseWriter, r *http.Request, params GetAdminUsersTopParams)

实时在途并发排行 TopN(本实例视角) (GET /users-top)

func (Unimplemented) GetErrLogs

func (_ Unimplemented) GetErrLogs(w http.ResponseWriter, r *http.Request, params GetErrLogsParams)

错误明细分页查询(err_logs 完整错误面:本地拒绝 + 半异常双轨;status_code/error_type 全值) (GET /err_logs)

func (Unimplemented) GetGroups

func (_ Unimplemented) GetGroups(w http.ResponseWriter, r *http.Request, params GetGroupsParams)

分组列表(分页/筛选/排序) (GET /groups)

func (Unimplemented) GetGroupsId

func (_ Unimplemented) GetGroupsId(w http.ResponseWriter, r *http.Request, id int64)

(GET /groups/{id})

func (Unimplemented) GetGroupsIdAssignments

func (_ Unimplemented) GetGroupsIdAssignments(w http.ResponseWriter, r *http.Request, id int64)

读取组的授予用户与专属倍率(platform_admin;与 PUT 对称,供前端预填充与安全全量写回) (GET /groups/{id}/assignments)

func (Unimplemented) GetKeys

func (_ Unimplemented) GetKeys(w http.ResponseWriter, r *http.Request, params GetKeysParams)

密钥列表(platform_admin 专属;脱敏,不含 key 明文——密钥明文绝不下发管理端) (GET /keys)

func (Unimplemented) GetMailTemplates

func (_ Unimplemented) GetMailTemplates(w http.ResponseWriter, r *http.Request)

邮件模板列表(缺行自动回退内置默认) (GET /mail/templates)

func (Unimplemented) GetOpsWorkers

func (_ Unimplemented) GetOpsWorkers(w http.ResponseWriter, r *http.Request)

运维观测(worker 状态 + 快照注册表) (GET /ops/workers)

func (Unimplemented) GetPriceEntry

func (_ Unimplemented) GetPriceEntry(w http.ResponseWriter, r *http.Request, params GetPriceEntryParams)

单条价格查询 (GET /prices/entry)

func (Unimplemented) GetPriceVariants

func (_ Unimplemented) GetPriceVariants(w http.ResponseWriter, r *http.Request, params GetPriceVariantsParams)

变体列表(seq 升序) (GET /prices/variants)

func (Unimplemented) GetPrices

func (_ Unimplemented) GetPrices(w http.ResponseWriter, r *http.Request, params GetPricesParams)

统一价格列表(分页+筛选) (GET /prices)

func (Unimplemented) GetRedemptionCodes

func (_ Unimplemented) GetRedemptionCodes(w http.ResponseWriter, r *http.Request, params GetRedemptionCodesParams)

兑换码列表(增强分页范式 page/page_size;type/status 筛选;sort 白名单) (GET /redemption-codes)

func (Unimplemented) GetRedemptionCodesIdUses

func (_ Unimplemented) GetRedemptionCodesIdUses(w http.ResponseWriter, r *http.Request, id int64, params GetRedemptionCodesIdUsesParams)

某码的兑换记录(审计;码缺失 → 404) (GET /redemption-codes/{id}/uses)

func (Unimplemented) GetRoutingFlow

func (_ Unimplemented) GetRoutingFlow(w http.ResponseWriter, r *http.Request, params GetRoutingFlowParams)

路由 flow 聚合(完整链边;按 terminal_at 归属窗口) (GET /routing/flow)

func (Unimplemented) GetRoutingFrontier

func (_ Unimplemented) GetRoutingFrontier(w http.ResponseWriter, r *http.Request, params GetRoutingFrontierParams)

质量-成本前沿(rollup 质量 × 当前计划候选目录连接) (GET /routing/frontier)

func (Unimplemented) GetRoutingPlan

func (_ Unimplemented) GetRoutingPlan(w http.ResponseWriter, r *http.Request, params GetRoutingPlanParams)

当前发布路由计划解释(只读投影,无历史 generation 参数) (GET /routing/plan)

func (Unimplemented) GetStatsCapabilities

func (_ Unimplemented) GetStatsCapabilities(w http.ResponseWriter, r *http.Request)

统计能力(本部署能查多久——per-deployment 常量) (GET /stats/capabilities)

func (Unimplemented) GetStatsEntityTrend

func (_ Unimplemented) GetStatsEntityTrend(w http.ResponseWriter, r *http.Request, params GetStatsEntityTrendParams)

实体趋势(entity 卷积) (GET /stats/entity-trend)

func (Unimplemented) GetStatsTTFT

func (_ Unimplemented) GetStatsTTFT(w http.ResponseWriter, r *http.Request, params GetStatsTTFTParams)

TTFT 聚合(sketch 或 exact) (GET /stats/ttft)

func (Unimplemented) GetStatsTop

func (_ Unimplemented) GetStatsTop(w http.ResponseWriter, r *http.Request, params GetStatsTopParams)

Top 排行(entity 卷积) (GET /stats/top)

func (Unimplemented) GetStatsTrend

func (_ Unimplemented) GetStatsTrend(w http.ResponseWriter, r *http.Request, params GetStatsTrendParams)

趋势聚合(cube/原始行——按请求时区判定) (GET /stats/trend)

func (Unimplemented) GetTempBalances

func (_ Unimplemented) GetTempBalances(w http.ResponseWriter, r *http.Request, params GetTempBalancesParams)

临时额度列表(platform_admin 专属;全量视角含过期/用尽/负扣减行;user_id 筛选;sort 白名单 expires_at/amount/created_at,默认 expires_at asc——FEFO 同序) (GET /temp-balances)

func (Unimplemented) GetTemplates

func (_ Unimplemented) GetTemplates(w http.ResponseWriter, r *http.Request, params GetTemplatesParams)

模板列表(分页/筛选/排序) (GET /templates)

func (Unimplemented) GetTemplatesId

func (_ Unimplemented) GetTemplatesId(w http.ResponseWriter, r *http.Request, id int64)

(GET /templates/{id})

func (Unimplemented) GetTemplatesIdExt

func (_ Unimplemented) GetTemplatesIdExt(w http.ResponseWriter, r *http.Request, id int64)

读取模板类型化扩展(编辑回显;仅生态三类型模板有 ext 行) (GET /templates/{id}/ext)

func (Unimplemented) GetUsageLogs

func (_ Unimplemented) GetUsageLogs(w http.ResponseWriter, r *http.Request, params GetUsageLogsParams)

用量明细分页查询(usage_logs 放行路径明细——成功 none + abort 半异常,cost 不限;失败行(4xx/5xx/拒绝)归 /err_logs) (GET /usage_logs)

func (Unimplemented) GetUsers

func (_ Unimplemented) GetUsers(w http.ResponseWriter, r *http.Request, params GetUsersParams)

用户列表(platform_admin 专属;分页/筛选/排序) (GET /users)

func (Unimplemented) GetUsersIdBalanceLogs

func (_ Unimplemented) GetUsersIdBalanceLogs(w http.ResponseWriter, r *http.Request, id int64, params GetUsersIdBalanceLogsParams)

某用户的余额变动记录(platform_admin 专属;永久余额的非 usage 变动:注册默认/管理面创建/管理面调整/兑换码;分页) (GET /users/{id}/balance-logs)

func (Unimplemented) GetUsersIdGroups

func (_ Unimplemented) GetUsersIdGroups(w http.ResponseWriter, r *http.Request, id int64)

读取用户被授予的分组与各专属倍率(platform_admin;用户视角,与 /groups/{id}/assignments 对称) (GET /users/{id}/groups)

func (Unimplemented) ListRules

func (_ Unimplemented) ListRules(w http.ResponseWriter, r *http.Request, params ListRulesParams)

规则列表(enabled 过滤,priority 升序) (GET /rules)

func (Unimplemented) PatchAccountsId

func (_ Unimplemented) PatchAccountsId(w http.ResponseWriter, r *http.Request, id int64, params PatchAccountsIdParams)

部分更新账号(三态:缺省=不变;可空标量 null=清空、""=400;不可空标量 null=400;有值=落值) (PATCH /accounts/{id})

func (Unimplemented) PatchAdminSupplierBalancesUid

func (_ Unimplemented) PatchAdminSupplierBalancesUid(w http.ResponseWriter, r *http.Request, uid int64)

仅 share_bp / freeze_hours(不接受金额) (PATCH /supplier/balances/{uid})

func (Unimplemented) PostAccounts

func (_ Unimplemented) PostAccounts(w http.ResponseWriter, r *http.Request)

创建账号 (POST /accounts)

func (Unimplemented) PostAccountsBatchDelete

func (_ Unimplemented) PostAccountsBatchDelete(w http.ResponseWriter, r *http.Request)

批量删除账号(事务,全成或全败) (POST /accounts/batch-delete)

func (Unimplemented) PostAccountsBatchImportCodexOauth

func (_ Unimplemented) PostAccountsBatchImportCodexOauth(w http.ResponseWriter, r *http.Request)

批量导入 codex-oauth 凭据(幂等组合键 codex_email + codex_account_id;items ≤100 原始条数;行级失败不毁整批) (POST /accounts/batch-import-codex-oauth)

func (Unimplemented) PostAccountsBatchImportCodexPat

func (_ Unimplemented) PostAccountsBatchImportCodexPat(w http.ResponseWriter, r *http.Request)

批量导入 codex-pat 凭据(幂等组合键 codex_email + codex_account_id;items ≤100 原始条数;行级失败不毁整批) (POST /accounts/batch-import-codex-pat)

func (Unimplemented) PostAccountsBatchUpdate

func (_ Unimplemented) PostAccountsBatchUpdate(w http.ResponseWriter, r *http.Request)

批量更新账号(fields 为任意字段子集) (POST /accounts/batch-update)

func (Unimplemented) PostAccountsIdRecover

func (_ Unimplemented) PostAccountsIdRecover(w http.ResponseWriter, r *http.Request, id int64)

失效恢复(fenced):清 failed_at/last_error/failure_source + revision CAS +1 → 新代际置 PROBING 待探针 (POST /accounts/{id}/recover)

func (Unimplemented) PostAdminSupplierSettlementsAdminRequest

func (_ Unimplemented) PostAdminSupplierSettlementsAdminRequest(w http.ResponseWriter, r *http.Request)

代申请(kind=admin_request;复用同一通道,目标须已有余额行) (POST /supplier/settlements/admin-request)

func (Unimplemented) PostAdminSupplierSettlementsIdApprove

func (_ Unimplemented) PostAdminSupplierSettlementsIdApprove(w http.ResponseWriter, r *http.Request, id int64)

pending → approved(CAS) (POST /supplier/settlements/{id}/approve)

func (Unimplemented) PostAdminSupplierSettlementsIdClaim

func (_ Unimplemented) PostAdminSupplierSettlementsIdClaim(w http.ResponseWriter, r *http.Request, id int64)

approved → paying(认领 CAS;付款风控门 + 固定收款快照 + payment_key) (POST /supplier/settlements/{id}/claim)

func (Unimplemented) PostAdminSupplierSettlementsIdConfirmFailed

func (_ Unimplemented) PostAdminSupplierSettlementsIdConfirmFailed(w http.ResponseWriter, r *http.Request, id int64)

paying → approved(仅接受「确定未支付」的核验结果;留证) (POST /supplier/settlements/{id}/confirm-failed)

func (Unimplemented) PostAdminSupplierSettlementsIdPaid

func (_ Unimplemented) PostAdminSupplierSettlementsIdPaid(w http.ResponseWriter, r *http.Request, id int64)

仅 paying → paid(lifetime_paid 累加;不重做风控门) (POST /supplier/settlements/{id}/paid)

func (Unimplemented) PostAdminSupplierSettlementsIdReject

func (_ Unimplemented) PostAdminSupplierSettlementsIdReject(w http.ResponseWriter, r *http.Request, id int64)

pending|approved → rejected(退还 available;paying 不可 reject) (POST /supplier/settlements/{id}/reject)

func (Unimplemented) PostGroups

func (_ Unimplemented) PostGroups(w http.ResponseWriter, r *http.Request)

创建分组(平台容量池;key 为独立表,由用户面 /user/keys 创建) (POST /groups)

func (Unimplemented) PostGroupsBatchDelete

func (_ Unimplemented) PostGroupsBatchDelete(w http.ResponseWriter, r *http.Request)

批量删除分组(事务,全成或全败) (POST /groups/batch-delete)

func (Unimplemented) PostGroupsBatchUpdate

func (_ Unimplemented) PostGroupsBatchUpdate(w http.ResponseWriter, r *http.Request)

批量更新分组(fields 为任意字段子集) (POST /groups/batch-update)

func (Unimplemented) PostMailChannelTest

func (_ Unimplemented) PostMailChannelTest(w http.ResponseWriter, r *http.Request)

邮件通道测试(SMTP 验证;不触及余额预警事件/阈值/冷却) (POST /mail/channel-test)

func (Unimplemented) PostPricingSync

func (_ Unimplemented) PostPricingSync(w http.ResponseWriter, r *http.Request)

手动触发一次价格同步(fetch 官方价格表 → upsert → 快照重载;失败保留旧价) (POST /pricing/sync)

func (Unimplemented) PostPricingSyncPreview

func (_ Unimplemented) PostPricingSyncPreview(w http.ResponseWriter, r *http.Request)

预览价格同步(零写库 diff 报告) (POST /pricing/sync/preview)

func (Unimplemented) PostRedemptionCodes

func (_ Unimplemented) PostRedemptionCodes(w http.ResponseWriter, r *http.Request)

生成兑换码(1..count 个;count 默认 1,上限 1000;type 枚举/value>0/temp_balance 必填 resource_expires_at) (POST /redemption-codes)

func (Unimplemented) PostRedemptionCodesBatchDeactivate

func (_ Unimplemented) PostRedemptionCodesBatchDeactivate(w http.ResponseWriter, r *http.Request)

批量失效兑换码(单事务;已失效 no-op;缺失 id → 404 含缺失详情) (POST /redemption-codes/batch-deactivate)

func (Unimplemented) PostRedemptionCodesIdDeactivate

func (_ Unimplemented) PostRedemptionCodesIdDeactivate(w http.ResponseWriter, r *http.Request, id int64)

单码失效(已失效 no-op;缺失 → 404) (POST /redemption-codes/{id}/deactivate)

func (Unimplemented) PostRulesBatchDelete

func (_ Unimplemented) PostRulesBatchDelete(w http.ResponseWriter, r *http.Request)

批量删除规则(事务,全成或全败) (POST /rules/batch-delete)

func (Unimplemented) PostTemplates

func (_ Unimplemented) PostTemplates(w http.ResponseWriter, r *http.Request)

创建模板 (POST /templates)

func (Unimplemented) PostTemplatesBatchDelete

func (_ Unimplemented) PostTemplatesBatchDelete(w http.ResponseWriter, r *http.Request)

批量删除模板(事务,全成或全败) (POST /templates/batch-delete)

func (Unimplemented) PostTemplatesBatchUpdate

func (_ Unimplemented) PostTemplatesBatchUpdate(w http.ResponseWriter, r *http.Request)

批量更新模板(fields 为任意字段子集) (POST /templates/batch-update)

func (Unimplemented) PostUsers

func (_ Unimplemented) PostUsers(w http.ResponseWriter, r *http.Request)

创建用户(platform_admin 专属;email 唯一/格式、密码 ≤72 字节) (POST /users)

func (Unimplemented) PutAccountsIdExt

func (_ Unimplemented) PutAccountsIdExt(w http.ResponseWriter, r *http.Request, id int64)

幂等写入账号类型化鉴权扩展(Create/Update 合一;全列更新含 NULL 清空) (PUT /accounts/{id}/ext)

func (Unimplemented) PutAdminSettings

func (_ Unimplemented) PutAdminSettings(w http.ResponseWriter, r *http.Request)

更新设置(类型化校验:switch 必须 true/false、number 必须数字) (PUT /settings)

func (Unimplemented) PutGroupsId

func (_ Unimplemented) PutGroupsId(w http.ResponseWriter, r *http.Request, id int64)

(PUT /groups/{id})

func (Unimplemented) PutGroupsIdAssignments

func (_ Unimplemented) PutGroupsIdAssignments(w http.ResponseWriter, r *http.Request, id int64)

设置组的授予用户(platform_admin;替换语义:未列出即撤销,空数组 = 清空) (PUT /groups/{id}/assignments)

func (Unimplemented) PutMailTemplate

func (_ Unimplemented) PutMailTemplate(w http.ResponseWriter, r *http.Request, purpose string)

更新邮件模板(空 body_text 还原内置默认=删行) (PUT /mail/templates/{purpose})

func (Unimplemented) PutPriceEntry

func (_ Unimplemented) PutPriceEntry(w http.ResponseWriter, r *http.Request, params PutPriceEntryParams)

手动设价(upsert) (PUT /prices/entry)

func (Unimplemented) PutPriceVariants

func (_ Unimplemented) PutPriceVariants(w http.ResponseWriter, r *http.Request, params PutPriceVariantsParams)

整体替换变体(seq 升序首匹配) (PUT /prices/variants)

func (Unimplemented) PutTemplatesId

func (_ Unimplemented) PutTemplatesId(w http.ResponseWriter, r *http.Request, id int64)

(PUT /templates/{id})

func (Unimplemented) PutTemplatesIdExt

func (_ Unimplemented) PutTemplatesIdExt(w http.ResponseWriter, r *http.Request, id int64)

幂等写入模板类型化扩展(Create/Update 合一;全列更新含 NULL 清空) (PUT /templates/{id}/ext)

func (Unimplemented) PutUsersId

func (_ Unimplemented) PutUsersId(w http.ResponseWriter, r *http.Request, id int64)

更新用户(role/status/max_concurrency/balance;变更即时生效——Auth 快照刷新) (PUT /users/{id})

func (Unimplemented) PutUsersIdGroups

func (_ Unimplemented) PutUsersIdGroups(w http.ResponseWriter, r *http.Request, id int64)

设置用户的授予分组(platform_admin;替换语义:未列出即撤销,空数组 = 清空) (PUT /users/{id}/groups)

func (Unimplemented) UpdateRule

func (_ Unimplemented) UpdateRule(w http.ResponseWriter, r *http.Request, id int64)

更新规则(fields 任意子集,未提供字段保持原值) (PUT /rules/{id})

type UnmarshalingParamError

type UnmarshalingParamError struct {
	ParamName string
	Err       error
}

func (*UnmarshalingParamError) Error

func (e *UnmarshalingParamError) Error() string

func (*UnmarshalingParamError) Unwrap

func (e *UnmarshalingParamError) Unwrap() error

type UpdateRuleJSONRequestBody

type UpdateRuleJSONRequestBody = RulePatch

UpdateRuleJSONRequestBody defines body for UpdateRule for application/json ContentType.

type UsageGatewayStats

type UsageGatewayStats struct {
	// CostUsd 计费成本(USD,毫分 /1e5)
	CostUsd float64 `json:"cost_usd"`

	// RawCostUsd 乘倍率前原始成本(USD,毫分 /1e5)
	RawCostUsd float64 `json:"raw_cost_usd"`

	// Requests 请求数(COUNT(*))
	Requests int64 `json:"requests"`

	// TotalTokens 总 token(SUM(total_tokens))
	TotalTokens int64 `json:"total_tokens"`
}

UsageGatewayStats 账号网关计费聚合(usage_logs 实时明细;毫分 /1e5 → USD;无记录账号全 0)

type UsageLog

type UsageLog struct {
	// AboveHit 任一分量超 above 阈值命中分段
	AboveHit  *bool  `json:"AboveHit,omitempty"`
	AccountID *int64 `json:"AccountID,omitempty"`

	// BillingTier 请求 service_tier 归一化值(priority/flex/fast/auto);空 = 未计费路径
	BillingTier         *string `json:"BillingTier,omitempty"`
	CacheCreationTokens *int64  `json:"CacheCreationTokens,omitempty"`
	CacheReadTokens     *int64  `json:"CacheReadTokens,omitempty"`

	// ClientIP 客户端 IP(CF-Connecting-IP / True-Client-IP / X-Real-IP 按序识别;无则 RemoteAddr 剥端口);空 = 无
	ClientIP *string `json:"ClientIP,omitempty"`

	// Cost 计费成本(毫分,1 USD = 100,000 毫分);错误请求(402/4xx)为 0
	Cost        *int64         `json:"Cost,omitempty"`
	CreatedAt   *time.Time     `json:"CreatedAt,omitempty"`
	ErrorType   *ErrorType     `json:"ErrorType,omitempty"`
	Format      *RequestFormat `json:"Format,omitempty"`
	GroupID     *int64         `json:"GroupID,omitempty"`
	ID          *int64         `json:"ID,omitempty"`
	InputTokens *int64         `json:"InputTokens,omitempty"`

	// KeyID 鉴权归属 key;0 = 无
	KeyID        *int64  `json:"KeyID,omitempty"`
	LatencyMS    *int64  `json:"LatencyMS,omitempty"`
	MappedModel  *string `json:"MappedModel"`
	Model        *string `json:"Model,omitempty"`
	OutputTokens *int64  `json:"OutputTokens,omitempty"`

	// Overdraft 本次扣费透支(余额不足扣为负余额)
	Overdraft *bool `json:"Overdraft,omitempty"`

	// PriceCacheCreationMillis 缓存写单价快照(每 M token 毫分);null = 该请求无缓存写或无缓存价
	PriceCacheCreationMillis *int64 `json:"PriceCacheCreationMillis"`

	// PriceCacheReadMillis 缓存读单价快照(每 M token 毫分);null = 该请求无缓存读或无缓存价
	PriceCacheReadMillis *int64 `json:"PriceCacheReadMillis"`

	// PriceInputMillis 输入单价快照(每 M token 毫分,1 USD = 100,000 毫分;pricing 同款单位);null = 未计费路径
	PriceInputMillis *int64 `json:"PriceInputMillis"`

	// PriceOutputMillis 输出单价快照(每 M token 毫分);null = 未计费路径
	PriceOutputMillis *int64 `json:"PriceOutputMillis"`

	// RawCost 原始成本(毫分,乘倍率前——免费组 cost=0 但 raw 有值,实际消耗口径);bill 未装配/无价防御路径恒 0
	RawCost   *int64  `json:"RawCost,omitempty"`
	RequestID *string `json:"RequestID,omitempty"`

	// TTFTMS 首 token 时间毫秒(流式首 chunk 采集);非流式/失败/无首 token 路径 = null
	TTFTMS      *int64 `json:"TTFTMS"`
	TemplateID  *int64 `json:"TemplateID,omitempty"`
	TotalTokens *int64 `json:"TotalTokens,omitempty"`

	// UserID 鉴权归属用户;0 = 无
	UserID *int64 `json:"UserID,omitempty"`
}

UsageLog defines model for UsageLog.

type User

type User struct {
	// Balance 余额 USD(浮点;内部存储毫分——1 USD = 100,000 毫分,API 边界换算)
	Balance        *float64    `json:"Balance,omitempty"`
	CreatedAt      *time.Time  `json:"CreatedAt,omitempty"`
	Email          *string     `json:"Email,omitempty"`
	ID             *int64      `json:"ID,omitempty"`
	MaxConcurrency *int        `json:"MaxConcurrency,omitempty"`
	Role           *UserRole   `json:"Role,omitempty"`
	Status         *UserStatus `json:"Status,omitempty"`
	UpdatedAt      *time.Time  `json:"UpdatedAt,omitempty"`
}

User defines model for User.

type UserCreate

type UserCreate struct {
	// Balance 余额 USD(浮点,≥ 0;1 USD = 100,000 毫分)
	Balance *float64 `json:"balance,omitempty"`
	Email   string   `json:"email"`

	// MaxConcurrency 用户级在途上限;0 = 不限
	MaxConcurrency *int        `json:"max_concurrency,omitempty"`
	Password       string      `json:"password"`
	Role           *UserRole   `json:"role,omitempty"`
	Status         *UserStatus `json:"status,omitempty"`
}

UserCreate defines model for UserCreate.

type UserGroupsBody

type UserGroupsBody struct {
	// GroupIds 替换语义:完整授予组列表(未列出即撤销;空数组 = 清空)
	GroupIds []int64 `json:"group_ids"`

	// Multipliers 可选:group_id → 该用户在该组的专属价格倍率(正常值,1 = ×1,0 = 免费,上限 10 = ×10;API 边界与万分数换算)。仅对 group_ids 中列出的组生效;null = 清除为未设置(回退组倍率);未列出的组沿用当前值
	Multipliers *map[string]*float64 `json:"multipliers,omitempty"`
}

UserGroupsBody defines model for UserGroupsBody.

type UserGroupsResponse

type UserGroupsResponse struct {
	GroupIds []int64 `json:"group_ids"`

	// Multipliers 该用户当前各授予组的专属价格倍率(正常值;null/缺省 = 未设置 → 用组倍率)
	Multipliers *map[string]*float64 `json:"multipliers,omitempty"`
}

UserGroupsResponse defines model for UserGroupsResponse.

type UserListResponse

type UserListResponse struct {
	Rows  []User `json:"rows"`
	Total int64  `json:"total"`
}

UserListResponse defines model for UserListResponse.

type UserRole

type UserRole string

UserRole defines model for UserRole.

const (
	UserRolePlatformAdmin UserRole = "platform_admin"
	UserRoleSupplier      UserRole = "supplier"
	UserRoleUser          UserRole = "user"
)

Defines values for UserRole.

type UserStatus

type UserStatus string

UserStatus defines model for UserStatus.

const (
	UserStatusActive   UserStatus = "active"
	UserStatusDisabled UserStatus = "disabled"
)

Defines values for UserStatus.

type UserUpdate

type UserUpdate struct {
	// Balance 余额 USD(浮点,≥ 0;1 USD = 100,000 毫分)
	Balance        *float64    `json:"balance,omitempty"`
	MaxConcurrency *int        `json:"max_concurrency,omitempty"`
	Role           *UserRole   `json:"role,omitempty"`
	Status         *UserStatus `json:"status,omitempty"`
}

UserUpdate defines model for UserUpdate.

type UsersTopEntry

type UsersTopEntry struct {
	// Concurrency 在途请求数
	Concurrency int64 `json:"concurrency"`

	// Email 邮箱(TopN user_id 一次 IN 查询回填;缺失 = 空串)
	Email  string `json:"email"`
	UserId int64  `json:"user_id"`
}

UsersTopEntry 实时在途并发条目(users 表无 name 列——仅 email)

type UsersTopResponse

type UsersTopResponse struct {
	// OtherConcurrency 其余在途用户合计(TopN 之外;非伪用户条目)
	OtherConcurrency int64           `json:"other_concurrency"`
	Users            []UsersTopEntry `json:"users"`
}

UsersTopResponse 实时并发排行(本实例视角;TopN + other 归并)

type WorkerStatus

type WorkerStatus struct {
	Name string `json:"name"`

	// Stats 各 worker 异构观测字段;完整字段清单见本 schema 上方 yaml 注释(与各 worker Stats() 实现同步维护)
	Stats interface{} `json:"stats"`
}

WorkerStatus defines model for WorkerStatus.

type WorkersResponse

type WorkersResponse struct {
	GeneratedAt time.Time       `json:"generated_at"`
	Snapshots   []SnapshotState `json:"snapshots"`
	Workers     []WorkerStatus  `json:"workers"`
}

WorkersResponse defines model for WorkersResponse.

Directories

Path Synopsis
Package httpface 管理面/用户面 HTTP 边界:响应书写(WriteJSON/WriteErr/ WriteServiceErr,service 错误→HTTP 状态映射表唯一一份)+ 请求参数边界 (ClampLimit——两面包共享的分页上限钳制)。
Package httpface 管理面/用户面 HTTP 边界:响应书写(WriteJSON/WriteErr/ WriteServiceErr,service 错误→HTTP 状态映射表唯一一份)+ 请求参数边界 (ClampLimit——两面包共享的分页上限钳制)。
Package supplier provides primitives to interact with the openapi HTTP API.
Package supplier provides primitives to interact with the openapi HTTP API.
Package user provides primitives to interact with the openapi HTTP API.
Package user provides primitives to interact with the openapi HTTP API.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL