controller

package
v0.2.0-beta.2 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2026 License: AGPL-3.0 Imports: 86 Imported by: 0

Documentation

Index

Constants

View Source
const CreemSignatureHeader = "creem-signature"

Variables

This section is empty.

Functions

func AddChannel

func AddChannel(c *gin.Context)

func AddRedemption

func AddRedemption(c *gin.Context)

func AddToken

func AddToken(c *gin.Context)

func Admin2FAStats

func Admin2FAStats(c *gin.Context)

Admin2FAStats 管理员获取2FA统计信息

func AdminBindSubscription

func AdminBindSubscription(c *gin.Context)

func AdminClearUserBinding

func AdminClearUserBinding(c *gin.Context)

func AdminCompleteTopUp

func AdminCompleteTopUp(c *gin.Context)

AdminCompleteTopUp 管理员补单接口

func AdminCreateSubscriptionPlan

func AdminCreateSubscriptionPlan(c *gin.Context)

func AdminCreateUserSubscription

func AdminCreateUserSubscription(c *gin.Context)

AdminCreateUserSubscription creates a new user subscription from a plan (no payment).

func AdminDeleteUserSubscription

func AdminDeleteUserSubscription(c *gin.Context)

AdminDeleteUserSubscription hard-deletes a user subscription.

func AdminDisable2FA

func AdminDisable2FA(c *gin.Context)

AdminDisable2FA 管理员强制禁用用户2FA

func AdminInvalidateUserSubscription

func AdminInvalidateUserSubscription(c *gin.Context)

AdminInvalidateUserSubscription cancels a user subscription immediately.

func AdminListSubscriptionPlans

func AdminListSubscriptionPlans(c *gin.Context)

func AdminListUserSubscriptions

func AdminListUserSubscriptions(c *gin.Context)

func AdminResetPasskey

func AdminResetPasskey(c *gin.Context)

func AdminResetPlanSubscriptions

func AdminResetPlanSubscriptions(c *gin.Context)

func AdminResetUserSubscriptionsByPlan

func AdminResetUserSubscriptionsByPlan(c *gin.Context)

func AdminUpdateSubscriptionPlan

func AdminUpdateSubscriptionPlan(c *gin.Context)

func AdminUpdateSubscriptionPlanStatus

func AdminUpdateSubscriptionPlanStatus(c *gin.Context)

func ApplyAllChannelUpstreamModelUpdates

func ApplyAllChannelUpstreamModelUpdates(c *gin.Context)

func ApplyChannelUpstreamModelUpdates

func ApplyChannelUpstreamModelUpdates(c *gin.Context)

func ApplyQuotaWriterModeTransition

func ApplyQuotaWriterModeTransition(c *gin.Context)

ApplyQuotaWriterModeTransition applies the gated mode switch. The response always carries the persisted evidence row when one was written; condition failures additionally list the missing audit checks.

func AuthLogout

func AuthLogout(c *gin.Context)

func AutomaticallyUpdateChannels

func AutomaticallyUpdateChannels(frequency int)

func BatchSetChannelTag

func BatchSetChannelTag(c *gin.Context)

func BatchUpdateChannelStatus

func BatchUpdateChannelStatus(c *gin.Context)

func CancelPromptLearningRun

func CancelPromptLearningRun(c *gin.Context)

func ChannelListModels

func ChannelListModels(c *gin.Context)

func CheckClusterNameAvailability

func CheckClusterNameAvailability(c *gin.Context)

func CleanupLogFiles

func CleanupLogFiles(c *gin.Context)

CleanupLogFiles 清理过期日志文件

func ClearChannelAffinityCache

func ClearChannelAffinityCache(c *gin.Context)

func ClearDiskCache

func ClearDiskCache(c *gin.Context)

ClearDiskCache 清理不活跃的磁盘缓存

func CompleteCodexOAuth

func CompleteCodexOAuth(c *gin.Context)

func CompleteCodexOAuthForChannel

func CompleteCodexOAuthForChannel(c *gin.Context)

func ConfirmPaymentCompliance

func ConfirmPaymentCompliance(c *gin.Context)

func CopyChannel

func CopyChannel(c *gin.Context)

CopyChannel handles cloning an existing channel with its key. POST /api/channel/copy/:id Optional query params:

suffix         - string appended to the original name (default "_复制")
reset_balance  - bool, when true will reset balance & used_quota to 0 (default true)

func CreateCustomOAuthProvider

func CreateCustomOAuthProvider(c *gin.Context)

CreateCustomOAuthProvider creates a new custom OAuth provider

func CreateDeployment

func CreateDeployment(c *gin.Context)

func CreateLogCleanupSystemTask

func CreateLogCleanupSystemTask(c *gin.Context)

func CreateModelMeta

func CreateModelMeta(c *gin.Context)

CreateModelMeta 新建模型

func CreatePrefillGroup

func CreatePrefillGroup(c *gin.Context)

CreatePrefillGroup 创建新的预填组

func CreatePromptLearningVersion

func CreatePromptLearningVersion(c *gin.Context)

func CreateUser

func CreateUser(c *gin.Context)

func CreateVendorMeta

func CreateVendorMeta(c *gin.Context)

CreateVendorMeta 新建供应商

func CreateWaffoPancakePair

func CreateWaffoPancakePair(c *gin.Context)

CreateWaffoPancakePair mints a Store + OnetimeProduct pair in one round- trip. Surfaces an orphan-store flag when the product half fails so the frontend can preselect / retry without losing context.

func CreateWaffoPancakeSubscriptionProduct

func CreateWaffoPancakeSubscriptionProduct(c *gin.Context)

CreateWaffoPancakeSubscriptionProduct mints an OnetimeProduct (not SubscriptionProduct — see service.CreateWaffoPancakeProductForPlan) sized to a plan's `name` + `amount`, using persisted Pancake credentials + StoreID. Reads from the form, not the plan row, so newly-typed unsaved plans can mint a product too.

func CreemWebhook

func CreemWebhook(c *gin.Context)

func DashboardListModels

func DashboardListModels(c *gin.Context)

func DeleteAllFullContentLogFiles

func DeleteAllFullContentLogFiles(c *gin.Context)

func DeleteChannel

func DeleteChannel(c *gin.Context)

func DeleteChannelBatch

func DeleteChannelBatch(c *gin.Context)

func DeleteCustomOAuthProvider

func DeleteCustomOAuthProvider(c *gin.Context)

DeleteCustomOAuthProvider deletes a custom OAuth provider

func DeleteDeployment

func DeleteDeployment(c *gin.Context)

func DeleteDisabledChannel

func DeleteDisabledChannel(c *gin.Context)

func DeleteFullContentLogFile

func DeleteFullContentLogFile(c *gin.Context)

func DeleteInvalidRedemption

func DeleteInvalidRedemption(c *gin.Context)

func DeleteLoginSession

func DeleteLoginSession(c *gin.Context)

func DeleteModelMeta

func DeleteModelMeta(c *gin.Context)

DeleteModelMeta 删除模型

func DeletePrefillGroup

func DeletePrefillGroup(c *gin.Context)

DeletePrefillGroup 删除预填组

func DeleteRedemption

func DeleteRedemption(c *gin.Context)

func DeleteSelf

func DeleteSelf(c *gin.Context)

func DeleteStaleSystemInstance

func DeleteStaleSystemInstance(c *gin.Context)

func DeleteStaleSystemInstances

func DeleteStaleSystemInstances(c *gin.Context)

func DeleteToken

func DeleteToken(c *gin.Context)

func DeleteTokenBatch

func DeleteTokenBatch(c *gin.Context)

func DeleteUser

func DeleteUser(c *gin.Context)

func DeleteVendorMeta

func DeleteVendorMeta(c *gin.Context)

DeleteVendorMeta 删除供应商

func DetectAllChannelUpstreamModelUpdates

func DetectAllChannelUpstreamModelUpdates(c *gin.Context)

DetectAllChannelUpstreamModelUpdates enqueues a model_update system task (manual variant) instead of scanning inline. Routing the manual trigger through the framework gives it the same cross-instance lease dedup and run history as the scheduled scan. If any model_update task is already active, the manual run is rejected so the caller does not mistake a scheduled run for this manual one.

func DetectChannelUpstreamModelUpdates

func DetectChannelUpstreamModelUpdates(c *gin.Context)

func Disable2FA

func Disable2FA(c *gin.Context)

Disable2FA 禁用2FA

func DisableTagChannels

func DisableTagChannels(c *gin.Context)

