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 ¶
- func Handler(si ServerInterface) http.Handler
- func HandlerFromMux(si ServerInterface, r chi.Router) http.Handler
- func HandlerFromMuxWithBaseURL(si ServerInterface, r chi.Router, baseURL string) http.Handler
- func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler
- type Account
- type AccountCreate
- type AccountExt
- type AccountExtCredentialType
- type AccountGroupsResponse
- type AccountListResponse
- type AccountPatch
- type AccountPatchStatus
- type AccountStatus
- type AccountUsageItem
- type AccountUsageItemUpstreamError
- type AccountView
- type AccountsUsageResponse
- type AdminAPI
- func (h *AdminAPI) CreateRule(w http.ResponseWriter, r *http.Request)
- func (h *AdminAPI) DeleteAccountsId(w http.ResponseWriter, r *http.Request, id int64)
- func (h *AdminAPI) DeleteGroupsId(w http.ResponseWriter, r *http.Request, id int64)
- func (h *AdminAPI) DeletePriceEntry(w http.ResponseWriter, r *http.Request, params DeletePriceEntryParams)
- func (h *AdminAPI) DeletePriceVariants(w http.ResponseWriter, r *http.Request, params DeletePriceVariantsParams)
- func (h *AdminAPI) DeleteRule(w http.ResponseWriter, r *http.Request, id int64)
- func (h *AdminAPI) DeleteTemplatesId(w http.ResponseWriter, r *http.Request, id int64)
- func (h *AdminAPI) GetAccounts(w http.ResponseWriter, r *http.Request, params GetAccountsParams)
- func (h *AdminAPI) GetAccountsId(w http.ResponseWriter, r *http.Request, id int64)
- func (h *AdminAPI) GetAccountsIdExt(w http.ResponseWriter, r *http.Request, id int64)
- func (h *AdminAPI) GetAccountsIdGroups(w http.ResponseWriter, r *http.Request, id int64)
- func (h *AdminAPI) GetAccountsUsage(w http.ResponseWriter, r *http.Request, params GetAccountsUsageParams)
- func (h *AdminAPI) GetAdminOverview(w http.ResponseWriter, r *http.Request, params GetAdminOverviewParams)
- func (h *AdminAPI) GetAdminSettings(w http.ResponseWriter, r *http.Request)
- func (h *AdminAPI) GetAdminUsersTop(w http.ResponseWriter, r *http.Request, params GetAdminUsersTopParams)
- func (h *AdminAPI) GetErrLogs(w http.ResponseWriter, r *http.Request, params GetErrLogsParams)
- func (h *AdminAPI) GetGroups(w http.ResponseWriter, r *http.Request, params GetGroupsParams)
- func (h *AdminAPI) GetGroupsId(w http.ResponseWriter, r *http.Request, id int64)
- func (h *AdminAPI) GetGroupsIdAssignments(w http.ResponseWriter, r *http.Request, id int64)
- func (h *AdminAPI) GetKeys(w http.ResponseWriter, r *http.Request, params GetKeysParams)
- func (h *AdminAPI) GetMailTemplates(w http.ResponseWriter, r *http.Request)
- func (h *AdminAPI) GetOpsWorkers(w http.ResponseWriter, r *http.Request)
- func (h *AdminAPI) GetPriceEntry(w http.ResponseWriter, r *http.Request, params GetPriceEntryParams)
- func (h *AdminAPI) GetPriceVariants(w http.ResponseWriter, r *http.Request, params GetPriceVariantsParams)
- func (h *AdminAPI) GetPrices(w http.ResponseWriter, r *http.Request, params GetPricesParams)
- func (h *AdminAPI) GetRedemptionCodes(w http.ResponseWriter, r *http.Request, params GetRedemptionCodesParams)
- func (h *AdminAPI) GetRedemptionCodesIdUses(w http.ResponseWriter, r *http.Request, id int64, ...)
- func (h *AdminAPI) GetStatsEntityTrend(w http.ResponseWriter, r *http.Request, params GetStatsEntityTrendParams)
- func (h *AdminAPI) GetStatsTTFT(w http.ResponseWriter, r *http.Request, params GetStatsTTFTParams)
- func (h *AdminAPI) GetStatsTop(w http.ResponseWriter, r *http.Request, params GetStatsTopParams)
- func (h *AdminAPI) GetStatsTrend(w http.ResponseWriter, r *http.Request, params GetStatsTrendParams)
- func (h *AdminAPI) GetTempBalances(w http.ResponseWriter, r *http.Request, params GetTempBalancesParams)
- func (h *AdminAPI) GetTemplates(w http.ResponseWriter, r *http.Request, params GetTemplatesParams)
- func (h *AdminAPI) GetTemplatesId(w http.ResponseWriter, r *http.Request, id int64)
- func (h *AdminAPI) GetTemplatesIdExt(w http.ResponseWriter, r *http.Request, id int64)
- func (h *AdminAPI) GetUsageLogs(w http.ResponseWriter, r *http.Request, params GetUsageLogsParams)
- func (h *AdminAPI) GetUsers(w http.ResponseWriter, r *http.Request, params GetUsersParams)
- func (h *AdminAPI) GetUsersIdGroups(w http.ResponseWriter, r *http.Request, id int64)
- func (h *AdminAPI) ListRules(w http.ResponseWriter, r *http.Request, params ListRulesParams)
- func (h *AdminAPI) PostAccounts(w http.ResponseWriter, r *http.Request)
- func (h *AdminAPI) PostAccountsBatchDelete(w http.ResponseWriter, r *http.Request)
- func (h *AdminAPI) PostAccountsBatchImportCodexOauth(w http.ResponseWriter, r *http.Request)
- func (h *AdminAPI) PostAccountsBatchImportCodexPat(w http.ResponseWriter, r *http.Request)
- func (h *AdminAPI) PostAccountsBatchResetCooldown(w http.ResponseWriter, r *http.Request)
- func (h *AdminAPI) PostAccountsBatchUpdate(w http.ResponseWriter, r *http.Request)
- func (h *AdminAPI) PostGroups(w http.ResponseWriter, r *http.Request)
- func (h *AdminAPI) PostGroupsBatchDelete(w http.ResponseWriter, r *http.Request)
- func (h *AdminAPI) PostGroupsBatchUpdate(w http.ResponseWriter, r *http.Request)
- func (h *AdminAPI) PostPricingSync(w http.ResponseWriter, r *http.Request)
- func (h *AdminAPI) PostPricingSyncPreview(w http.ResponseWriter, r *http.Request)
- func (h *AdminAPI) PostRedemptionCodes(w http.ResponseWriter, r *http.Request)
- func (h *AdminAPI) PostRedemptionCodesBatchDeactivate(w http.ResponseWriter, r *http.Request)
- func (h *AdminAPI) PostRedemptionCodesIdDeactivate(w http.ResponseWriter, r *http.Request, id int64)
- func (h *AdminAPI) PostRulesBatchDelete(w http.ResponseWriter, r *http.Request)
- func (h *AdminAPI) PostTemplates(w http.ResponseWriter, r *http.Request)
- func (h *AdminAPI) PostTemplatesBatchDelete(w http.ResponseWriter, r *http.Request)
- func (h *AdminAPI) PostTemplatesBatchUpdate(w http.ResponseWriter, r *http.Request)
- func (h *AdminAPI) PostUsers(w http.ResponseWriter, r *http.Request)
- func (h *AdminAPI) PutAccountsId(w http.ResponseWriter, r *http.Request, id int64)
- func (h *AdminAPI) PutAccountsIdExt(w http.ResponseWriter, r *http.Request, id int64)
- func (h *AdminAPI) PutAdminSettings(w http.ResponseWriter, r *http.Request)
- func (h *AdminAPI) PutGroupsId(w http.ResponseWriter, r *http.Request, id int64)
- func (h *AdminAPI) PutGroupsIdAssignments(w http.ResponseWriter, r *http.Request, id int64)
- func (h *AdminAPI) PutMailTemplate(w http.ResponseWriter, r *http.Request, purpose string)
- func (h *AdminAPI) PutPriceEntry(w http.ResponseWriter, r *http.Request, params PutPriceEntryParams)
- func (h *AdminAPI) PutPriceVariants(w http.ResponseWriter, r *http.Request, params PutPriceVariantsParams)
- func (h *AdminAPI) PutTemplatesId(w http.ResponseWriter, r *http.Request, id int64)
- func (h *AdminAPI) PutTemplatesIdExt(w http.ResponseWriter, r *http.Request, id int64)
- func (h *AdminAPI) PutUsersId(w http.ResponseWriter, r *http.Request, id int64)
- func (h *AdminAPI) PutUsersIdGroups(w http.ResponseWriter, r *http.Request, id int64)
- func (h *AdminAPI) Router() http.Handler
- func (h *AdminAPI) RoutesMux() http.Handler
- func (h *AdminAPI) UpdateRule(w http.ResponseWriter, r *http.Request, id int64)
- type AdminKey
- type AdminKeyListResponse
- type AdminTempBalanceRow
- type AdminTempBalancesResponse
- type BatchDeactivateRequest
- type BatchDeactivateResponse
- type BatchDeleteBody
- type BatchDeleteResponse
- type BatchResetCooldownBody
- type BatchResetCooldownResponse
- type BatchUpdateAccountsBody
- type BatchUpdateGroupsBody
- type BatchUpdateResponse
- type BatchUpdateTemplatesBody
- type BillingAlerts
- type ChiServerOptions
- type CodexCredits
- type CodexIdentity
- type CodexOAuthImportBody
- type CodexOAuthImportItem
- type CodexPATImportBody
- type CodexPATImportItem
- type CodexRateLimit
- type CodexSpendControl
- type CodexUsageSnapshot
- type CreateRuleJSONRequestBody
- type DeactivateRequest
- type DeactivateResponse
- type DeletePriceEntryParams
- type DeletePriceVariantsParams
- type DeletedResponse
- type ErrLog
- type ErrLogsResponse
- type Error
- type ErrorResponse
- type ErrorType
- type GenerateRequest
- type GenerateResponse
- type GetAccountsParams
- type GetAccountsParamsOrder
- type GetAccountsUsageParams
- type GetAdminOverviewParams
- type GetAdminUsersTopParams
- type GetErrLogsParams
- type GetGroupsParams
- type GetGroupsParamsOrder
- type GetKeysParams
- type GetKeysParamsOrder
- type GetPriceEntryParams
- type GetPriceVariantsParams
- type GetPricesParams
- type GetPricesParamsMode
- type GetPricesParamsOrder
- type GetPricesParamsSource
- type GetRedemptionCodesIdUsesParams
- type GetRedemptionCodesParams
- type GetRedemptionCodesParamsOrder
- type GetRedemptionCodesParamsStatus
- type GetRedemptionCodesParamsType
- type GetStatsEntityTrendParams
- type GetStatsEntityTrendParamsEntity
- type GetStatsEntityTrendParamsGranularity
- type GetStatsTTFTParams
- type GetStatsTTFTParamsEntity
- type GetStatsTopParams
- type GetStatsTopParamsBy
- type GetStatsTopParamsEntity
- type GetStatsTrendParams
- type GetStatsTrendParamsGranularity
- type GetTempBalancesParams
- type GetTempBalancesParamsOrder
- type GetTemplatesParams
- type GetTemplatesParamsOrder
- type GetUsageLogsParams
- type GetUsersParams
- type GetUsersParamsOrder
- type Group
- type GroupAssignmentsBody
- type GroupAssignmentsResponse
- type GroupCreate
- type GroupListResponse
- type GroupPatch
- type GroupProtocolConvert
- type GroupVisibility
- type ImportFailedItem
- type ImportResult
- type InvalidParamFormatError
- type KeyStatus
- type ListRulesParams
- type LogsResponse
- type MailTemplate
- type MailTemplatePurpose
- type MailTemplateUpdate
- type MiddlewareFunc
- type OpsOptions
- type OverviewAccounts
- type OverviewAlerts
- type OverviewErrTop
- type OverviewResources
- type OverviewResponse
- type OverviewSummary
- type OverviewTrend
- type PostAccountsBatchDeleteJSONRequestBody
- type PostAccountsBatchImportCodexOauthJSONRequestBody
- type PostAccountsBatchImportCodexPatJSONRequestBody
- type PostAccountsBatchResetCooldownJSONRequestBody
- type PostAccountsBatchUpdateJSONRequestBody
- type PostAccountsJSONRequestBody
- type PostGroupsBatchDeleteJSONRequestBody
- type PostGroupsBatchUpdateJSONRequestBody
- type PostGroupsJSONRequestBody
- type PostRedemptionCodesBatchDeactivateJSONRequestBody
- type PostRedemptionCodesIdDeactivateJSONRequestBody
- type PostRedemptionCodesJSONRequestBody
- type PostRulesBatchDeleteJSONRequestBody
- type PostTemplatesBatchDeleteJSONRequestBody
- type PostTemplatesBatchUpdateJSONRequestBody
- type PostTemplatesJSONRequestBody
- type PostUsersJSONRequestBody
- type PriceEntry
- type PriceEntryListResponse
- type PriceEntryMode
- type PriceEntryUpsert
- type PriceEntryUpsertMode
- type PriceVariant
- type PriceVariantListRequest
- type PriceVariantListResponse
- type PriceVariantUpsert
- type PricingPreviewEntry
- type PricingPreviewEntryAction
- type PricingPreviewEntryMode
- type PricingSource
- type PricingSyncPreviewResponse
- type PricingSyncResponse
- type Provider
- type PutAccountsIdExtJSONRequestBody
- type PutAccountsIdJSONRequestBody
- type PutAdminSettingsJSONRequestBody
- type PutGroupsIdAssignmentsJSONRequestBody
- type PutGroupsIdJSONRequestBody
- type PutMailTemplateJSONRequestBody
- type PutPriceEntryJSONRequestBody
- type PutPriceEntryParams
- type PutPriceVariantsJSONRequestBody
- type PutPriceVariantsParams
- type PutTemplatesIdExtJSONRequestBody
- type PutTemplatesIdJSONRequestBody
- type PutUsersIdGroupsJSONRequestBody
- type PutUsersIdJSONRequestBody
- type RedemptionCode
- type RedemptionCodeListResponse
- type RedemptionStatus
- type RedemptionType
- type RedemptionUse
- type RedemptionUseListResponse
- type RequestFormat
- type RequiredHeaderError
- type RequiredParamError
- type Rule
- type RuleCreate
- type RuleListResponse
- type RulePatch
- type ServerInterface
- type ServerInterfaceWrapper
- func (siw *ServerInterfaceWrapper) CreateRule(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) DeleteAccountsId(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) DeleteGroupsId(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) DeletePriceEntry(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) DeletePriceVariants(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) DeleteRule(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) DeleteTemplatesId(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetAccounts(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetAccountsId(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetAccountsIdExt(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetAccountsIdGroups(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetAccountsUsage(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetAdminOverview(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetAdminSettings(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetAdminUsersTop(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetErrLogs(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetGroups(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetGroupsId(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetGroupsIdAssignments(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetKeys(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetMailTemplates(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetOpsWorkers(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetPriceEntry(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetPriceVariants(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetPrices(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetRedemptionCodes(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetRedemptionCodesIdUses(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetStatsEntityTrend(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetStatsTTFT(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetStatsTop(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetStatsTrend(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetTempBalances(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetTemplates(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetTemplatesId(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetTemplatesIdExt(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetUsageLogs(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetUsers(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) GetUsersIdGroups(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) ListRules(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PostAccounts(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PostAccountsBatchDelete(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PostAccountsBatchImportCodexOauth(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PostAccountsBatchImportCodexPat(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PostAccountsBatchResetCooldown(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PostAccountsBatchUpdate(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PostGroups(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PostGroupsBatchDelete(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PostGroupsBatchUpdate(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PostPricingSync(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PostPricingSyncPreview(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PostRedemptionCodes(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PostRedemptionCodesBatchDeactivate(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PostRedemptionCodesIdDeactivate(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PostRulesBatchDelete(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PostTemplates(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PostTemplatesBatchDelete(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PostTemplatesBatchUpdate(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PostUsers(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PutAccountsId(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PutAccountsIdExt(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PutAdminSettings(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PutGroupsId(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PutGroupsIdAssignments(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PutMailTemplate(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PutPriceEntry(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PutPriceVariants(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PutTemplatesId(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PutTemplatesIdExt(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PutUsersId(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) PutUsersIdGroups(w http.ResponseWriter, r *http.Request)
- func (siw *ServerInterfaceWrapper) UpdateRule(w http.ResponseWriter, r *http.Request)
- type Setting
- type SettingType
- type SettingUpdate
- type SnapshotState
- type StatTTFTSummary
- type StatTTFTSummarySource
- type StatTopEntry
- type StatTopEntryEntityType
- type StatTrendPoint
- type StatsProvider
- type Template
- type TemplateCreate
- type TemplateCreateCredentialType
- type TemplateCreateSupportedFormats
- type TemplateCredentialType
- type TemplateExt
- type TemplateExtCredentialType
- type TemplateListResponse
- type TemplatePatch
- type TemplatePatchSupportedFormats
- type TemplateSupportedFormats
- type TooManyValuesForParamError
- type UnescapedCookieParamError
- type Unimplemented
- func (_ Unimplemented) CreateRule(w http.ResponseWriter, r *http.Request)
- func (_ Unimplemented) DeleteAccountsId(w http.ResponseWriter, r *http.Request, id int64)
- func (_ Unimplemented) DeleteGroupsId(w http.ResponseWriter, r *http.Request, id int64)
- func (_ Unimplemented) DeletePriceEntry(w http.ResponseWriter, r *http.Request, params DeletePriceEntryParams)
- func (_ Unimplemented) DeletePriceVariants(w http.ResponseWriter, r *http.Request, params DeletePriceVariantsParams)
- func (_ Unimplemented) DeleteRule(w http.ResponseWriter, r *http.Request, id int64)
- func (_ Unimplemented) DeleteTemplatesId(w http.ResponseWriter, r *http.Request, id int64)
- func (_ Unimplemented) GetAccounts(w http.ResponseWriter, r *http.Request, params GetAccountsParams)
- func (_ Unimplemented) GetAccountsId(w http.ResponseWriter, r *http.Request, id int64)
- func (_ Unimplemented) GetAccountsIdExt(w http.ResponseWriter, r *http.Request, id int64)
- func (_ Unimplemented) GetAccountsIdGroups(w http.ResponseWriter, r *http.Request, id int64)
- func (_ Unimplemented) GetAccountsUsage(w http.ResponseWriter, r *http.Request, params GetAccountsUsageParams)
- func (_ Unimplemented) GetAdminOverview(w http.ResponseWriter, r *http.Request, params GetAdminOverviewParams)
- func (_ Unimplemented) GetAdminSettings(w http.ResponseWriter, r *http.Request)
- func (_ Unimplemented) GetAdminUsersTop(w http.ResponseWriter, r *http.Request, params GetAdminUsersTopParams)
- func (_ Unimplemented) GetErrLogs(w http.ResponseWriter, r *http.Request, params GetErrLogsParams)
- func (_ Unimplemented) GetGroups(w http.ResponseWriter, r *http.Request, params GetGroupsParams)
- func (_ Unimplemented) GetGroupsId(w http.ResponseWriter, r *http.Request, id int64)
- func (_ Unimplemented) GetGroupsIdAssignments(w http.ResponseWriter, r *http.Request, id int64)
- func (_ Unimplemented) GetKeys(w http.ResponseWriter, r *http.Request, params GetKeysParams)
- func (_ Unimplemented) GetMailTemplates(w http.ResponseWriter, r *http.Request)
- func (_ Unimplemented) GetOpsWorkers(w http.ResponseWriter, r *http.Request)
- func (_ Unimplemented) GetPriceEntry(w http.ResponseWriter, r *http.Request, params GetPriceEntryParams)
- func (_ Unimplemented) GetPriceVariants(w http.ResponseWriter, r *http.Request, params GetPriceVariantsParams)
- func (_ Unimplemented) GetPrices(w http.ResponseWriter, r *http.Request, params GetPricesParams)
- func (_ Unimplemented) GetRedemptionCodes(w http.ResponseWriter, r *http.Request, params GetRedemptionCodesParams)
- func (_ Unimplemented) GetRedemptionCodesIdUses(w http.ResponseWriter, r *http.Request, id int64, ...)
- func (_ Unimplemented) GetStatsEntityTrend(w http.ResponseWriter, r *http.Request, params GetStatsEntityTrendParams)
- func (_ Unimplemented) GetStatsTTFT(w http.ResponseWriter, r *http.Request, params GetStatsTTFTParams)
- func (_ Unimplemented) GetStatsTop(w http.ResponseWriter, r *http.Request, params GetStatsTopParams)
- func (_ Unimplemented) GetStatsTrend(w http.ResponseWriter, r *http.Request, params GetStatsTrendParams)
- func (_ Unimplemented) GetTempBalances(w http.ResponseWriter, r *http.Request, params GetTempBalancesParams)
- func (_ Unimplemented) GetTemplates(w http.ResponseWriter, r *http.Request, params GetTemplatesParams)
- func (_ Unimplemented) GetTemplatesId(w http.ResponseWriter, r *http.Request, id int64)
- func (_ Unimplemented) GetTemplatesIdExt(w http.ResponseWriter, r *http.Request, id int64)
- func (_ Unimplemented) GetUsageLogs(w http.ResponseWriter, r *http.Request, params GetUsageLogsParams)
- func (_ Unimplemented) GetUsers(w http.ResponseWriter, r *http.Request, params GetUsersParams)
- func (_ Unimplemented) GetUsersIdGroups(w http.ResponseWriter, r *http.Request, id int64)
- func (_ Unimplemented) ListRules(w http.ResponseWriter, r *http.Request, params ListRulesParams)
- func (_ Unimplemented) PostAccounts(w http.ResponseWriter, r *http.Request)
- func (_ Unimplemented) PostAccountsBatchDelete(w http.ResponseWriter, r *http.Request)
- func (_ Unimplemented) PostAccountsBatchImportCodexOauth(w http.ResponseWriter, r *http.Request)
- func (_ Unimplemented) PostAccountsBatchImportCodexPat(w http.ResponseWriter, r *http.Request)
- func (_ Unimplemented) PostAccountsBatchResetCooldown(w http.ResponseWriter, r *http.Request)
- func (_ Unimplemented) PostAccountsBatchUpdate(w http.ResponseWriter, r *http.Request)
- func (_ Unimplemented) PostGroups(w http.ResponseWriter, r *http.Request)
- func (_ Unimplemented) PostGroupsBatchDelete(w http.ResponseWriter, r *http.Request)
- func (_ Unimplemented) PostGroupsBatchUpdate(w http.ResponseWriter, r *http.Request)
- func (_ Unimplemented) PostPricingSync(w http.ResponseWriter, r *http.Request)
- func (_ Unimplemented) PostPricingSyncPreview(w http.ResponseWriter, r *http.Request)
- func (_ Unimplemented) PostRedemptionCodes(w http.ResponseWriter, r *http.Request)
- func (_ Unimplemented) PostRedemptionCodesBatchDeactivate(w http.ResponseWriter, r *http.Request)
- func (_ Unimplemented) PostRedemptionCodesIdDeactivate(w http.ResponseWriter, r *http.Request, id int64)
- func (_ Unimplemented) PostRulesBatchDelete(w http.ResponseWriter, r *http.Request)
- func (_ Unimplemented) PostTemplates(w http.ResponseWriter, r *http.Request)
- func (_ Unimplemented) PostTemplatesBatchDelete(w http.ResponseWriter, r *http.Request)
- func (_ Unimplemented) PostTemplatesBatchUpdate(w http.ResponseWriter, r *http.Request)
- func (_ Unimplemented) PostUsers(w http.ResponseWriter, r *http.Request)
- func (_ Unimplemented) PutAccountsId(w http.ResponseWriter, r *http.Request, id int64)
- func (_ Unimplemented) PutAccountsIdExt(w http.ResponseWriter, r *http.Request, id int64)
- func (_ Unimplemented) PutAdminSettings(w http.ResponseWriter, r *http.Request)
- func (_ Unimplemented) PutGroupsId(w http.ResponseWriter, r *http.Request, id int64)
- func (_ Unimplemented) PutGroupsIdAssignments(w http.ResponseWriter, r *http.Request, id int64)
- func (_ Unimplemented) PutMailTemplate(w http.ResponseWriter, r *http.Request, purpose string)
- func (_ Unimplemented) PutPriceEntry(w http.ResponseWriter, r *http.Request, params PutPriceEntryParams)
- func (_ Unimplemented) PutPriceVariants(w http.ResponseWriter, r *http.Request, params PutPriceVariantsParams)
- func (_ Unimplemented) PutTemplatesId(w http.ResponseWriter, r *http.Request, id int64)
- func (_ Unimplemented) PutTemplatesIdExt(w http.ResponseWriter, r *http.Request, id int64)
- func (_ Unimplemented) PutUsersId(w http.ResponseWriter, r *http.Request, id int64)
- func (_ Unimplemented) PutUsersIdGroups(w http.ResponseWriter, r *http.Request, id int64)
- func (_ Unimplemented) UpdateRule(w http.ResponseWriter, r *http.Request, id int64)
- type UnmarshalingParamError
- type UpdateRuleJSONRequestBody
- type UsageGatewayStats
- type UsageLog
- type User
- type UserCreate
- type UserGroupsBody
- type UserGroupsResponse
- type UserListResponse
- type UserRole
- type UserStatus
- type UserUpdate
- type UsersTopEntry
- type UsersTopResponse
- type WorkerStatus
- type WorkersResponse
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
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 HandlerWithOptions ¶
func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handler
HandlerWithOptions creates http.Handler with additional options
Types ¶
type Account ¶
type Account struct {
// BaseURL 账号级覆盖:非空优先于模板 base_url;null = 继承模板
BaseURL *string `json:"BaseURL"`
CooldownUntil *time.Time `json:"CooldownUntil"`
CreatedAt *time.Time `json:"CreatedAt,omitempty"`
// DeletedAt 软删除时间戳;null = 存活(列表过滤已删;GET 单个可查已删项)
DeletedAt *time.Time `json:"DeletedAt"`
ID *int64 `json:"ID,omitempty"`
LastError *string `json:"LastError"`
LastUsedAt *time.Time `json:"LastUsedAt"`
MaxConcurrency *int `json:"MaxConcurrency,omitempty"`
Name *string `json:"Name,omitempty"`
Status *AccountStatus `json:"Status,omitempty"`
Template *Template `json:"Template,omitempty"`
TemplateID *int64 `json:"TemplateID,omitempty"`
UpdatedAt *time.Time `json:"UpdatedAt,omitempty"`
UpstreamKey *string `json:"UpstreamKey,omitempty"`
Weight *int `json:"Weight,omitempty"`
}
Account defines model for Account.
type AccountCreate ¶
type AccountCreate struct {
// BaseUrl 账号级覆盖(可选):非空优先于模板 base_url;null = 继承模板
BaseUrl *string `json:"base_url"`
GroupIds *[]int64 `json:"group_ids,omitempty"`
MaxConcurrency *int `json:"max_concurrency,omitempty"`
Name string `json:"name"`
Status *AccountStatus `json:"status,omitempty"`
TemplateId int64 `json:"template_id"`
UpstreamKey string `json:"upstream_key"`
Weight *int `json:"weight,omitempty"`
}
AccountCreate defines model for AccountCreate.
type AccountExt ¶
type AccountExt struct {
AccountId *int64 `json:"account_id,omitempty"`
// CodexAccountId 上游账号/空间标识(Task B 导入必填;本 task 仅声明)
CodexAccountId *string `json:"codex_account_id"`
// CodexEmail 管理标识:codex 账号登录邮箱(导入时由人工/上游提供,非自动生成——NewCodexIdentity 只生成身份四元组;可空)
CodexEmail *string `json:"codex_email"`
// CodexIdentity codex 账号身份四元组(account_ext.codex_identity jsonb 契约形态;对象字段请求语义:null 与空串同 = 未提供)
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 AccountPatch ¶
type AccountPatch struct {
// BaseUrl 批量三态:空串 = 清空(回继承模板);null/缺省 = 不变;非空 = 落值
BaseUrl *string `json:"base_url"`
GroupIds *[]int64 `json:"group_ids,omitempty"`
MaxConcurrency *int `json:"max_concurrency,omitempty"`
Name *string `json:"name,omitempty"`
Status *AccountPatchStatus `json:"status,omitempty"`
TemplateId *int64 `json:"template_id,omitempty"`
UpstreamKey *string `json:"upstream_key,omitempty"`
Weight *int `json:"weight,omitempty"`
}
AccountPatch defines model for AccountPatch.
type AccountPatchStatus ¶
type AccountPatchStatus string
AccountPatchStatus defines model for AccountPatch.Status.
const ( AccountPatchStatusActive AccountPatchStatus = "active" AccountPatchStatusDisabled AccountPatchStatus = "disabled" AccountPatchStatusN429 AccountPatchStatus = "429" AccountPatchStatusUnhealthy AccountPatchStatus = "unhealthy" )
Defines values for AccountPatchStatus.
type AccountStatus ¶
type AccountStatus string
AccountStatus defines model for AccountStatus.
const ( AccountStatusActive AccountStatus = "active" AccountStatusDisabled AccountStatus = "disabled" AccountStatusN429 AccountStatus = "429" AccountStatusUnhealthy AccountStatus = "unhealthy" )
Defines values for AccountStatus.
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" )
Defines values for AccountUsageItemUpstreamError.
type AccountView ¶
type AccountView struct {
// BaseURL 账号级覆盖:非空优先于模板 base_url;null = 继承模板
BaseURL *string `json:"BaseURL"`
CooldownUntil *time.Time `json:"CooldownUntil"`
CreatedAt *time.Time `json:"CreatedAt,omitempty"`
// DeletedAt 软删除时间戳;null = 存活(列表过滤已删;GET 单个可查已删项)
DeletedAt *time.Time `json:"DeletedAt"`
ID *int64 `json:"ID,omitempty"`
LastError *string `json:"LastError"`
LastUsedAt *time.Time `json:"LastUsedAt"`
MaxConcurrency *int `json:"MaxConcurrency,omitempty"`
Name *string `json:"Name,omitempty"`
Status *AccountStatus `json:"Status,omitempty"`
Template *Template `json:"Template,omitempty"`
TemplateID *int64 `json:"TemplateID,omitempty"`
UpdatedAt *time.Time `json:"UpdatedAt,omitempty"`
UpstreamKey *string `json:"UpstreamKey,omitempty"`
Weight *int `json:"Weight,omitempty"`
Concurrency *int64 `json:"concurrency,omitempty"`
ErrCount *int `json:"err_count,omitempty"`
ErrRate *float64 `json:"err_rate,omitempty"`
}
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)持有, 由装配面注入;缺省零值 = 端点返回空(测试/无运维装配场景零改动)。
func (*AdminAPI) CreateRule ¶
func (h *AdminAPI) CreateRule(w http.ResponseWriter, r *http.Request)
CreateRule 创建规则(ServerInterface)。
func (*AdminAPI) DeleteAccountsId ¶
DeleteAccountsId 删除账号(ServerInterface)。
func (*AdminAPI) DeleteGroupsId ¶
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 ¶
DeleteRule 删除规则(ServerInterface;204 No Content)。
func (*AdminAPI) DeleteTemplatesId ¶
DeleteTemplatesId 删除模板(ServerInterface)。
func (*AdminAPI) GetAccounts ¶
func (h *AdminAPI) GetAccounts(w http.ResponseWriter, r *http.Request, params GetAccountsParams)
GetAccounts 账号列表(分页/筛选/排序,含运行时视图,ServerInterface)。
func (*AdminAPI) GetAccountsId ¶
GetAccountsId 账号详情(ServerInterface)。
func (*AdminAPI) GetAccountsIdExt ¶
GetAccountsIdExt 账号类型化鉴权扩展(编辑回显;仅 codex-oauth/codex-pat 账号有 ext 行,ServerInterface)。账号缺 id / 无 ext 行 → 404。
func (*AdminAPI) GetAccountsIdGroups ¶
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);from/to RFC3339 可选——缺省 = 当天(from=UTC 当日零点、to=now,"当天"语义单点,经 h.now 可注入时钟);from > to → 400。响应 items 恒 = account_ids 去重后全量 (无记录账号 gateway 全 0——前端免补零),顺序 = 去重后顺序。
func (*AdminAPI) GetAdminOverview ¶
func (h *AdminAPI) GetAdminOverview(w http.ResponseWriter, r *http.Request, params GetAdminOverviewParams)
GET /api/admin/overview 管理端总览(spec 2026-08-14):一站式聚合端点—— summary(今日 UTC 日界,cost 毫分 /1e5 → USD)+ trend(近 N 天日桶,SQL 侧 GROUP BY)+ accounts(调度器快照健康分布/并发水位)+ resources(三表 冷面 count)+ err_top(账号维度 EWMA Top5)+ alerts(billing 游标积压 lag 族注入面)。全冷面(聚合查询 + 快照遍历);内部 TTL 30s 缓存,键含 days/group_id + UTC 日界(summary"今日"跨午夜滚转——缓存键带日界分量); 无 singleflight(dashboard 单消费者,P3 声明接受)。
func (*AdminAPI) GetAdminSettings ¶
func (h *AdminAPI) GetAdminSettings(w http.ResponseWriter, r *http.Request)
GetAdminSettings 全部设置(默认值 + DB 覆盖;ServerInterface)。
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 组装)。
func (*AdminAPI) GetGroups ¶
func (h *AdminAPI) GetGroups(w http.ResponseWriter, r *http.Request, params GetGroupsParams)
GetGroups 分组列表(分页/筛选/排序,ServerInterface)。
func (*AdminAPI) GetGroupsId ¶
GetGroupsId 分组详情(ServerInterface)。
func (*AdminAPI) GetGroupsIdAssignments ¶
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) GetStatsEntityTrend ¶
func (h *AdminAPI) GetStatsEntityTrend(w http.ResponseWriter, r *http.Request, params GetStatsEntityTrendParams)
GetStatsEntityTrend 实体趋势。
func (*AdminAPI) GetStatsTTFT ¶
func (h *AdminAPI) GetStatsTTFT(w http.ResponseWriter, r *http.Request, params GetStatsTTFTParams)
GetStatsTTFT TTFT 聚合(sketch/exact 双分支)。
func (*AdminAPI) GetStatsTop ¶
func (h *AdminAPI) GetStatsTop(w http.ResponseWriter, r *http.Request, params GetStatsTopParams)
GetStatsTop Top 排行(entity 卷积)。
func (*AdminAPI) GetStatsTrend ¶
func (h *AdminAPI) GetStatsTrend(w http.ResponseWriter, r *http.Request, params GetStatsTrendParams)
GetStatsTrend 趋势聚合(cube)— ServerInterface。
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 ¶
GetTemplatesId 模板详情(ServerInterface)。
func (*AdminAPI) GetTemplatesIdExt ¶
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)。
func (*AdminAPI) GetUsers ¶
func (h *AdminAPI) GetUsers(w http.ResponseWriter, r *http.Request, params GetUsersParams)
GetUsers 用户列表(platform_admin 专属;/admin 组中间件已鉴权, ServerInterface)。
func (*AdminAPI) GetUsersIdGroups ¶
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) PostAccounts ¶
func (h *AdminAPI) PostAccounts(w http.ResponseWriter, r *http.Request)
PostAccounts 创建账号(ServerInterface)。
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) PostAccountsBatchResetCooldown ¶
func (h *AdminAPI) PostAccountsBatchResetCooldown(w http.ResponseWriter, r *http.Request)
PostAccountsBatchResetCooldown 批量重置账号冷却(事务,全成或全败;冷却 重置后调度快照失效由 service invalidate 完成,ServerInterface)。
func (*AdminAPI) PostAccountsBatchUpdate ¶
func (h *AdminAPI) PostAccountsBatchUpdate(w http.ResponseWriter, r *http.Request)
PostAccountsBatchUpdate 批量更新账号(fields 任意子集;更新后调度快照 失效由 service invalidate 完成,ServerInterface)。
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 = 免费组(恒写入——T3.5 修正: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) 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) 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) PutAccountsId ¶
PutAccountsId 全量更新账号(ServerInterface;group_ids 缺省 = 分组不变, 空数组 = 清空)。
func (*AdminAPI) PutAccountsIdExt ¶
PutAccountsIdExt 幂等写入账号类型化鉴权扩展(Create/Update 合一;全列更新 含 NULL 清空,ServerInterface)。credential_type ∈ {codex-oauth, codex-pat}; 身份四元组(codex_identity 对象——installation/session/thread/window)首次 写入缺省 → 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 无清空路径,恒等约束由 service 维护)。
func (*AdminAPI) PutAdminSettings ¶
func (h *AdminAPI) PutAdminSettings(w http.ResponseWriter, r *http.Request)
PutAdminSettings 更新设置(类型化校验在 service;返回更新后全部设置, ServerInterface)。
func (*AdminAPI) PutGroupsId ¶
PutGroupsId 全量更新分组(ServerInterface)。price_multiplier(正常值 0~10)提供(含 0 = 免费)即写入;缺省 = 保持原值。
func (*AdminAPI) PutGroupsIdAssignments ¶
PutGroupsIdAssignments 设置组的授予用户(platform_admin 专属;替换语义: 未列出即撤销,空数组 = 清空;ServerInterface)。multipliers 可选:user_id → 该用户在该组的专属价格倍率(正常值 0~10;null = 清除为未设置 → 回退组 倍率;T3.5 修正:用户专属倍率按组挂载)。
func (*AdminAPI) PutMailTemplate ¶
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 ¶
PutTemplatesId 全量更新模板(ServerInterface)。
func (*AdminAPI) PutTemplatesIdExt ¶
PutTemplatesIdExt 幂等写入模板类型化扩展(Create/Update 合一;全列更新含 NULL 清空,ServerInterface)。credential_type 必填;类型一致性(ext 行类型 必须 == 父模板类型)与模板缺 id → 400/404(service 校验)。模板是共享配置 面:唯一可配置列 strip_image_tools(三类型公共能力开关)——凭据(oauth/pat) 一律在账号级 account_ext。
func (*AdminAPI) PutUsersId ¶
PutUsersId 更新用户(role/status/max_concurrency/balance;变更即时生效—— Auth 快照刷新,ServerInterface)。 patch 形态(v02 核实 P1 修复):只把请求显式提供的字段传给更新——请求不带 balance 时不再把 GET 快照陈旧值全量写回(与 flusher 扣费双向覆盖、余额凭空 复活);balance/max_concurrency 显式设置时带 GET 快照旧值条件(期间有扣费 → 0 行 → service 重读重试,new 保持管理员显式意图)。
func (*AdminAPI) PutUsersIdGroups ¶
PutUsersIdGroups 设置用户的授予分组(platform_admin;替换语义:group_ids = 完整授予组列表(未列出即撤销,空数组 = 清空);ServerInterface)。 multipliers 可选:group_id → 该用户在该组的专属价格倍率(正常值 0~10; null = 清除为未设置 → 回退组倍率;键必须 ∈ group_ids)。
func (*AdminAPI) Router ¶
Router 返回带 /api/admin 前缀的 chi 路由(替代原 Routes/RoutesMux)。 ErrorHandlerFunc 覆盖生成的默认 http.Error 纯文本 400:参数绑定失败 (InvalidParamFormatError 等)统一输出契约 ErrorResponse({"error": ...})。
func (*AdminAPI) RoutesMux ¶
RoutesMux 兼容保留:cmd/server/main.go 仍以 Handle("/api/admin/*") 挂载, 后续任务改接 Router 后可删除。
func (*AdminAPI) UpdateRule ¶
UpdateRule 部分更新规则(未提供字段保持原值,ServerInterface)。
type AdminKey ¶
type AdminKey struct {
CreatedAt *time.Time `json:"CreatedAt,omitempty"`
DeletedAt *time.Time `json:"DeletedAt"`
GroupID *int64 `json:"GroupID,omitempty"`
ID *int64 `json:"ID,omitempty"`
MaxConcurrency *int `json:"MaxConcurrency,omitempty"`
Name *string `json:"Name,omitempty"`
Quota *int64 `json:"Quota,omitempty"`
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 ¶
AdminKeyListResponse defines model for AdminKeyListResponse.
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 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 BatchResetCooldownBody ¶
type BatchResetCooldownBody struct {
Ids []int64 `json:"ids"`
}
BatchResetCooldownBody defines model for BatchResetCooldownBody.
type BatchResetCooldownResponse ¶
type BatchResetCooldownResponse struct {
Reset int `json:"reset"`
}
BatchResetCooldownResponse defines model for BatchResetCooldownResponse.
type BatchUpdateAccountsBody ¶
type BatchUpdateAccountsBody struct {
Fields AccountPatch `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 ¶
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"`
// SessionId 身份:会话级(UUIDv7;恒等 == thread_id;service 自动生成/沿用;响应 nil → null)
SessionId *string `json:"session_id"`
// ThreadId 身份:会话级(UUIDv7;恒等 == session_id;响应 nil → null)
ThreadId *string `json:"thread_id"`
// WindowId 身份:会话级派生 {thread_id}:0(导入时生成后恒定不变——恒 0,无透传无解析;上游不校验 n;响应 nil → null)
WindowId *string `json:"window_id"`
}
CodexIdentity codex 账号身份四元组(account_ext.codex_identity jsonb 契约形态;对象字段请求语义:null 与空串同 = 未提供)
type CodexOAuthImportBody ¶
type CodexOAuthImportBody struct {
// GroupId 可选:新建账号归组(缺省不归组;不存在 → 行级 failed——FK 违反归行级不整批 400)
GroupId *int64 `json:"group_id"`
Items []CodexOAuthImportItem `json:"items"`
// TemplateId 必填:codex 账号归属模板(credential_type 必须 == 端点类型 codex-oauth)
TemplateId int64 `json:"template_id"`
}
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"`
// Weight 可选;缺省 100;负值 → 行级 failed
Weight *int `json:"weight,omitempty"`
}
CodexOAuthImportItem 批量导入 codex-oauth 单行(组合幂等键 codex_email + codex_account_id;token+refresh 成对必填)
type CodexPATImportBody ¶
type CodexPATImportBody struct {
// GroupId 可选:新建账号归组(不存在 → 行级 failed)
GroupId *int64 `json:"group_id"`
Items []CodexPATImportItem `json:"items"`
// TemplateId 必填:codex 账号归属模板(credential_type 必须 == 端点类型 codex-pat)
TemplateId int64 `json:"template_id"`
}
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"`
// Weight 可选;缺省 100;负值 → 行级 failed
Weight *int `json:"weight,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 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 ErrorResponse ¶
type ErrorResponse struct {
Error string `json:"error"`
}
ErrorResponse defines model for ErrorResponse.
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 *int `form:"limit,omitempty" json:"limit,omitempty"`
Offset *int `form:"offset,omitempty" json:"offset,omitempty"`
Name *string `form:"name,omitempty" json:"name,omitempty"`
Sort *string `form:"sort,omitempty" json:"sort,omitempty"`
Order *GetAccountsParamsOrder `form:"order,omitempty" json:"order,omitempty"`
Status *string `form:"status,omitempty" json:"status,omitempty"`
TemplateId *int64 `form:"template_id,omitempty" json:"template_id,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 *time.Time `form:"from,omitempty" json:"from,omitempty"`
To *time.Time `form:"to,omitempty" json:"to,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"`
}
GetAdminOverviewParams defines parameters for GetAdminOverview.
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 *int `form:"limit,omitempty" json:"limit,omitempty"`
Offset *int `form:"offset,omitempty" json:"offset,omitempty"`
Name *string `form:"name,omitempty" json:"name,omitempty"`
Sort *string `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 GetStatsEntityTrendParams ¶
type GetStatsEntityTrendParams struct {
Entity GetStatsEntityTrendParamsEntity `form:"entity" json:"entity"`
Id int64 `form:"id" json:"id"`
From time.Time `form:"from" json:"from"`
To time.Time `form:"to" json:"to"`
Granularity GetStatsEntityTrendParamsGranularity `form:"granularity" json:"granularity"`
Model *string `form:"model,omitempty" json:"model,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" json:"from"`
To time.Time `form:"to" json:"to"`
Entity *GetStatsTTFTParamsEntity `form:"entity,omitempty" json:"entity,omitempty"`
Id *int64 `form:"id,omitempty" json:"id,omitempty"`
Model *string `form:"model,omitempty" json:"model,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"`
}
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" json:"from"`
To time.Time `form:"to" json:"to"`
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"`
}
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 *int `form:"limit,omitempty" json:"limit,omitempty"`
Offset *int `form:"offset,omitempty" json:"offset,omitempty"`
Name *string `form:"name,omitempty" json:"name,omitempty"`
Sort *string `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 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"`
}
GetUsersParams defines parameters for GetUsers.
type GetUsersParamsOrder ¶
type GetUsersParamsOrder string
GetUsersParamsOrder defines parameters for GetUsers.
const ( GetUsersParamsOrderAsc GetUsersParamsOrder = "asc" GetUsersParamsOrderDesc GetUsersParamsOrder = "desc" )
Defines values for GetUsersParamsOrder.
type Group ¶
type Group struct {
CreatedAt *time.Time `json:"CreatedAt,omitempty"`
// DeletedAt 软删除时间戳;null = 存活(列表/消费路径过滤已删;GET 单个可查已删项)
DeletedAt *time.Time `json:"DeletedAt"`
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 {
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 ¶
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 分组级协议转换方向(只补差,W5 网关 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 ¶
func (*InvalidParamFormatError) Error ¶
func (e *InvalidParamFormatError) Error() string
func (*InvalidParamFormatError) Unwrap ¶
func (e *InvalidParamFormatError) Unwrap() error
type ListRulesParams ¶
type ListRulesParams struct {
Enabled *bool `form:"enabled,omitempty" json:"enabled,omitempty"`
}
ListRulesParams defines parameters for ListRules.
type LogsResponse ¶
type LogsResponse struct {
// NextCursor 下一页游标(本页最后一条 id);null = 无更多行
NextCursor *int64 `json:"next_cursor"`
Rows []UsageLog `json:"rows"`
}
LogsResponse defines model for LogsResponse.
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 ( 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 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 族观测直读(F2 ledger-cursor)。nil = 未装配 → alerts 全零)。
BillingAlerts func() BillingAlerts
}
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 族观测,F2 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 族观测,F2 ledger-cursor;注入面读取,未装配 = 全零)
Alerts OverviewAlerts `json:"alerts"`
ErrTop []OverviewErrTop `json:"err_top"`
// Resources 资源计数(冷面 count;模板/分组排除软删)
Resources OverviewResources `json:"resources"`
// Summary 今日汇总(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 今日汇总(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 日桶(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 侧 GROUP BY date_trunc('day', bucket_time);UTC 日;TTFT 指标仅含首 token 流式请求样本,无样本 = 0)
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 PostAccountsBatchResetCooldownJSONRequestBody ¶
type PostAccountsBatchResetCooldownJSONRequestBody = BatchResetCooldownBody
PostAccountsBatchResetCooldownJSONRequestBody defines body for PostAccountsBatchResetCooldown for application/json ContentType.
type PostAccountsBatchUpdateJSONRequestBody ¶
type PostAccountsBatchUpdateJSONRequestBody = BatchUpdateAccountsBody
PostAccountsBatchUpdateJSONRequestBody defines body for PostAccountsBatchUpdate for application/json ContentType.
type PostAccountsJSONRequestBody ¶
type PostAccountsJSONRequestBody = AccountCreate
PostAccountsJSONRequestBody defines body for PostAccounts 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 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 PutAccountsIdJSONRequestBody ¶
type PutAccountsIdJSONRequestBody = AccountCreate
PutAccountsIdJSONRequestBody defines body for PutAccountsId 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 0 = 系统(静态 admin token);>0 = platform_admin 用户 id
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 ¶
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 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——status/cooldown/weight/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 = 该维度透传不改)。全空对象 {} 合法 =
// 纯透传规则:命中后状态/冷却/权重零改动、响应码与文案双透传上游原样返回、
// 不计惩罚(不投递状态事件)。可用键:
// - status:命中后账号目标状态,active/unhealthy/429/disabled 之一
// - cooldown:冷却时长,Go time.ParseDuration 可解析且 > 0(如 "30s"、"5h")
// - weight:调度权重 ∈ [0,100]
// - 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 ¶
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 重新校验。全空对象 {} 合法 = 纯透传规则:
// 命中后状态/冷却/权重零改动、响应码与文案双透传上游原样返回、不计惩罚
// (不投递状态事件)。可用键:
// - status:命中后账号目标状态,active/unhealthy/429/disabled 之一
// - cooldown:冷却时长,Go time.ParseDuration 可解析且 > 0(如 "30s"、"5h")
// - weight:调度权重 ∈ [0,100]
// - 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)
// 批量重置账号冷却(事务,全成或全败;status→active + cooldown_until=now)
// (POST /accounts/batch-reset-cooldown)
PostAccountsBatchResetCooldown(w http.ResponseWriter, r *http.Request)
// 批量更新账号(fields 为任意字段子集)
// (POST /accounts/batch-update)
PostAccountsBatchUpdate(w http.ResponseWriter, r *http.Request)
// 账号用量聚合(统一 usage API——批量 ≤100 条;from/to 缺省 = 当天)
// (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)
// (PUT /accounts/{id})
PutAccountsId(w http.ResponseWriter, r *http.Request, id int64)
// 读取账号类型化鉴权扩展(编辑回显;仅 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)
// 错误明细分页查询(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)
// 邮件模板列表(缺行自动回退内置默认)
// (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)
// 规则列表(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)
// 实体趋势(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)
// 临时额度列表(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;用户视角,与 /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) 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 ¶
func (siw *ServerInterfaceWrapper) GetKeys(w http.ResponseWriter, r *http.Request)
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) 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) 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) 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) PostAccountsBatchResetCooldown ¶
func (siw *ServerInterfaceWrapper) PostAccountsBatchResetCooldown(w http.ResponseWriter, r *http.Request)
PostAccountsBatchResetCooldown operation middleware
func (*ServerInterfaceWrapper) PostAccountsBatchUpdate ¶
func (siw *ServerInterfaceWrapper) PostAccountsBatchUpdate(w http.ResponseWriter, r *http.Request)
PostAccountsBatchUpdate 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) 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) PutAccountsId ¶
func (siw *ServerInterfaceWrapper) PutAccountsId(w http.ResponseWriter, r *http.Request)
PutAccountsId 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 ¶
SettingUpdate defines model for SettingUpdate.
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 StatsProvider ¶
StatsProvider worker 可观测状态提供面。
同步义务:改 Stats() 返回的字段(增删改名)必须同步 openapi.yaml WorkerStatus.stats 的字段清单(description),否则契约 文档过期且无人知——清单是消费方(前端/运维脚本)的唯一依据。
type Template ¶
type Template struct {
BaseURL string `json:"BaseURL"`
CreatedAt time.Time `json:"CreatedAt"`
// CredentialType 模板号池类型;生态三类型只支持 resp / resp-ws 格式
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]string `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 *string `json:"base_url,omitempty"`
CredentialType *TemplateCreateCredentialType `json:"credential_type,omitempty"`
FormatModels *map[string][]string `json:"format_models,omitempty"`
ModelMapping *map[string]string `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 格式
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 ¶
TemplateListResponse defines model for TemplateListResponse.
type TemplatePatch ¶
type TemplatePatch struct {
BaseUrl *string `json:"base_url,omitempty"`
FormatModels *map[string][]string `json:"format_models,omitempty"`
ModelMapping *map[string]string `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 ¶
func (*TooManyValuesForParamError) Error ¶
func (e *TooManyValuesForParamError) Error() string
type UnescapedCookieParamError ¶
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 缺省 = 当天) (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) 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) 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) 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) 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) PostAccountsBatchResetCooldown ¶
func (_ Unimplemented) PostAccountsBatchResetCooldown(w http.ResponseWriter, r *http.Request)
批量重置账号冷却(事务,全成或全败;status→active + cooldown_until=now) (POST /accounts/batch-reset-cooldown)
func (Unimplemented) PostAccountsBatchUpdate ¶
func (_ Unimplemented) PostAccountsBatchUpdate(w http.ResponseWriter, r *http.Request)
批量更新账号(fields 为任意字段子集) (POST /accounts/batch-update)
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) 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) PutAccountsId ¶
func (_ Unimplemented) PutAccountsId(w http.ResponseWriter, r *http.Request, id int64)
(PUT /accounts/{id})
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 ¶
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 ¶
UserListResponse defines model for UserListResponse.
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.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package httpface 管理面/用户面 HTTP 边界:响应书写(WriteJSON/WriteErr/ WriteServiceErr,service 错误→HTTP 状态映射表唯一一份)+ 请求参数边界 (ClampLimit——两面包共享的分页上限钳制)。
|
Package httpface 管理面/用户面 HTTP 边界:响应书写(WriteJSON/WriteErr/ WriteServiceErr,service 错误→HTTP 状态映射表唯一一份)+ 请求参数边界 (ClampLimit——两面包共享的分页上限钳制)。 |
|
Package user provides primitives to interact with the openapi HTTP API.
|
Package user provides primitives to interact with the openapi HTTP API. |