MCPcopy Create free account

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

Functions9,732 in github.com/QuantumNous/new-api

↓ 5 callersFunctionPreConsumeBilling
PreConsumeBilling 根据用户计费偏好创建 BillingSession 并执行预扣费。 会话存储在 relayInfo.Billing 上,供后续 Settle / Refund 使用。
service/billing.go:20
↓ 5 callersFunctionRecordTopupLog
(userId int, content string, callerIp string, paymentMethod string, callbackPaymentMethod string)
model/log.go:254
↓ 5 callersFunctionRegister
Register registers an OAuth provider with the given name
oauth/registry.go:19
↓ 5 callersMethodReset
Reset clears pending observations (used when a terminal response fails).
relay/common/tool_usage.go:129
↓ 5 callersFunctionResponseChunkData
(c *gin.Context, resp dto.ResponsesStreamResponse, data string)
relay/helper/common.go:87
↓ 5 callersFunctionRevokeUserSession
(userID int, sid, reason string)
model/user_session.go:544
↓ 5 callersMethodSaveToDB
SaveToDB 将配置保存到数据库
setting/config/config.go:71
↓ 5 callersMethodSetAutoGroups
(groups []string)
model/token.go:46
↓ 5 callersMethodSetModelName
(modelName string)
relaykit/dto/request_common.go:11
↓ 5 callersMethodSetSetting
(setting dto.UserSetting)
model/user.go:169
↓ 5 callersFunctionSetupContextForToken
(c *gin.Context, token *model.Token, parts ...string)
middleware/auth.go:486
↓ 5 callersFunctionSha1
(data []byte)
common/hash.go:22
↓ 5 callersFunctionShouldPreserveThinkingSuffix
ShouldPreserveThinkingSuffix 判断模型是否配置为保留 thinking/-nothinking/-low/-high/-medium 后缀
setting/model_setting/global.go:67
↓ 5 callersMethodToResponse
()
model/system_task.go:416
↓ 5 callersFunctionTokenAuth
()
middleware/auth.go:352
↓ 5 callersFunctionTryReserveUserQuota
TryReserveUserQuota atomically checks and deducts a user's wallet quota. 缓存命中时以缓存余额为准(避免批量模式下过期的数据库余额放大并发超扣); Redis 异常或水合失败时降级为数据库条件更新,保证服务可用。
model/quota_reserve.go:165
↓ 5 callersMethodUpdate
()
model/subscription.go:237
↓ 5 callersMethodUpdate
()
model/channel.go:542
↓ 5 callersMethodUpdateAbilities
UpdateAbilities updates abilities of this channel. Make sure the channel is completed before calling this function.
model/ability.go:243
↓ 5 callersFunctionUpdateConfigFromMap
UpdateConfigFromMap 从map更新配置对象(导出函数)
setting/config/config.go:281
↓ 5 callersFunctionUpdateOption
(key string, value string)
model/option.go:221
↓ 5 callersFunctionUpdateUserBindColumn
UpdateUserBindColumn 第三方账号绑定字段的专用更新。 绑定操作必须只写绑定列:若改为“读取完整用户 → 改一个字段 → 整体更新”, 读快照期间并发发生的封禁、降权或分组变更会被旧快照覆盖恢复。 角色、状态、分组只允许通过各自带锁/CAS 的专用方法修改。
model/user.go:207
↓ 5 callersFunctionUsageFromGeminiMetadata
(metadata *dto.GeminiUsageMetadata, fallbackPromptTokens int)
relaykit/relayconvert/response_compat.go:71
↓ 5 callersFunctionValidateConsoleSettings
(settingsStr string, settingType string)
setting/console_setting/validation.go:68
↓ 5 callersFunctionabortWithOpenAiMessage
(c *gin.Context, statusCode int, message string, code ...types.ErrorCode)
middleware/utils.go:12
↓ 5 callersFunctionapplyAuthBundle
( bundle: AuthBundle, synchronizeTabs = true )
web/src/lib/auth-session.ts:148
↓ 5 callersFunctionapplyUsagePostProcessing
(info *relaycommon.RelayInfo, usage *dto.Usage, responseBody []byte)
relay/channel/openai/usage.go:10
↓ 5 callersFunctionauthRotationData
(bundle *service.AuthBundle)
controller/auth_session.go:182
↓ 5 callersFunctionbuildChannelAffinityTemplateContextForTest
(meta channelAffinityMeta)
service/channel_affinity_template_test.go:17
↓ 5 callersFunctionbuildOpenAIStyleUsageFromClaudeUsage
(usage *dto.Usage)
relay/channel/claude/relay-claude.go:56
↓ 5 callersFunctionbuildQueryParams
buildQueryParams builds query parameters for GET requests
pkg/ionet/client.go:161
↓ 5 callersFunctioncacheGetTokenByKey
cacheGetTokenByKey 从缓存读取 token;不完整的哈希(如仅有配额字段)会被拒绝。
model/token_cache.go:94
↓ 5 callersFunctioncacheGetUserBase
(userId int)
model/user_cache.go:117
↓ 5 callersFunctioncallback
(authorization: unknown)
web/src/features/auth/components/telegram-login-dialog.tsx:56
↓ 5 callersFunctioncanonicalUsageFromResponse
(response any)
relaykit/relayconvert/response_registry.go:739
↓ 5 callersFunctioncolorAt
(index: number, palette?: readonly string[])
web/src/features/dashboard/lib/flow.ts:279
↓ 5 callersFunctioncompleteAssistantTiming
( message: Message, completedAt: number = Date.now() )
web/src/features/playground/lib/message/message-timing-utils.ts:22
↓ 5 callersFunctionconfigureTokenAutoGroupsTest
(t *testing.T, maxCount string, autoGroups string)
controller/token_auto_groups_test.go:19
↓ 5 callersFunctionconfirmPaymentComplianceForTest
(t *testing.T)
controller/payment_webhook_availability_test.go:11
↓ 5 callersFunctiondecodeData
(data []byte, target *T)
pkg/ionet/jsonutil.go:28
↓ 5 callersFunctiondoRequest
(c *gin.Context, req *http.Request, info *common.RelayInfo)
relay/channel/api_request.go:490
↓ 5 callersMethodensureStart
()
relaykit/relayconvert/internal/oai_responses/to_oai_chat_stream_resp.go:139
↓ 5 callersFunctionformatBillingCurrencyFromUSD
( amountUSD: number | null | undefined, options?: CurrencyFormatOptions )
web/src/lib/currency.ts:471
↓ 5 callersFunctionformatPricingNumber
(value: unknown)
web/src/features/system-settings/models/pricing-format.ts:55
↓ 5 callersFunctionformatQuotaWithCurrency
( quota: number | null | undefined, options?: CurrencyFormatOptions )
web/src/lib/currency.ts:516
↓ 5 callersFunctiongetChannelAffinityMeta
(c *gin.Context)
service/channel_affinity.go:375
↓ 5 callersFunctiongetMessageContent
(message: Message)
web/src/features/playground/lib/message/message-utils.ts:49
↓ 5 callersFunctiongetSavedChartPreferences
()
web/src/features/dashboard/lib/filters.ts:94
↓ 5 callersFunctiongetTaskQuota
(t *testing.T, id int64)
service/task_billing_test.go:303
↓ 5 callersFunctiongetTokenCacheKey
(key string)
model/token_cache.go:12
↓ 5 callersFunctiongetUserAvatarFallback
(name: string)
web/src/lib/avatar.ts:43
↓ 5 callersFunctiongetUserAvatarStyle
(name: string)
web/src/lib/avatar.ts:31
↓ 5 callersFunctioninvalidateTokenCacheForMutation
invalidateTokenCacheForMutation is called before a token metadata mutation writes to the database: it raises the fence and drops the cached hash so no
model/token_cache.go:38
↓ 5 callersFunctionisContentSizedColumn
(columnId: string)
web/src/components/data-table/core/content-sized-columns.ts:19
↓ 5 callersFunctionisDynamicPricingModel
(model: PricingModel)
web/src/features/pricing/lib/dynamic-price.ts:65
↓ 5 callersFunctionisJsonObjectValue
(value: unknown)
web/src/features/channels/lib/channel-form.ts:112
↓ 5 callersFunctionisPaymentComplianceConfirmed
()
controller/payment_webhook_availability.go:10
↓ 5 callersFunctionisRecord
(value: unknown)
web/src/lib/auth-session.ts:88
↓ 5 callersFunctionisTokenBasedModel
(model: PricingModel)
web/src/features/pricing/lib/model-helpers.ts:107
↓ 5 callersMethodmakeChunk
(delta dto.ChatCompletionsStreamResponseChoiceDelta, finishReason *string)
relaykit/relayconvert/internal/oai_responses/to_oai_chat_stream_resp.go:519
↓ 5 callersFunctionmergeModelNames
(base []string, appended []string)
controller/channel_upstream_update.go:107
↓ 5 callersFunctionmustRawMessage
(t *testing.T, value any)
relaykit/relayconvert/request_registry_test.go:698
↓ 5 callersFunctionnewFakeSMTPServer
(t *testing.T)
common/email_test.go:35
↓ 5 callersFunctionnewHTTPClientWithPolicyAndTLS
newHTTPClientWithPolicyAndTLS is a test seam that builds a never-used transport stack with the given policy and TLS config (for httptest certificate t
service/http_client.go:350
↓ 5 callersFunctionnewTokenAutoGroupsAuthenticatedContext
(t *testing.T, method string, target string, body any, userID int)
controller/token_auto_groups_test.go:67
↓ 5 callersFunctionnormalizeVisualTier
( tier: Partial<VisualTier> = {} )
web/src/features/pricing/lib/tier-expr.ts:61
↓ 5 callersFunctionparseAdvancedCustomConfig
( value: string | undefined )
web/src/features/channels/lib/advanced-custom.ts:531
↓ 5 callersFunctionparseLooseValue
(valueText: string)
web/src/features/channels/components/dialogs/param-override-editor-dialog.tsx:464
↓ 5 callersFunctionparseOptionalJson
(value: string | undefined)
web/src/features/channels/lib/channel-form.ts:107
↓ 5 callersFunctionparseRatioMap
(value: string)
web/src/features/system-settings/models/group-ratio-visual-editor.tsx:120
↓ 5 callersFunctionparseUsableMap
(value: string)
web/src/features/system-settings/models/group-ratio-visual-editor.tsx:127
↓ 5 callersFunctionpreserveToolPrices
(t *testing.T)
setting/operation_setting/tools_price_test.go:11
↓ 5 callersFunctionrequestClientIP
(router http.Handler, remoteAddr string, forwardedFor string)
middleware/trusted_proxies_test.go:13
↓ 5 callersFunctionrequireOptionMissing
(t *testing.T, db *gorm.DB, key string)
model/frontend_option_migration_test.go:37
↓ 5 callersFunctionrowMetrics
(row: FlowQuotaDataItem)
web/src/features/dashboard/lib/flow.ts:156
↓ 5 callersFunctionsanitizeAuthRedirect
( value: unknown, origin: string )
web/src/features/auth/lib/auth-redirect.ts:46
↓ 5 callersFunctionsanitizeFetchModelsError
(err error, key string)
controller/channel_upstream_update.go:284
↓ 5 callersFunctionsankeyDatumValue
( datum: Record<string, unknown>, key: string )
web/src/features/dashboard/lib/flow.ts:1041
↓ 5 callersFunctionseedPollingTask
(t *testing.T, channelID int, publicID string, upstreamID string)
service/task_polling_test.go:148
↓ 5 callersFunctionseedSubscriptionResetPlan
(t *testing.T, plan *SubscriptionPlan)
model/subscription_reset_test.go:12
↓ 5 callersFunctionseedTaskPollingChannel
(t *testing.T, id int, disableSleep bool)
service/task_polling_test.go:133
↓ 5 callersFunctionsetupAuthFlowControllerTest
(t *testing.T)
controller/auth_flow_test.go:51
↓ 5 callersFunctionsetupTokenAutoGroupsControllerTest
(t *testing.T)
controller/token_auto_groups_test.go:41
↓ 5 callersFunctionsplitBillingExprAndRequestRules
(expr: string)
web/src/features/pricing/lib/billing-expr.ts:561
↓ 5 callersFunctionstartHTTP2TLSServer
(t *testing.T, handler http.Handler)
service/http_client_transport_test.go:99
↓ 5 callersFunctionstringifyAdvancedCustomConfig
( config: AdvancedCustomConfig )
web/src/features/channels/lib/advanced-custom.ts:546
↓ 5 callersFunctiontestTLSClientConfig
(t *testing.T, server *httptest.Server)
service/http_client_transport_test.go:91
↓ 5 callersFunctiontextRegistryChatResponse
()
relaykit/relayconvert/response_registry_test.go:615
↓ 5 callersFunctiontoNumberOrNull
(value: unknown)
web/src/features/system-settings/models/model-pricing-core.ts:153
↓ 5 callersFunctionupdateChannel
( id: number, data: Partial<Channel> )
web/src/features/channels/api.ts:130
↓ 5 callersFunctionupdateUserCache
updateUserCache refreshes non-quota user cache fields. Quota is maintained by atomic quota delta paths and must not be overwritten by stale user snaps
model/user_cache.go:80
↓ 5 callersFunctionuseBranch
()
web/src/components/ai-elements/branch.tsx:49
↓ 5 callersFunctionuseLogsViewScope
()
web/src/features/usage-logs/components/usage-logs-provider.tsx:94
↓ 5 callersFunctionvalidateAdvancedCustomConfig
( config: AdvancedCustomConfig | null )
web/src/features/channels/lib/advanced-custom.ts:587
↓ 5 callersFunctionvalidateChannel
validateChannel 通用的渠道校验函数
controller/channel.go:474
↓ 5 callersFunctionwriteUserCache
(user *UserBase, includeQuota bool)
model/user_auth_cache.go:48
↓ 4 callersMethodAddAll
(other map[K]V)
types/rw_map.go:46
↓ 4 callersFunctionAdminResetUserSubscriptionsByPlan
(userId int, planId int, advanceResetTime bool)
model/subscription.go:1091
↓ 4 callersFunctionApiSuccessI18n
ApiSuccessI18n returns a translated success message based on the user's language preference
common/gin.go:232
↓ 4 callersMethodAppendRequestConversion
AppendRequestConversion records a hop in the request format chain.
relaykit/relayconvert/convmeta/meta.go:45
← previousnext →601–700 of 9,732, ranked by callers