func DoCheckin

func DoCheckin(c *gin.Context)

DoCheckin 执行用户签到

func DownloadFullContentLogFile

func DownloadFullContentLogFile(c *gin.Context)

func DriveQuotaWriterDrains

func DriveQuotaWriterDrains(c *gin.Context)

DriveQuotaWriterDrains is the admin recovery surface that synchronously drives the batch update queue, balance drain generations and projection obligations towards zero, bounded by the requested budget.

func EditTagChannels

func EditTagChannels(c *gin.Context)

func EmailBind

func EmailBind(c *gin.Context)

func Enable2FA

func Enable2FA(c *gin.Context)

Enable2FA 启用2FA

func EnableTagChannels

func EnableTagChannels(c *gin.Context)

func EnabledListModels

func EnabledListModels(c *gin.Context)

func EpayNotify

func EpayNotify(c *gin.Context)

func ExtendDeployment

func ExtendDeployment(c *gin.Context)

func FetchCustomOAuthDiscovery

func FetchCustomOAuthDiscovery(c *gin.Context)

FetchCustomOAuthDiscovery fetches OIDC discovery document via backend (root-only route)

func FetchModels

func FetchModels(c *gin.Context)

func FetchUpstreamModels

func FetchUpstreamModels(c *gin.Context)

func FetchUpstreamRatios

func FetchUpstreamRatios(c *gin.Context)

func FixChannelsAbilities

func FixChannelsAbilities(c *gin.Context)

func ForceGC

func ForceGC(c *gin.Context)

ForceGC 强制执行 GC

func GenerateAccessToken

func GenerateAccessToken(c *gin.Context)

func GenerateOAuthCode

func GenerateOAuthCode(c *gin.Context)

GenerateOAuthCode generates a state code for OAuth CSRF protection

func Get2FAStatus

func Get2FAStatus(c *gin.Context)

Get2FAStatus 获取用户2FA状态

func GetAbout

func GetAbout(c *gin.Context)

func GetAffCode

func GetAffCode(c *gin.Context)

func GetAllChannels

func GetAllChannels(c *gin.Context)

func GetAllDeployments

func GetAllDeployments(c *gin.Context)

func GetAllFlowQuotaDates

func GetAllFlowQuotaDates(c *gin.Context)

func GetAllLogs

func GetAllLogs(c *gin.Context)

func GetAllMidjourney

func GetAllMidjourney(c *gin.Context)

func GetAllModelsMeta

func GetAllModelsMeta(c *gin.Context)

GetAllModelsMeta 获取模型列表(分页)

func GetAllQuotaDates

func GetAllQuotaDates(c *gin.Context)

func GetAllRedemptions

func GetAllRedemptions(c *gin.Context)

func GetAllTask

func GetAllTask(c *gin.Context)

func GetAllTokens

func GetAllTokens(c *gin.Context)

func GetAllTopUps

func GetAllTopUps(c *gin.Context)

GetAllTopUps 管理员获取全平台充值记录

func GetAllUsers

func GetAllUsers(c *gin.Context)

func GetAllVendors

func GetAllVendors(c *gin.Context)

GetAllVendors 获取供应商列表(分页)

func GetAuthHeader

func GetAuthHeader(token string) http.Header

GetAuthHeader get auth header

func GetAvailableReplicas

func GetAvailableReplicas(c *gin.Context)

func GetChannel

func GetChannel(c *gin.Context)

func GetChannelAffinityCacheStats

func GetChannelAffinityCacheStats(c *gin.Context)

func GetChannelAffinityUsageCacheStats

func GetChannelAffinityUsageCacheStats(c *gin.Context)

func GetChannelKey

func GetChannelKey(c *gin.Context)

GetChannelKey 获取渠道密钥(需要通过安全验证中间件) 此函数依赖 SecureVerificationRequired 中间件,确保用户已通过安全验证

func GetChannelOps

func GetChannelOps(c *gin.Context)

func GetChannelQuotaAlertDeliveryEvents

func GetChannelQuotaAlertDeliveryEvents(c *gin.Context)

func GetChannelQuotaAlertDeliveryStatus

func GetChannelQuotaAlertDeliveryStatus(c *gin.Context)

func GetChannelQuotaChanges

func GetChannelQuotaChanges(c *gin.Context)

GetChannelQuotaChanges returns one redacted trend item per channel/metric/ window/source group. It is intentionally read-only: no provider is queried and no credentials or raw provider responses are returned.

func GetChannelQuotaHistory

func GetChannelQuotaHistory(c *gin.Context)

GetChannelQuotaHistory returns normalized quota observations for a channel. It deliberately excludes raw upstream responses and credentials. The range is fully read before aggregation; when an explicit safety budget would be exceeded, the response is marked incomplete instead of pretending that the newest observations represent the requested range.

func GetChannelQuotaSamplingStatus

func GetChannelQuotaSamplingStatus(c *gin.Context)

GetChannelQuotaSamplingStatus exposes only the effective sampler settings so administrators can understand an empty trend panel without inspecting the deployment environment. It never starts a task or returns credentials.

func GetChannelRoutingPreview

func GetChannelRoutingPreview(c *gin.Context)

func GetChargedAmount

func GetChargedAmount(count float64, user model.User) float64

func GetCheckinStatus

func GetCheckinStatus(c *gin.Context)

GetCheckinStatus 获取用户签到状态和历史记录

func GetClaudeAuthHeader

func GetClaudeAuthHeader(token string) http.Header

GetClaudeAuthHeader get claude auth header

func GetCodexChannelRateLimitResetCredits

func GetCodexChannelRateLimitResetCredits(c *gin.Context)

func GetCodexChannelUsage

func GetCodexChannelUsage(c *gin.Context)

func GetCodexChannelUsageHistory

func GetCodexChannelUsageHistory(c *gin.Context)

GetCodexChannelUsageHistory serves normalized snapshots collected by the usage endpoint. It reuses the bounded history response contract while enforcing the Codex metric scope for callers that do not pass a filter.

func GetCodexLocalAuthStatus

func GetCodexLocalAuthStatus(c *gin.Context)

func GetContainerDetails

func GetContainerDetails(c *gin.Context)

func GetCurrentSystemTask

func GetCurrentSystemTask(c *gin.Context)

func GetCustomOAuthProvider

func GetCustomOAuthProvider(c *gin.Context)

GetCustomOAuthProvider returns a single custom OAuth provider by ID

func GetCustomOAuthProviders

func GetCustomOAuthProviders(c *gin.Context)

GetCustomOAuthProviders returns all custom OAuth providers

func GetDeployment

func GetDeployment(c *gin.Context)

func GetDeploymentLogs

func GetDeploymentLogs(c *gin.Context)

func GetEpayClient

func GetEpayClient(paymentConfig setting.PaymentConfig) *epay.Client

func GetFullContentLogDetail

func GetFullContentLogDetail(c *gin.Context)

func GetGroups

func GetGroups(c *gin.Context)

func GetHardwareTypes

func GetHardwareTypes(c *gin.Context)

func GetHomePageContent

func GetHomePageContent(c *gin.Context)

func GetImage

func GetImage(c *gin.Context)

func GetLocations

func GetLocations(c *gin.Context)

func GetLogByKey

func GetLogByKey(c *gin.Context)

func GetLogFiles

func GetLogFiles(c *gin.Context)

GetLogFiles 获取日志文件列表

func GetLoginSessions

func GetLoginSessions(c *gin.Context)

func GetLogsSelfStat

func GetLogsSelfStat(c *gin.Context)

func GetLogsStat

func GetLogsStat(c *gin.Context)

func GetMidjourney

func GetMidjourney(c *gin.Context)

func GetMissingModels

func GetMissingModels(c *gin.Context)

GetMissingModels returns the list of model names that are referenced by channels but do not have corresponding records in the models meta table. This helps administrators quickly discover models that need configuration.

func GetModelDeploymentSettings

func GetModelDeploymentSettings(c *gin.Context)

func GetModelMeta

func GetModelMeta(c *gin.Context)

GetModelMeta 根据 ID 获取单条模型信息

func GetNotice

func GetNotice(c *gin.Context)

func GetOptionDiagnostics

func GetOptionDiagnostics(c *gin.Context)

GetOptionDiagnostics serves the root-only, no-store diagnostics route. Its business path never reads a runtime generation or cache; platform-level authentication and rate limiting remain responsible for their own controls.

func GetOptionRemediations

func GetOptionRemediations(c *gin.Context)

