MCPcopy Create free account

hub / github.com/QuantumNous/new-api / functions

Functions10,934 in github.com/QuantumNous/new-api

↓ 7 callersMethodGetUpstreamModelName
()
relaykit/relayconvert/convmeta/meta.go:20
↓ 7 callersMethodGetUsageMetadata
()
relaykit/dto/gemini.go:496
↓ 7 callersFunctionGetUserSessionCached
GetUserSessionCached validates cached state first and falls back to the database on a miss or Redis read failure. A deny tombstone never falls back.
model/user_session.go:211
↓ 7 callersFunctionHeaderNavModuleAuth
(module string)
middleware/header_nav.go:104
↓ 7 callersFunctionInvalidatePricingCache
()
model/pricing.go:84
↓ 7 callersMethodIsNormalEnd
()
relay/common/stream_status.go:88
↓ 7 callersFunctionIssueSecurityProof
(identity AuthIdentity, method string, scopes []string)
service/auth_token.go:132
↓ 7 callersFunctionLoadFromJsonStringWithCallback
(m *RWMap[K, V], jsonStr string, onSuccess func())
types/rw_map.go:83
↓ 7 callersFunctionModelPriceHelper
(c *gin.Context, info *relaycommon.RelayInfo, promptTokens int, meta *types.TokenCountMeta)
relay/helper/price.go:73
↓ 7 callersFunctionOptionsOf
OptionsOf returns m's conversion options, or empty defaults when m is nil.
relaykit/relayconvert/convmeta/meta.go:210
↓ 7 callersFunctionParseHTTPStatusCodeRanges
(input string)
setting/operation_setting/status_code_ranges.go:117
↓ 7 callersFunctionPostConsumeUserSubscriptionDelta
Update subscription used amount by delta (positive consume more, negative refund).
model/subscription.go:1510
↓ 7 callersMethodRead
(p []byte)
relay/channel/openai/image_stream_test.go:152
↓ 7 callersFunctionRechargeEpay
RechargeEpay 原子完成易支付订单:订单行锁、状态校验、成功更新与用户额度增加 在同一个事务内完成,因此同一订单的并发/重复回调(包括多实例部署下)最多充值一次。 alreadyDone=true 表示订单此前已完成,本次为幂等重复回调。 进程内的 LockOrder 只是优化,正确性由本
model/topup.go:177
↓ 7 callersMethodSetWithTTL
(key string, v V, ttl time.Duration)
pkg/cachex/hybrid_cache.go:111
↓ 7 callersFunctionSetupContextForSelectedChannel
(c *gin.Context, channel *model.Channel, modelName string)
middleware/distributor.go:579
↓ 7 callersFunctionUpdateChannelStatus
(channelId int, usingKey string, status int, reason string)
model/channel.go:736
↓ 7 callersFunctionUpdateOption
(key string, value string)
model/option.go:231
↓ 7 callersFunctionUpdateUserUsedQuotaAndRequestCount
(id int, quota int)
model/user.go:1369
↓ 7 callersMethodUsage
()
relaykit/relayconvert/response_registry.go:368
↓ 7 callersFunctionUserAuth
()
middleware/auth.go:94
↓ 7 callersFunctionUserUsableGroups2JSONString
()
setting/user_usable_group.go:27
↓ 7 callersFunctionUsingLogDatabase
(databaseType DatabaseType)
common/database.go:40
↓ 7 callersFunctionValidateLoginSession
(identity AuthIdentity)
service/auth_session.go:114
↓ 7 callersFunctionabortWithOpenAiMessage
(c *gin.Context, statusCode int, message string, code ...types.ErrorCode)
middleware/utils.go:14
↓ 7 callersFunctionattachQuotaSaturation
attachQuotaSaturation records the request's quota clamp (if any) onto the consume log's other.admin_info and emits a request-correlated backend audit
service/log_info_generate.go:40
↓ 7 callersFunctionauthSigningKey
(purpose string)
service/auth_token.go:54
↓ 7 callersFunctioncreateUserSessionTestUser
(t *testing.T, userID int, authVersion int64)
model/user_session_test.go:66
↓ 7 callersFunctioncreditTopUpQuota
creditTopUpQuota atomically enforces the wallet ceiling while adding quota. Keeping the predicate and increment in one UPDATE prevents two concurrent
model/topup.go:88
↓ 7 callersFunctioncurrentEnforcer
()
service/authz/enforcer.go:63
↓ 7 callersFunctioneffectiveBillingUsage
(usage *dto.Usage)
service/billing_usage.go:20
↓ 7 callersFunctionfilterDisabledFactory
(factory map[string]*LoadedPlugin, disabled map[string]struct{})
pkg/jsplugin/registry.go:881
↓ 7 callersFunctiongeminiStreamHandler
(c *gin.Context, info *relaycommon.RelayInfo, resp *http.Response, callback func(data string, geminiResponse *
relay/channel/gemini/relay-gemini.go:147
↓ 7 callersFunctiongenerateTaskExprFromConfig
( config: TaskVisualConfig | null | undefined, schema: BillingUsageSchema )
web/src/features/pricing/lib/task-expr.ts:418
↓ 7 callersFunctiongetCurrencyLabel
()
web/src/lib/currency.ts:546
↓ 7 callersFunctiongetSubscriptionPlanByIdTx
(tx *gorm.DB, id int)
model/subscription.go:389
↓ 7 callersFunctiongetUserQuotaForPaymentGuardTest
(t *testing.T, userID int)
model/payment_method_guard_test.go:84
↓ 7 callersFunctionhasPermission
( user: AuthUser | null | undefined, resource: string, action: string )
web/src/lib/admin-permissions.ts:77
↓ 7 callersFunctionisDynamicPricingModel
(model: PricingModel)
web/src/features/pricing/lib/dynamic-price.ts:130
↓ 7 callersFunctionmanageMultiKeys
( params: MultiKeyManageParams )
web/src/features/channels/api.ts:373
↓ 7 callersFunctionnumberValue
(value: unknown)
web/src/features/dashboard/lib/flow.ts:145
↓ 7 callersFunctionpluginProtocolTestSSEEventTypes
(body string)
controller/plugin_protocol_test.go:1517
↓ 7 callersMethodprepareGeneration
( factory, override map[string]*LoadedPlugin, enabled, tolerateConflicts bool, retainCurrent map[string]str
pkg/jsplugin/registry.go:660
↓ 7 callersMethodpublishGeneration
( generation *RoutingGeneration, routingErrors map[string]string, activeOverride map[string]*LoadedPlugin,
pkg/jsplugin/registry.go:712
↓ 7 callersFunctionrateLimitFactory
(maxRequestNum int, duration int64, mark string)
middleware/rate-limit.go:147
↓ 7 callersMethodrecordRebuildFailure
(err error)
pkg/jsplugin/registry.go:766
↓ 7 callersFunctionredisIPRateLimitKey
(mark string, clientIP string)
middleware/rate-limit.go:44
↓ 7 callersMethodresolveActiveOverrides
( generation *RoutingGeneration, override map[string]*LoadedPlugin, enabled bool, )
pkg/jsplugin/registry.go:921
↓ 7 callersMethodresolveForConversion
(c *gin.Context, info *relaycommon.RelayInfo)
relay/channel/advancedcustom/adaptor.go:359
↓ 7 callersFunctionresolveLocalizedText
( value: LocalizedTextValue | undefined | null, language: string )
web/src/lib/localized-text.ts:36
↓ 7 callersFunctionrespondPluginProtocolError
(c *gin.Context, status int, code, message string)
controller/plugin_protocol.go:1268
↓ 7 callersMethodresponseSnapshot
(responseError *dto.PluginResponsesError)
relay/plugin_protocol.go:1004
↓ 7 callersFunctionsetupLogin
setupLogin creates a server-controlled login Session and returns the shared authentication bundle used by every login method.
controller/user.go:184
↓ 7 callersFunctionsetupTokenControllerTestDB
(t *testing.T)
controller/token_test.go:107
↓ 7 callersFunctionsyncCreditUserQuotaCache
syncCreditUserQuotaCache 在授信事务(充值/兑换等)提交后同步把增量补进缓存 余额。预扣以缓存值为准(存在期间),授信不能绕过它,否则新到账的额度在 缓存过期前不可用;缓存未命中无需处理,下次读取会从已提交的数据库余额水合。
model/user_cache.go:158
↓ 7 callersFunctionsyncTaskPluginsOnce
()
controller/task_plugin.go:605
↓ 7 callersFunctiontaskSubmissionRelayInfo
(billing relaycommon.BillingSettler)
controller/relay_task_plugin_test.go:377
↓ 7 callersFunctiontaskSubmissionTestContext
()
controller/relay_task_plugin_test.go:370
↓ 7 callersFunctiontestVideoResponsesProtocol
(t *testing.T, testCase videoResponsesTestCase)
plugins/video_responses_test_helpers_test.go:26
↓ 7 callersFunctionuseDebounce
(value: T, delay: number = 500)
web/src/hooks/use-debounce.ts:27
↓ 7 callersFunctionuseTableUrlState
( params: UseTableUrlStateParams )
web/src/hooks/use-table-url-state.ts:107
↓ 7 callersFunctionuserSessionCacheKey
(sid string)
model/user_session.go:124
↓ 7 callersFunctionwriteAuthSessionError
(c *gin.Context, err error)
controller/auth_session.go:164
↓ 6 callersFunctionActivateTaskPlugin
(key, version string)
model/task_plugin.go:170
↓ 6 callersMethodActiveOverridePlugins
()
pkg/jsplugin/registry.go:601
↓ 6 callersFunctionAdvanceCurrentSessionToUserVersion
AdvanceCurrentSessionToUserVersion is used when the security mutation and AuthVersion increment were committed in the same transaction (for example, a
service/auth_session.go:173
↓ 6 callersMethodBuildModelListRequest
(info *relaycommon.RelayInfo)
relay/channel/advancedcustom/adaptor.go:196
↓ 6 callersFunctionClaimExternalIdentityWithTx
ClaimExternalIdentityWithTx atomically claims a provider subject for one user. Repeating the exact mapping is idempotent; every competing subject or u
model/external_identity_claim.go:37
↓ 6 callersFunctionCompleteSubscriptionOrder
Complete a subscription order (idempotent). Creates a UserSubscription snapshot from the plan. expectedPaymentProvider guards against cross-gateway ca
model/subscription.go:569
↓ 6 callersFunctionConsumeAuthFlow
ConsumeAuthFlow atomically validates and consumes a flow. Optional match fields are enforced when non-zero so tokens cannot cross purposes or users.
model/auth_flow.go:183
↓ 6 callersMethodEnsureClaudeConvertInfo
EnsureClaudeConvertInfo lazily creates and returns the mutable OpenAI→Claude stream conversion state. For non-nil receivers, the same instance must be
relaykit/relayconvert/convmeta/meta.go:37
↓ 6 callersFunctionFatalLog
(v ...any)
common/sys_log.go:31
↓ 6 callersFunctionFormatClaudeResponseInfo
(claudeResponse *dto.ClaudeResponse, oaiResponse *dto.ChatCompletionsStreamResponse, claudeInfo *ClaudeRespons
relay/channel/claude/relay-claude.go:82
↓ 6 callersFunctionGeminiChatHandler
(c *gin.Context, info *relaycommon.RelayInfo, resp *http.Response)
relay/channel/gemini/relay-gemini.go:313
↓ 6 callersFunctionGenerateFinalUsageResponse
(id string, createAt int64, model string, usage dto.Usage)
relay/helper/common.go:217
↓ 6 callersFunctionGetActiveSystemTask
(taskType string)
model/system_task.go:132
↓ 6 callersFunctionGetContextKey
(c *gin.Context, key constant.ContextKey)
common/gin.go:161
↓ 6 callersFunctionGetContextKeyBool
(c *gin.Context, key constant.ContextKey)
common/gin.go:173
↓ 6 callersMethodGetIdentifier
()
relaykit/types/file_source.go:15
↓ 6 callersMethodGetModels
()
model/channel.go:294
↓ 6 callersFunctionGetPointer
(v T)
common/utils.go:302
↓ 6 callersFunctionGetRequestAutoGroups
GetRequestAutoGroups resolves the ordered Auto groups for the current token. The absence of the context value means that the token inherits the comple
service/group.go:97
↓ 6 callersFunctionGetSubscriptionPlanById
(id int)
model/subscription.go:385
↓ 6 callersMethodGetTools
GetTools 获取工具列表
relaykit/dto/claude.go:401
↓ 6 callersFunctionGetTopupGroupRatio
(name string)
common/topup-ratio.go:32
↓ 6 callersFunctionGetUserSessionBySID
(sid string)
model/user_session.go:198
↓ 6 callersFunctionGroupRatio2JSONString
()
setting/ratio_setting/group_ratio.go:71
↓ 6 callersFunctionHeaderNavModulePublicOrUserAuth
(module string)
middleware/header_nav.go:125
↓ 6 callersFunctionIncreaseTokenQuota
(tokenId int, key string, quota int)
model/token.go:377
↓ 6 callersMethodInsert
()
model/topup.go:53
↓ 6 callersMethodInsert
()
model/midjourney.go:164
↓ 6 callersMethodIsToolCall
()
relaykit/dto/openai_response.go:159
↓ 6 callersMethodMatchPathForModel
MatchPathForModel returns the first route whose IncomingPath and Models match. An empty Models list is a catch-all fallback for that incoming path.
relaykit/dto/channel_settings.go:173
↓ 6 callersFunctionMidjourneyErrorWrapper
(code int, desc string)
service/error.go:21
↓ 6 callersFunctionMigrateRetiredFrontendOptions
MigrateRetiredFrontendOptions normalizes options that belonged to the removed dashboard frontend. Each legacy console setting is migrated in its own t
model/frontend_option_migration.go:20
↓ 6 callersFunctionOpenaiHandler
(c *gin.Context, info *relaycommon.RelayInfo, resp *http.Response)
relay/channel/openai/relay-openai.go:222
↓ 6 callersFunctionPrepareTieredBillingForSelectedGroup
PrepareTieredBillingForSelectedGroup refreshes routing-dependent billing state before an upstream attempt. An existing session reserves any higher est
service/tiered_settle.go:125
↓ 6 callersFunctionQuotaRound
QuotaRound converts a float64 quota value to int using half-away-from-zero rounding with int32 saturation. Every tiered billing path (pre-consume, set
pkg/billingexpr/round.go:12
↓ 6 callersFunctionReloadPolicy
()
service/authz/enforcer.go:69
↓ 6 callersFunctionRemoveDisabledFields
RemoveDisabledFields 从请求 JSON 数据中移除渠道设置中禁用的字段 service_tier: 服务层级字段,可能导致额外计费(OpenAI、Claude、Responses API 支持) inference_geo: Claude 数据驻留推理区域字段(仅 Claude
relay/common/relay_info.go:989
← previousnext →501–600 of 10,934, ranked by callers