GetOptionRemediations serves the paginated remediation registry. Registry rows contain keys, hashes, statuses, and backup references only; backup values never leave the database through this or any other API.

func GetOptions

func GetOptions(c *gin.Context)

func GetOptionsTypedBulkRevision

func GetOptionsTypedBulkRevision(c *gin.Context)

GetOptionsTypedBulkRevision handles GET /api/option/typed-bulk/revision and exposes the current persistent typed bulk revision so admin forms can load it before issuing a CAS-guarded bulk save.

func GetPerfMetrics

func GetPerfMetrics(c *gin.Context)

func GetPerfMetricsSummary

func GetPerfMetricsSummary(c *gin.Context)

func GetPerformanceStats

func GetPerformanceStats(c *gin.Context)

GetPerformanceStats 获取性能统计信息

func GetPermissionCatalog

func GetPermissionCatalog(c *gin.Context)

GetPermissionCatalog returns the permission schema used by the client to render the permission editor: the registry of resources with their actions and display label keys, plus the roles with their baseline grant matrices. Defining it in the authz package keeps the schema in a single place.

func GetPrefillGroups

func GetPrefillGroups(c *gin.Context)

GetPrefillGroups 获取预填组列表,可通过 ?type=xxx 过滤

func GetPriceEstimation

func GetPriceEstimation(c *gin.Context)

func GetPricing

func GetPricing(c *gin.Context)

func GetPrivacyPolicy

func GetPrivacyPolicy(c *gin.Context)

func GetPromptLearningPolicy

func GetPromptLearningPolicy(c *gin.Context)

func GetQuotaDatesByUser

func GetQuotaDatesByUser(c *gin.Context)

func GetQuotaWriterStatus

func GetQuotaWriterStatus(c *gin.Context)

GetQuotaWriterStatus serves the admin quota-writer overview: persisted epoch/mode, the fail-closed durable-write audit and this process's in-flight billing session count.

func GetQuotaWriterTransitionPlan

func GetQuotaWriterTransitionPlan(c *gin.Context)

GetQuotaWriterTransitionPlan serves the read-only transition plan for the requested target mode.

func GetQuotaWriterTransitions

func GetQuotaWriterTransitions(c *gin.Context)

GetQuotaWriterTransitions serves the paginated transition evidence history.

func GetRankings

func GetRankings(c *gin.Context)

func GetRatioConfig

func GetRatioConfig(c *gin.Context)

func GetRedemption

func GetRedemption(c *gin.Context)

func GetResponseBody

func GetResponseBody(ctx context.Context, method, url string, channel *model.Channel, headers http.Header) ([]byte, error)

func GetSelf

func GetSelf(c *gin.Context)

func GetSetup

func GetSetup(c *gin.Context)

func GetStatus

func GetStatus(c *gin.Context)

func GetSubscription

func GetSubscription(c *gin.Context)

func GetSubscriptionPlans

func GetSubscriptionPlans(c *gin.Context)

func GetSubscriptionSelf

func GetSubscriptionSelf(c *gin.Context)

func GetSyncableChannels

func GetSyncableChannels(c *gin.Context)

func GetSystemTask

func GetSystemTask(c *gin.Context)

func GetTagModels

func GetTagModels(c *gin.Context)

func GetTaskOperation

func GetTaskOperation(c *gin.Context)

GetTaskOperation returns one sanitized durable operation to its owner.

func GetToken

func GetToken(c *gin.Context)

func GetTokenAutoGroups

func GetTokenAutoGroups(c *gin.Context)

func GetTokenKey

func GetTokenKey(c *gin.Context)

func GetTokenKeysBatch

func GetTokenKeysBatch(c *gin.Context)

func GetTokenStatus

func GetTokenStatus(c *gin.Context)

func GetTokenUsage

func GetTokenUsage(c *gin.Context)

func GetTopUpInfo

func GetTopUpInfo(c *gin.Context)

func GetUptimeKumaStatus

func GetUptimeKumaStatus(c *gin.Context)

func GetUsage

func GetUsage(c *gin.Context)

func GetUser

func GetUser(c *gin.Context)

func GetUserAgreement

func GetUserAgreement(c *gin.Context)

func GetUserFlowQuotaDates

func GetUserFlowQuotaDates(c *gin.Context)

func GetUserGroups

func GetUserGroups(c *gin.Context)

func GetUserLogs

func GetUserLogs(c *gin.Context)

func GetUserMidjourney

func GetUserMidjourney(c *gin.Context)

func GetUserModels

func GetUserModels(c *gin.Context)

func GetUserOAuthBindings

func GetUserOAuthBindings(c *gin.Context)

GetUserOAuthBindings returns all OAuth bindings for the current user

func GetUserOAuthBindingsByAdmin

func GetUserOAuthBindingsByAdmin(c *gin.Context)

func GetUserQuotaDates

func GetUserQuotaDates(c *gin.Context)

func GetUserTask

func GetUserTask(c *gin.Context)

func GetUserTopUps

func GetUserTopUps(c *gin.Context)

func GetVendorMeta

func GetVendorMeta(c *gin.Context)

GetVendorMeta 根据 ID 获取供应商

func HandleOAuth

func HandleOAuth(c *gin.Context)

HandleOAuth handles OAuth callback for all standard OAuth providers

func ImportCodexLocalAuth

func ImportCodexLocalAuth(c *gin.Context)

func ImportCodexLocalAuthForChannel

func ImportCodexLocalAuthForChannel(c *gin.Context)

func ListDeploymentContainers

func ListDeploymentContainers(c *gin.Context)

func ListFullContentLogFiles

func ListFullContentLogFiles(c *gin.Context)

func ListFullContentLogs

func ListFullContentLogs(c *gin.Context)

func ListModels

func ListModels(c *gin.Context, modelType int)

func ListPromptLearningRuns

func ListPromptLearningRuns(c *gin.Context)

func ListPromptLearningVersions

func ListPromptLearningVersions(c *gin.Context)

func ListSystemInstances

func ListSystemInstances(c *gin.Context)

func ListSystemTasks

func ListSystemTasks(c *gin.Context)

func ListWaffoPancakeCatalog

func ListWaffoPancakeCatalog(c *gin.Context)

ListWaffoPancakeCatalog returns the merchant's Stores + OnetimeProducts. Doubles as a credential probe (a successful 200 proves the resolved creds authenticate). See resolveWaffoPancakeAdminCreds for credential resolution.

func ListWaffoPancakeSubscriptionProductOptions

func ListWaffoPancakeSubscriptionProductOptions(c *gin.Context)

ListWaffoPancakeSubscriptionProductOptions returns the OnetimeProducts in the saved Pancake store, for the subscription-plan dropdown. The name reflects MyAPI's plan concept; under the hood it's still OnetimeProducts.

func LockOrder

func LockOrder(tradeNo string)

LockOrder 尝试对给定订单号加锁

func Login

func Login(c *gin.Context)

func ManageMultiKeys

func ManageMultiKeys(c *gin.Context)

ManageMultiKeys handles multi-key management operations

func ManageUser

func ManageUser(c *gin.Context)

ManageUser Only admin user can do this

func OllamaDeleteModel

func OllamaDeleteModel(c *gin.Context)

OllamaDeleteModel 删除 Ollama 模型

func OllamaPullModel

func OllamaPullModel(c *gin.Context)

OllamaPullModel 拉取 Ollama 模型

func OllamaPullModelStream

func OllamaPullModelStream(c *gin.Context)

OllamaPullModelStream 流式拉取 Ollama 模型

func OllamaVersion

func OllamaVersion(c *gin.Context)

OllamaVersion 获取 Ollama 服务版本信息

func OptionRemediateApply

func OptionRemediateApply(c *gin.Context)

OptionRemediateApply applies action instances previously produced by the dry-run. The service/model chain rebuilds every judgment, enforces the per-row value-hash CAS, writes the backup and registry rows in the same transaction as each repair, and publishes through the existing runtime chain. Rows are independent: skipped and failed rows are registered, never rolled into a fake batch atomicity.

func OptionRemediateDryRun

func OptionRemediateDryRun(c *gin.Context)

OptionRemediateDryRun previews whitelisted option normalizations. The preview is strictly zero-write: no option row, OptionMap entry, runtime generation, or remediation registry row is created; the only side effect is the management audit entry (keys and hashes, never values).

func PasskeyDelete

func PasskeyDelete(c *gin.Context)

func PasskeyLoginBegin

func PasskeyLoginBegin(c *gin.Context)

func PasskeyLoginFinish

func PasskeyLoginFinish(c *gin.Context)

func PasskeyRegisterBegin

func PasskeyRegisterBegin(c *gin.Context)

func PasskeyRegisterFinish

func PasskeyRegisterFinish(c *gin.Context)

func PasskeyStatus

func PasskeyStatus(c *gin.Context)

func PasskeyVerifyBegin

func PasskeyVerifyBegin(c *gin.Context)

func PasskeyVerifyFinish

func PasskeyVerifyFinish(c *gin.Context)

func Playground

func Playground(c *gin.Context)

func PostSetup

func PostSetup(c *gin.Context)

func RebuildChannelAffinityCache

func RebuildChannelAffinityCache(c *gin.Context)

RebuildChannelAffinityCache 按当前配置代重建亲和缓存(维护操作)。

保存 channel_affinity_setting 只更新配置代;max_entries / default_ttl_seconds 须经本端点(或重启)才进入生效缓存实例。重建原子换入新实例: 进行中的请求继续使用旧实例直到结束,新请求使用新代参数构造的实例。

func RebuildDiskCache

func RebuildDiskCache(c *gin.Context)

RebuildDiskCache 按已保存的配置代重建磁盘缓存放置(维护操作)。

保存性能设置只更新配置代:热字段(启用/阈值)立即生效,磁盘目录与容量 (disk_cache_path / disk_cache_max_size_mb)不迁移正在使用的缓存。 本端点是放置字段的显式生效路径(带排空语义):先校验新目录可创建可写, 成功后一次性换入新生效代;失败保留旧生效代并返回错误。 已打开的磁盘缓存实例按绝对路径管理自己的文件,不受换代影响。

func RefreshAuth

func RefreshAuth(c *gin.Context)

func RefreshCodexChannelCredential

func RefreshCodexChannelCredential(c *gin.Context)

func RegenerateBackupCodes

func RegenerateBackupCodes(c *gin.Context)

RegenerateBackupCodes 重新生成备用码

func Register

func Register(c *gin.Context)

func RegisterScheduledSystemTasks

func RegisterScheduledSystemTasks()

RegisterScheduledSystemTasks wires the periodic channel test, upstream model update, and async task polling (Midjourney / Suno / video) jobs into the system task framework so a DB lease dedups execution across multiple master instances and each run is recorded as one task row. Call this before service.StartSystemTaskRunner.

func Relay

func Relay(c *gin.Context, relayFormat types.RelayFormat)

func RelayMidjourney

func RelayMidjourney(c *gin.Context)

func RelayNotFound

func RelayNotFound(c *gin.Context)

func RelayNotImplemented

func RelayNotImplemented(c *gin.Context)

func RelayTask

func RelayTask(c *gin.Context)

func RelayTaskFetch

func RelayTaskFetch(c *gin.Context)

func RequestAmount

func RequestAmount(c *gin.Context)

func RequestCreemPay

func RequestCreemPay(c *gin.Context)

func RequestEpay

func RequestEpay(c *gin.Context)

func RequestStripeAmount

func RequestStripeAmount(c *gin.Context)

func RequestStripePay

func RequestStripePay(c *gin.Context)

func RequestWaffoAmount

func RequestWaffoAmount(c *gin.Context)

func RequestWaffoPancakeAmount

func RequestWaffoPancakeAmount(c *gin.Context)

func RequestWaffoPancakePay

func RequestWaffoPancakePay(c *gin.Context)

func RequestWaffoPay

func RequestWaffoPay(c *gin.Context)

RequestWaffoPay 创建 Waffo 支付订单

func ResetCodexChannelUsage

func ResetCodexChannelUsage(c *gin.Context)

func ResetModelRatio

func ResetModelRatio(c *gin.Context)

func ResetPassword

func ResetPassword(c *gin.Context)

func ResetPerformanceStats

func ResetPerformanceStats(c *gin.Context)

ResetPerformanceStats 重置性能统计

func RetrieveModel

func RetrieveModel(c *gin.Context, modelType int)

func RevokeOtherLoginSessions

func RevokeOtherLoginSessions(c *gin.Context)

func RunChannelQuotaAlertDelivery

func RunChannelQuotaAlertDelivery(c *gin.Context)

func SaveWaffoPancake

func SaveWaffoPancake(c *gin.Context)

SaveWaffoPancake atomically persists all five operator-controlled fields. Catalog / pair endpoints are transient — only this one writes the OptionMap.

func SearchAllLogs deprecated

func SearchAllLogs(c *gin.Context)

Deprecated: SearchAllLogs 已废弃,前端未使用该接口。

func SearchChannels

func SearchChannels(c *gin.Context)

func SearchDeployments

func SearchDeployments(c *gin.Context)

func SearchModelsMeta

func SearchModelsMeta(c *gin.Context)

SearchModelsMeta 搜索模型列表

func SearchRedemptions

func SearchRedemptions(c *gin.Context)

func SearchTokens

func SearchTokens(c *gin.Context)

func SearchUserLogs deprecated

func SearchUserLogs(c *gin.Context)

Deprecated: SearchUserLogs 已废弃,前端未使用该接口。

func SearchUsers

func SearchUsers(c *gin.Context)

func SearchVendors

func SearchVendors(c *gin.Context)

SearchVendors 搜索供应商

func SendEmailVerification

func SendEmailVerification(c *gin.Context)

func SendPasswordResetEmail

func SendPasswordResetEmail(c *gin.Context)

func Setup2FA

func Setup2FA(c *gin.Context)

Setup2FA 初始化2FA设置

func StartCodexOAuth

func StartCodexOAuth(c *gin.Context)

func StartCodexOAuthForChannel

func StartCodexOAuthForChannel(c *gin.Context)

func StripeWebhook

func StripeWebhook(c *gin.Context)

func SubscriptionEpayNotify

func SubscriptionEpayNotify(c *gin.Context)

func SubscriptionEpayReturn

func SubscriptionEpayReturn(c *gin.Context)

SubscriptionEpayReturn handles browser return after payment. It verifies the payload and completes the order, then redirects to console.

func SubscriptionRequestBalancePay

func SubscriptionRequestBalancePay(c *gin.Context)

func SubscriptionRequestCreemPay

func SubscriptionRequestCreemPay(c *gin.Context)

func SubscriptionRequestEpay

func SubscriptionRequestEpay(c *gin.Context)

func SubscriptionRequestStripePay

func SubscriptionRequestStripePay(c *gin.Context)

func SubscriptionRequestWaffoPancakePay

func SubscriptionRequestWaffoPancakePay(c *gin.Context)

func SyncUpstreamModels

func SyncUpstreamModels(c *gin.Context)

SyncUpstreamModels 同步上游模型与供应商: - 默认仅创建「未配置模型」 - 可通过 overwrite 选择性覆盖更新本地已有模型的字段(前提:sync_official <> 0)

func SyncUpstreamPreview

func SyncUpstreamPreview(c *gin.Context)

SyncUpstreamPreview 预览上游与本地的差异(仅用于弹窗选择)

func TelegramBind

func TelegramBind(c *gin.Context)

func TelegramBindStart

func TelegramBindStart(c *gin.Context)

func TelegramLogin

func TelegramLogin(c *gin.Context)

func TestAllChannels

func TestAllChannels(c *gin.Context)

TestAllChannels enqueues a channel_test system task instead of running the test loop inline. If any channel_test task is already active, the manual run is rejected so the caller does not mistake a scheduled run for this manual one.

func TestChannel

func TestChannel(c *gin.Context)

func TestIoNetConnection

func TestIoNetConnection(c *gin.Context)

func TestStatus

func TestStatus(c *gin.Context)

func TopUp

func TopUp(c *gin.Context)

func TransferAffQuota

func TransferAffQuota(c *gin.Context)

func UnbindCustomOAuth

func UnbindCustomOAuth(c *gin.Context)

UnbindCustomOAuth unbinds a custom OAuth provider from the current user

func UnbindCustomOAuthByAdmin

func UnbindCustomOAuthByAdmin(c *gin.Context)

func UniversalVerify

func UniversalVerify(c *gin.Context)

func UnlockOrder

func UnlockOrder(tradeNo string)

UnlockOrder 释放给定订单号的锁

func UpdateAllChannelsBalance

func UpdateAllChannelsBalance(c *gin.Context)

func UpdateChannel

func UpdateChannel(c *gin.Context)

func UpdateChannelBalance

func UpdateChannelBalance(c *gin.Context)

func UpdateChannelQuotaAlertDeliverySettings

func UpdateChannelQuotaAlertDeliverySettings(c *gin.Context)

func UpdateChannelStatus

func UpdateChannelStatus(c *gin.Context)

func UpdateCustomOAuthProvider

func UpdateCustomOAuthProvider(c *gin.Context)

UpdateCustomOAuthProvider updates an existing custom OAuth provider

func UpdateDeployment

func UpdateDeployment(c *gin.Context)

func UpdateDeploymentName

func UpdateDeploymentName(c *gin.Context)

func UpdateModelMeta

func UpdateModelMeta(c *gin.Context)

UpdateModelMeta 更新模型

func UpdateOption

func UpdateOption(c *gin.Context)

func UpdateOptionsTypedBulk

func UpdateOptionsTypedBulk(c *gin.Context)

UpdateOptionsTypedBulk handles PUT /api/option/typed-bulk.

Status contract: 400 for malformed bodies and rejected items (unknown or duplicate keys, out-of-range bounds, invalid values), 409 for an expected-revision mismatch (zero writes, current revision echoed for reload), 500 for database failures and post-commit publication aborts. On success the new revision and the sorted applied key list are returned.

func UpdatePaymentFundingOptions

func UpdatePaymentFundingOptions(c *gin.Context)

func UpdatePrefillGroup

func UpdatePrefillGroup(c *gin.Context)

UpdatePrefillGroup 更新预填组

func UpdatePromptLearningPolicy

func UpdatePromptLearningPolicy(c *gin.Context)

func UpdateRedemption

func UpdateRedemption(c *gin.Context)

func UpdateSelf

func UpdateSelf(c *gin.Context)

func UpdateSubscriptionPreference

func UpdateSubscriptionPreference(c *gin.Context)

func UpdateToken

func UpdateToken(c *gin.Context)

func UpdateUser

func UpdateUser(c *gin.Context)

func UpdateUserSetting

func UpdateUserSetting(c *gin.Context)

func UpdateVendorMeta

func UpdateVendorMeta(c *gin.Context)

UpdateVendorMeta 更新供应商

func UserFundingMutationGate

func UserFundingMutationGate(c *gin.Context)

func Verify2FALogin

func Verify2FALogin(c *gin.Context)

Verify2FALogin 登录时验证2FA

func VideoProxy

func VideoProxy(c *gin.Context)

func WaffoPancakeWebhook

func WaffoPancakeWebhook(c *gin.Context)

func WaffoWebhook

func WaffoWebhook(c *gin.Context)

WaffoWebhook 处理 Waffo 回调通知(支付/退款/订阅)

func WeChatAuth

func WeChatAuth(c *gin.Context)

func WeChatBind

func WeChatBind(c *gin.Context)

Types

type AIProxyUserOverviewResponse

type AIProxyUserOverviewResponse struct {
	Success   bool   `json:"success"`
	Message   string `json:"message"`
	ErrorCode int    `json:"error_code"`
	Data      struct {
		TotalPoints float64 `json:"totalPoints"`
	} `json:"data"`
}

type APGC2DGPTUsageResponse

type APGC2DGPTUsageResponse struct {
	//Grants         interface{} `json:"grants"`
	Object         string  `json:"object"`
	TotalAvailable float64 `json:"total_available"`
	TotalGranted   float64 `json:"total_granted"`
	TotalUsed      float64 `json:"total_used"`
}

type API2GPTUsageResponse

type API2GPTUsageResponse struct {
	Object         string  `json:"object"`
	TotalGranted   float64 `json:"total_granted"`
	TotalUsed      float64 `json:"total_used"`
	TotalRemaining float64 `json:"total_remaining"`
}

type AddChannelRequest

type AddChannelRequest struct {
	Mode                      string                `json:"mode"`
	MultiKeyMode              constant.MultiKeyMode `json:"multi_key_mode"`
	BatchAddSetKeyPrefix2Name bool                  `json:"batch_add_set_key_prefix_2_name"`
	Channel                   *model.Channel        `json:"channel"`
}

type AdminBindSubscriptionRequest

type AdminBindSubscriptionRequest struct {
	UserId int `json:"user_id"`
	PlanId int `json:"plan_id"`
}

type AdminCompleteTopupRequest

type AdminCompleteTopupRequest struct {
	TradeNo string `json:"trade_no"`
}

type AdminCreateUserSubscriptionRequest

type AdminCreateUserSubscriptionRequest struct {
	PlanId int `json:"plan_id"`
}

type AdminResetSubscriptionRequest

type AdminResetSubscriptionRequest struct {
	PlanId           int   `json:"plan_id"`
	AdvanceResetTime *bool `json:"advance_reset_time"`
}

type AdminUpdateSubscriptionPlanStatusRequest

type AdminUpdateSubscriptionPlanStatusRequest struct {
	Enabled *bool `json:"enabled"`
}

type AdminUpsertSubscriptionPlanRequest

type AdminUpsertSubscriptionPlanRequest struct {
	Plan model.SubscriptionPlan `json:"plan"`
}

type AmountRequest

type AmountRequest struct {
	Amount int64 `json:"amount"`
}

type BillingPreferenceRequest

type BillingPreferenceRequest struct {
	BillingPreference string `json:"billing_preference"`
}

type ChannelBatch

type ChannelBatch struct {
	Ids []int   `json:"ids"`
	Tag *string `json:"tag"`
}

type ChannelStatusBatchRequest

type ChannelStatusBatchRequest struct {
	Ids    []int `json:"ids"`
	Status int   `json:"status"`
}

type ChannelStatusRequest

type ChannelStatusRequest struct {
	Status int `json:"status"`
}

type ChannelTag

type ChannelTag struct {
	Tag            string  `json:"tag"`
	NewTag         *string `json:"new_tag"`
	Priority       *int64  `json:"priority"`
	Weight         *uint   `json:"weight"`
	ModelMapping   *string `json:"model_mapping"`
	Models         *string `json:"models"`
	Groups         *string `json:"groups"`
	ParamOverride  *string `json:"param_override"`
	HeaderOverride *string `json:"header_override"`
}

type CreateCustomOAuthProviderRequest

type CreateCustomOAuthProviderRequest struct {
	Name                  string `json:"name" binding:"required"`
	Slug                  string `json:"slug" binding:"required"`
	Icon                  string `json:"icon"`
	Enabled               bool   `json:"enabled"`
	ClientId              string `json:"client_id" binding:"required"`
	ClientSecret          string `json:"client_secret" binding:"required"`
	AuthorizationEndpoint string `json:"authorization_endpoint" binding:"required"`
	TokenEndpoint         string `json:"token_endpoint" binding:"required"`
	UserInfoEndpoint      string `json:"user_info_endpoint" binding:"required"`
	Scopes                string `json:"scopes"`
	UserIdField           string `json:"user_id_field"`
	UsernameField         string `json:"username_field"`
	DisplayNameField      string `json:"display_name_field"`
	EmailField            string `json:"email_field"`
	WellKnown             string `json:"well_known"`
	AuthStyle             int    `json:"auth_style"`
	AccessPolicy          string `json:"access_policy"`
	AccessDeniedMessage   string `json:"access_denied_message"`
}

CreateCustomOAuthProviderRequest is the request structure for creating a custom OAuth provider

type CreemAdaptor

type CreemAdaptor struct {
}

func (*CreemAdaptor) RequestPay

func (*CreemAdaptor) RequestPay(c *gin.Context, req *CreemPayRequest)

type CreemCheckoutRequest

type CreemCheckoutRequest struct {
	ProductId string `json:"product_id"`
	RequestId string `json:"request_id"`
	Customer  struct {
		Email string `json:"email"`
	} `json:"customer"`
	Metadata map[string]string `json:"metadata,omitempty"`
}

type CreemCheckoutResponse

type CreemCheckoutResponse struct {
	CheckoutUrl string `json:"checkout_url"`
	Id          string `json:"id"`
}

type CreemPayRequest

type CreemPayRequest struct {
	ProductId     string `json:"product_id"`
	PaymentMethod string `json:"payment_method"`
}

type CreemProduct

type CreemProduct struct {
	ProductId string  `json:"productId"`
	Name      string  `json:"name"`
	Price     float64 `json:"price"`
	Currency  string  `json:"currency"`
	Quota     int64   `json:"quota"`
}

type CreemWebhookEvent

type CreemWebhookEvent struct {
	Id        string `json:"id"`
	EventType string `json:"eventType"`
	CreatedAt int64  `json:"created_at"`
	Object    struct {
		Id        string `json:"id"`
		Object    string `json:"object"`
		RequestId string `json:"request_id"`
		Order     struct {
			Object      string `json:"object"`
			Id          string `json:"id"`
			Customer    string `json:"customer"`
			Product     string `json:"product"`
			Amount      int    `json:"amount"`
			Currency    string `json:"currency"`
			SubTotal    int    `json:"sub_total"`
			TaxAmount   int    `json:"tax_amount"`
			AmountDue   int    `json:"amount_due"`
			AmountPaid  int    `json:"amount_paid"`
			Status      string `json:"status"`
			Type        string `json:"type"`
			Transaction string `json:"transaction"`
			CreatedAt   string `json:"created_at"`
			UpdatedAt   string `json:"updated_at"`
			Mode        string `json:"mode"`
		} `json:"order"`
		Product struct {
			Id                string  `json:"id"`
			Object            string  `json:"object"`
			Name              string  `json:"name"`
			Description       string  `json:"description"`
			Price             int     `json:"price"`
			Currency          string  `json:"currency"`
			BillingType       string  `json:"billing_type"`
			BillingPeriod     string  `json:"billing_period"`
			Status            string  `json:"status"`
			TaxMode           string  `json:"tax_mode"`
			TaxCategory       string  `json:"tax_category"`
			DefaultSuccessUrl *string `json:"default_success_url"`
			CreatedAt         string  `json:"created_at"`
			UpdatedAt         string  `json:"updated_at"`
			Mode              string  `json:"mode"`
		} `json:"product"`
		Units    int `json:"units"`
		Customer struct {
			Id        string `json:"id"`
			Object    string `json:"object"`
			Email     string `json:"email"`
			Name      string `json:"name"`
			Country   string `json:"country"`
			CreatedAt string `json:"created_at"`
			UpdatedAt string `json:"updated_at"`
			Mode      string `json:"mode"`
		} `json:"customer"`
		Status   string            `json:"status"`
		Metadata map[string]string `json:"metadata"`
		Mode     string            `json:"mode"`
	} `json:"object"`
}

新的Creem Webhook结构体,匹配实际的webhook数据格式

type CustomOAuthProviderResponse

type CustomOAuthProviderResponse struct {
	Id                    int    `json:"id"`
	Name                  string `json:"name"`
	Slug                  string `json:"slug"`
	Icon                  string `json:"icon"`
	Enabled               bool   `json:"enabled"`
	ClientId              string `json:"client_id"`
	AuthorizationEndpoint string `json:"authorization_endpoint"`
	TokenEndpoint         string `json:"token_endpoint"`
	UserInfoEndpoint      string `json:"user_info_endpoint"`
	Scopes                string `json:"scopes"`
	UserIdField           string `json:"user_id_field"`
	UsernameField         string `json:"username_field"`
	DisplayNameField      string `json:"display_name_field"`
	EmailField            string `json:"email_field"`
	WellKnown             string `json:"well_known"`
	AuthStyle             int    `json:"auth_style"`
	AccessPolicy          string `json:"access_policy"`
	AccessDeniedMessage   string `json:"access_denied_message"`
}

CustomOAuthProviderResponse is the response structure for custom OAuth providers It excludes sensitive fields like client_secret

type DeepSeekUsageResponse

type DeepSeekUsageResponse struct {
	IsAvailable  bool `json:"is_available"`
	BalanceInfos []struct {
		Currency        string `json:"currency"`
		TotalBalance    string `json:"total_balance"`
		GrantedBalance  string `json:"granted_balance"`
		ToppedUpBalance string `json:"topped_up_balance"`
	} `json:"balance_infos"`
}

type DiskCacheInfo

type DiskCacheInfo struct {
	// 缓存目录路径
	Path string `json:"path"`
	// 目录是否存在
	Exists bool `json:"exists"`
	// 文件数量
	FileCount int `json:"file_count"`
	// 总大小(字节)
	TotalSize int64 `json:"total_size"`
}

DiskCacheInfo 磁盘缓存目录信息

type EpayRequest

type EpayRequest struct {
	Amount        int64  `json:"amount"`
	PaymentMethod string `json:"payment_method"`
}

type FetchCustomOAuthDiscoveryRequest

type FetchCustomOAuthDiscoveryRequest struct {
	WellKnownURL string `json:"well_known_url"`
	IssuerURL    string `json:"issuer_url"`
}

type FullContentLogDetail

type FullContentLogDetail struct {
	FullContentLogSummary
	RequestContentType     string              `json:"request_content_type,omitempty"`
	RequestEncoding        string              `json:"request_encoding,omitempty"`
	RequestBody            string              `json:"request_body"`
	ResponseContentType    string              `json:"response_content_type,omitempty"`
	ResponseEncoding       string              `json:"response_encoding,omitempty"`
	ResponseBody           string              `json:"response_body"`
	ResponseBodyTotalBytes int64               `json:"response_body_total_bytes,omitempty"`
	ResponseBodyTruncated  bool                `json:"response_body_truncated,omitempty"`
	RequestHeaders         map[string][]string `json:"request_headers"`
	ResponseHeaders        map[string][]string `json:"response_headers"`
	Query                  map[string][]string `json:"query"`
}

type FullContentLogFacets

type FullContentLogFacets struct {
	Models []string                    `json:"models"`
	Tokens []FullContentLogTokenOption `json:"tokens"`
}

type FullContentLogFileInfo

type FullContentLogFileInfo struct {
	Name       string    `json:"name"`
	Size       int64     `json:"size"`
	ModifiedAt time.Time `json:"modified_at"`
}

type FullContentLogFileStats

type FullContentLogFileStats struct {
	Count     int                      `json:"count"`
	TotalSize int64                    `json:"total_size"`
	Files     []FullContentLogFileInfo `json:"files"`
}

type FullContentLogListResponse

type FullContentLogListResponse struct {
	Enabled  bool                    `json:"enabled"`
	Page     int                     `json:"page"`
	PageSize int                     `json:"page_size"`
	Total    int                     `json:"total"`
	Items    []FullContentLogSummary `json:"items"`
	Files    FullContentLogFileStats `json:"files"`
	Facets   FullContentLogFacets    `json:"facets"`
}

type FullContentLogSummary

type FullContentLogSummary struct {
	Timestamp     string `json:"timestamp"`
	RequestID     string `json:"request_id"`
	Method        string `json:"method"`
	Path          string `json:"path"`
	Model         string `json:"model,omitempty"`
	Status        int    `json:"status"`
	DurationMS    int64  `json:"duration_ms"`
	RequestBytes  int64  `json:"request_bytes"`
	ResponseBytes int64  `json:"response_bytes"`
	ChunkCount    int64  `json:"chunk_count"`
	UserID        int    `json:"user_id,omitempty"`
	TokenID       int    `json:"token_id,omitempty"`
	TokenName     string `json:"token_name,omitempty"`
	ClientIP      string `json:"client_ip,omitempty"`
	Error         string `json:"error,omitempty"`
}

type FullContentLogTokenOption

type FullContentLogTokenOption struct {
	ID   int    `json:"id"`
	Name string `json:"name"`
}

type KeyStatus

type KeyStatus struct {
	Index        int    `json:"index"`
	Status       int    `json:"status"` // 1: enabled, 2: disabled
	DisabledTime int64  `json:"disabled_time,omitempty"`
	Reason       string `json:"reason,omitempty"`
	KeyPreview   string `json:"key_preview"` // first 10 chars of key for identification
}

type LogFileInfo

type LogFileInfo struct {
	Name    string    `json:"name"`
	Size    int64     `json:"size"`
	ModTime time.Time `json:"mod_time"`
}

LogFileInfo 日志文件信息

type LogFilesResponse

type LogFilesResponse struct {
	LogDir     string        `json:"log_dir"`
	Enabled    bool          `json:"enabled"`
	FileCount  int           `json:"file_count"`
	TotalSize  int64         `json:"total_size"`
	OldestTime *time.Time    `json:"oldest_time,omitempty"`
	NewestTime *time.Time    `json:"newest_time,omitempty"`
	Files      []LogFileInfo `json:"files"`
}

LogFilesResponse 日志文件列表响应

type LoginRequest

type LoginRequest struct {
	Username string `json:"username"`
	Password string `json:"password"`
}

type ManageRequest

type ManageRequest struct {
	Id        int    `json:"id"`
	Action    string `json:"action"`
	Value     int    `json:"value"`
	Mode      string `json:"mode"`
	RequestId string `json:"request_id"`
}

type MemoryStats

type MemoryStats struct {
	// 已分配内存(字节)
	Alloc uint64 `json:"alloc"`
	// 总分配内存(字节)
	TotalAlloc uint64 `json:"total_alloc"`
	// 系统内存(字节)
	Sys uint64 `json:"sys"`
	// GC 次数
	NumGC uint32 `json:"num_gc"`
	// Goroutine 数量
	NumGoroutine int `json:"num_goroutine"`
}

MemoryStats 内存统计

type Monitor

type Monitor struct {
	Name   string  `json:"name"`
	Uptime float64 `json:"uptime"`
	Status int     `json:"status"`
	Group  string  `json:"group,omitempty"`
}

type MultiKeyManageRequest

type MultiKeyManageRequest struct {
	ChannelId int    `json:"channel_id"`
	Action    string `json:"action"`              // "disable_key", "enable_key", "delete_key", "delete_disabled_keys", "get_key_status"
	KeyIndex  *int   `json:"key_index,omitempty"` // for disable_key, enable_key, and delete_key actions
	Page      int    `json:"page,omitempty"`      // for get_key_status pagination
	PageSize  int    `json:"page_size,omitempty"` // for get_key_status pagination
	Status    *int   `json:"status,omitempty"`    // for get_key_status filtering: 1=enabled, 2=manual_disabled, 3=auto_disabled, nil=all
}

MultiKeyManageRequest represents the request for multi-key management operations

type MultiKeyStatusResponse

type MultiKeyStatusResponse struct {
	Keys       []KeyStatus `json:"keys"`
	Total      int         `json:"total"`
	Page       int         `json:"page"`
	PageSize   int         `json:"page_size"`
	TotalPages int         `json:"total_pages"`
	// Statistics
	EnabledCount        int `json:"enabled_count"`
	ManualDisabledCount int `json:"manual_disabled_count"`
	AutoDisabledCount   int `json:"auto_disabled_count"`
}

MultiKeyStatusResponse represents the response for key status query

type OAuthEmailAlreadyTakenError

type OAuthEmailAlreadyTakenError struct{}

func (*OAuthEmailAlreadyTakenError) Error

type OAuthRegistrationDisabledError

type OAuthRegistrationDisabledError struct{}

func (*OAuthRegistrationDisabledError) Error

type OAuthUserDeletedError

type OAuthUserDeletedError struct{}

Error types for OAuth

func (*OAuthUserDeletedError) Error

func (e *OAuthUserDeletedError) Error() string

type OpenAICreditGrants

type OpenAICreditGrants struct {
	Object         string  `json:"object"`
	TotalGranted   float64 `json:"total_granted"`
	TotalUsed      float64 `json:"total_used"`
	TotalAvailable float64 `json:"total_available"`
}

type OpenAIModel

type OpenAIModel struct {
	ID         string         `json:"id"`
	Object     string         `json:"object"`
	Created    int64          `json:"created"`
	OwnedBy    string         `json:"owned_by"`
	Metadata   map[string]any `json:"metadata,omitempty"`
	Permission []struct {
		ID                 string `json:"id"`
		Object             string `json:"object"`
		Created            int64  `json:"created"`
		AllowCreateEngine  bool   `json:"allow_create_engine"`
		AllowSampling      bool   `json:"allow_sampling"`
		AllowLogprobs      bool   `json:"allow_logprobs"`
		AllowSearchIndices bool   `json:"allow_search_indices"`
		AllowView          bool   `json:"allow_view"`
		AllowFineTuning    bool   `json:"allow_fine_tuning"`
		Organization       string `json:"organization"`
		Group              string `json:"group"`
		IsBlocking         bool   `json:"is_blocking"`
	} `json:"permission"`
	Root   string `json:"root"`
	Parent string `json:"parent"`
}

type OpenAIModelsResponse

type OpenAIModelsResponse struct {
	Data    []OpenAIModel `json:"data"`
	Success bool          `json:"success"`
}

type OpenAISBUsageResponse

type OpenAISBUsageResponse struct {
	Msg  string `json:"msg"`
	Data *struct {
		Credit string `json:"credit"`
	} `json:"data"`
}

type OpenAISubscriptionResponse

type OpenAISubscriptionResponse struct {
	Object             string  `json:"object"`
	HasPaymentMethod   bool    `json:"has_payment_method"`
	SoftLimitUSD       float64 `json:"soft_limit_usd"`
	HardLimitUSD       float64 `json:"hard_limit_usd"`
	SystemHardLimitUSD float64 `json:"system_hard_limit_usd"`
	AccessUntil        int64   `json:"access_until"`
}

type OpenAIUsageDailyCost

type OpenAIUsageDailyCost struct {
	Timestamp float64 `json:"timestamp"`
	LineItems []struct {
		Name string  `json:"name"`
		Cost float64 `json:"cost"`
	}
}

type OpenAIUsageResponse

type OpenAIUsageResponse struct {
	Object string `json:"object"`
	//DailyCosts []OpenAIUsageDailyCost `json:"daily_costs"`
	TotalUsage float64 `json:"total_usage"` // unit: 0.01 dollar
}

type OpenRouterCreditResponse

type OpenRouterCreditResponse struct {
	Data struct {
		TotalCredits float64 `json:"total_credits"`
		TotalUsage   float64 `json:"total_usage"`
	} `json:"data"`
}

type OptionUpdateRequest

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

type PasswordResetRequest

type PasswordResetRequest struct {
	Email string `json:"email"`
	Token string `json:"token"`
}

type PatchChannel

type PatchChannel struct {
	model.Channel
	MultiKeyMode *string `json:"multi_key_mode"`
	KeyMode      *string `json:"key_mode"` // 多key模式下密钥覆盖或者追加
}

type PaymentComplianceRequest

type PaymentComplianceRequest struct {
	Confirmed bool `json:"confirmed"`
}

type PaymentFundingOptionsUpdateRequest

type PaymentFundingOptionsUpdateRequest struct {
	Values map[string]any `json:"values"`
}

type PerformanceConfig

type PerformanceConfig struct {
	// 是否启用磁盘缓存
	DiskCacheEnabled bool `json:"disk_cache_enabled"`
	// 磁盘缓存阈值(MB)
	DiskCacheThresholdMB int `json:"disk_cache_threshold_mb"`
	// 磁盘缓存最大大小(MB,配置代/已保存值)
	DiskCacheMaxSizeMB int `json:"disk_cache_max_size_mb"`
	// 磁盘缓存路径(配置代/已保存值)
	DiskCachePath string `json:"disk_cache_path"`
	// ActiveDiskCacheMaxSizeMB 生效代磁盘缓存最大大小(MB)
	ActiveDiskCacheMaxSizeMB int `json:"active_disk_cache_max_size_mb"`
	// ActiveDiskCachePath 生效代磁盘缓存路径
	ActiveDiskCachePath string `json:"active_disk_cache_path"`
	// DiskCacheRebuildRequired 为 true 表示路径/容量已保存但未生效,
	// 需要 POST /api/option/disk_cache/rebuild 维护重建或重启
	DiskCacheRebuildRequired bool `json:"disk_cache_rebuild_required"`
	// 是否在容器中运行
	IsRunningInContainer bool `json:"is_running_in_container"`

	// MonitorEnabled 是否启用性能监控
	MonitorEnabled bool `json:"monitor_enabled"`
	// MonitorCPUThreshold CPU 使用率阈值(%)
	MonitorCPUThreshold int `json:"monitor_cpu_threshold"`
	// MonitorMemoryThreshold 内存使用率阈值(%)
	MonitorMemoryThreshold int `json:"monitor_memory_threshold"`
	// MonitorDiskThreshold 磁盘使用率阈值(%)
	MonitorDiskThreshold int `json:"monitor_disk_threshold"`
}

PerformanceConfig 性能配置

type PerformanceStats

type PerformanceStats struct {
	// 缓存统计
	CacheStats common.DiskCacheStats `json:"cache_stats"`
	// 系统内存统计
	MemoryStats MemoryStats `json:"memory_stats"`
	// 磁盘缓存目录信息
	DiskCacheInfo DiskCacheInfo `json:"disk_cache_info"`
	// 磁盘空间信息
	DiskSpaceInfo common.DiskSpaceInfo `json:"disk_space_info"`
	// 配置信息
	Config PerformanceConfig `json:"config"`
}

PerformanceStats 性能统计信息

type Setup

type Setup struct {
	Status       bool   `json:"status"`
	RootInit     bool   `json:"root_init"`
	DatabaseType string `json:"database_type"`
}

type Setup2FARequest

type Setup2FARequest struct {
	Code string `json:"code" binding:"required"`
}

Setup2FARequest 设置2FA请求结构

type Setup2FAResponse

type Setup2FAResponse struct {
	Secret      string   `json:"secret"`
	QRCodeData  string   `json:"qr_code_data"`
	BackupCodes []string `json:"backup_codes"`
}

Setup2FAResponse 设置2FA响应结构

type SetupRequest

type SetupRequest struct {
	Username           string `json:"username"`
	Password           string `json:"password"`
	ConfirmPassword    string `json:"confirmPassword"`
	SelfUseModeEnabled bool   `json:"SelfUseModeEnabled"`
	DemoSiteEnabled    bool   `json:"DemoSiteEnabled"`
}

type SiliconFlowUsageResponse

type SiliconFlowUsageResponse struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
	Status  bool   `json:"status"`
	Data    struct {
		ID            string `json:"id"`
		Name          string `json:"name"`
		Image         string `json:"image"`
		Email         string `json:"email"`
		IsAdmin       bool   `json:"isAdmin"`
		Balance       string `json:"balance"`
		Status        string `json:"status"`
		Introduction  string `json:"introduction"`
		Role          string `json:"role"`
		ChargeBalance string `json:"chargeBalance"`
		TotalBalance  string `json:"totalBalance"`
		Category      string `json:"category"`
	} `json:"data"`
}

type StripeAdaptor

type StripeAdaptor struct {
}

func (*StripeAdaptor) RequestAmount

func (*StripeAdaptor) RequestAmount(c *gin.Context, req *StripePayRequest)

func (*StripeAdaptor) RequestPay

func (*StripeAdaptor) RequestPay(c *gin.Context, req *StripePayRequest)

type StripePayRequest

type StripePayRequest struct {
	// Amount is the quantity of units to purchase.
	Amount int64 `json:"amount"`
	// PaymentMethod specifies the payment method (e.g., "stripe").
	PaymentMethod string `json:"payment_method"`
	// SuccessURL is the optional custom URL to redirect after successful payment.
	// If empty, defaults to the server's console log page.
	SuccessURL string `json:"success_url,omitempty"`
	// CancelURL is the optional custom URL to redirect when payment is canceled.
	// If empty, defaults to the server's console topup page.
	CancelURL string `json:"cancel_url,omitempty"`
}

StripePayRequest represents a payment request for Stripe checkout.

type SubscriptionBalancePayRequest

type SubscriptionBalancePayRequest struct {
	PlanId int `json:"plan_id"`
}

type SubscriptionCreemPayRequest

type SubscriptionCreemPayRequest struct {
	PlanId int `json:"plan_id"`
}

type SubscriptionEpayPayRequest

type SubscriptionEpayPayRequest struct {
	PlanId        int    `json:"plan_id"`
	PaymentMethod string `json:"payment_method"`
}

type SubscriptionPlanDTO

type SubscriptionPlanDTO struct {
	Plan model.SubscriptionPlan `json:"plan"`
}

type SubscriptionStripePayRequest

type SubscriptionStripePayRequest struct {
	PlanId int `json:"plan_id"`
}

type SubscriptionWaffoPancakePayRequest

type SubscriptionWaffoPancakePayRequest struct {
	PlanId int `json:"plan_id"`
}

type TaskBillingOutboxSummary

type TaskBillingOutboxSummary struct {
	DeliveredCount int `json:"delivered_count"`
}

TaskBillingOutboxSummary records the delivery count of one outbox pass.

type TaskRecoverySummary

type TaskRecoverySummary struct {
	RecoveredDispatching   int `json:"recovered_dispatching"`
	RecoveredUnfinished    int `json:"recovered_unfinished"`
	RecoveredBillingEvents int `json:"recovered_billing_events"`
}

TaskRecoverySummary records the result of one task recovery pass.

type TokenBatch

type TokenBatch struct {
	Ids []int `json:"ids"`
}

type TransferAffQuotaRequest

type TransferAffQuotaRequest struct {
	Quota     int    `json:"quota" binding:"required"`
	RequestId string `json:"request_id" binding:"required"`
}

type TypedBulkOptionsUpdateRequest

type TypedBulkOptionsUpdateRequest struct {
	ExpectedRevision *int64                  `json:"expected_revision"`
	Items            []model.TypedBulkOption `json:"items"`
}

TypedBulkOptionsUpdateRequest is the frozen typed bulk request contract (C09-N3a): a bounded item set with a closed value-type union, plus an optional expected-revision CAS guard.

type UniversalVerifyRequest

type UniversalVerifyRequest struct {
	Method string `json:"method"`
	Code   string `json:"code,omitempty"`
	Scope  string `json:"scope"`
}

type UpdateCustomOAuthProviderRequest

type UpdateCustomOAuthProviderRequest struct {
	Name                  string  `json:"name"`
	Slug                  string  `json:"slug"`
	Icon                  *string `json:"icon"`    // Optional: if nil, keep existing
	Enabled               *bool   `json:"enabled"` // Optional: if nil, keep existing
	ClientId              string  `json:"client_id"`
	ClientSecret          string  `json:"client_secret"` // Optional: if empty, keep existing
	AuthorizationEndpoint string  `json:"authorization_endpoint"`
	TokenEndpoint         string  `json:"token_endpoint"`
	UserInfoEndpoint      string  `json:"user_info_endpoint"`
	Scopes                string  `json:"scopes"`
	UserIdField           string  `json:"user_id_field"`
	UsernameField         string  `json:"username_field"`
	DisplayNameField      string  `json:"display_name_field"`
	EmailField            string  `json:"email_field"`
	WellKnown             *string `json:"well_known"`            // Optional: if nil, keep existing
	AuthStyle             *int    `json:"auth_style"`            // Optional: if nil, keep existing
	AccessPolicy          *string `json:"access_policy"`         // Optional: if nil, keep existing
	AccessDeniedMessage   *string `json:"access_denied_message"` // Optional: if nil, keep existing
}

UpdateCustomOAuthProviderRequest is the request structure for updating a custom OAuth provider

type UpdateUserSettingRequest

type UpdateUserSettingRequest struct {
	QuotaWarningType                 string  `json:"notify_type"`
	QuotaWarningThreshold            float64 `json:"quota_warning_threshold"`
	WebhookUrl                       string  `json:"webhook_url,omitempty"`
	WebhookSecret                    string  `json:"webhook_secret,omitempty"`
	NotificationEmail                string  `json:"notification_email,omitempty"`
	BarkUrl                          string  `json:"bark_url,omitempty"`
	GotifyUrl                        string  `json:"gotify_url,omitempty"`
	GotifyToken                      string  `json:"gotify_token,omitempty"`
	GotifyPriority                   int     `json:"gotify_priority,omitempty"`
	UpstreamModelUpdateNotifyEnabled *bool   `json:"upstream_model_update_notify_enabled,omitempty"`
	AcceptUnsetModelRatioModel       bool    `json:"accept_unset_model_ratio_model"`
	RecordIpLog                      bool    `json:"record_ip_log"`
}

type UptimeGroupResult

type UptimeGroupResult struct {
	CategoryName string    `json:"categoryName"`
	Monitors     []Monitor `json:"monitors"`
}

type UserOAuthBindingResponse

type UserOAuthBindingResponse struct {
	ProviderId     int    `json:"provider_id"`
	ProviderName   string `json:"provider_name"`
	ProviderSlug   string `json:"provider_slug"`
	ProviderIcon   string `json:"provider_icon"`
	ProviderUserId string `json:"provider_user_id"`
}

type Verify2FARequest

type Verify2FARequest struct {
	Code      string `json:"code" binding:"required"`
	FlowToken string `json:"flow_token,omitempty"`
}

Verify2FARequest 验证2FA请求结构

type WaffoPancakePayRequest

type WaffoPancakePayRequest struct {
	Amount int64 `json:"amount"`
}

type WaffoPayRequest

type WaffoPayRequest struct {
	Amount         int64  `json:"amount"`
	PayMethodIndex *int   `json:"pay_method_index"` // 服务端支付方式列表的索引,nil 表示由 Waffo 自动选择
	PayMethodType  string `json:"pay_method_type"`  // Deprecated: 兼容旧前端,优先使用 pay_method_index
	PayMethodName  string `json:"pay_method_name"`  // Deprecated: 兼容旧前端,优先使用 pay_method_index
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL