MCPcopy Create free account

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

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

↓ 5 callersFunctionCountTextToken
CountTextToken 统计文本的token数量,仅OpenAI模型使用tokenizer,其余模型使用估算
service/token_counter.go:402
↓ 5 callersFunctionCreateBodyStorage
CreateBodyStorage 根据数据大小创建合适的存储
common/body_storage.go:286
↓ 5 callersMethodDefinedModes
DefinedModes returns each distinct mode on the protocol in host-table order.
pkg/jsplugin/routing.go:120
↓ 5 callersMethodDelete
()
model/channel.go:625
↓ 5 callersFunctionDispatchPlatformUpdate
DispatchPlatformUpdate 按平台分发轮询更新
service/task_polling.go:195
↓ 5 callersFunctionEnableWorker
()
setting/system_setting/system_setting_old.go:9
↓ 5 callersMethodFlush
()
router/plugin-router.go:452
↓ 5 callersFunctionGenerateTextOtherInfo
(ctx *gin.Context, relayInfo *relaycommon.RelayInfo, modelRatio, groupRatio, completionRatio float64, cacheTo
service/log_info_generate.go:72
↓ 5 callersFunctionGetAudioCompletionRatio
(name string)
setting/ratio_setting/model_ratio.go:614
↓ 5 callersFunctionGetAudioRatio
(name string)
setting/ratio_setting/model_ratio.go:606
↓ 5 callersFunctionGetBillingMode
--------------------------------------------------------------------------- Read accessors (hot path, must be fast) ----------------------------------
setting/billing_setting/tiered_billing.go:45
↓ 5 callersMethodGetCacheCreation1hTokens
()
relaykit/dto/claude.go:581
↓ 5 callersMethodGetCacheCreation5mTokens
()
relaykit/dto/claude.go:574
↓ 5 callersMethodGetChannelName
()
relay/channel/adapter.go:31
↓ 5 callersFunctionGetCompletionRatio
(name string)
setting/ratio_setting/model_ratio.go:419
↓ 5 callersFunctionGetConsoleSetting
GetConsoleSetting 获取 ConsoleSetting 配置实例
setting/console_setting/config.go:37
↓ 5 callersFunctionGetContextKeyType
(c *gin.Context, key constant.ContextKey)
common/gin.go:189
↓ 5 callersFunctionGetDiskCacheDir
GetDiskCacheDir 获取统一的磁盘缓存目录 注意:每次调用都会重新计算,以响应配置变化
common/disk_cache.go:25
↓ 5 callersFunctionGetDiskCachePath
GetDiskCachePath 获取磁盘缓存目录
common/disk_cache_config.go:65
↓ 5 callersFunctionGetEpayClient
()
controller/topup.go:136
↓ 5 callersFunctionGetGroupGroupRatio
(userGroup, usingGroup string)
setting/ratio_setting/group_ratio.go:88
↓ 5 callersMethodGetMaskedKey
()
model/token.go:80
↓ 5 callersFunctionGetModelPrice
GetModelPrice 返回模型的价格,如果模型不存在则返回-1,false
setting/ratio_setting/model_ratio.go:360
↓ 5 callersMethodGetNextEnabledKey
()
model/channel.go:204
↓ 5 callersMethodGetPage
()
common/page_info.go:29
↓ 5 callersFunctionGetTaskPluginSyncSnapshot
GetTaskPluginSyncSnapshot returns the enabled override set together with a deterministic revision of every active database override. Nodes can compare
model/task_plugin.go:122
↓ 5 callersFunctionGetTokenById
(id int)
model/token.go:270
↓ 5 callersMethodGetTokenCountMeta
()
relaykit/dto/request_common.go:9
↓ 5 callersFunctionGetToolPrice
GetToolPrice is a convenience wrapper when no model name is needed.
setting/operation_setting/tools.go:217
↓ 5 callersFunctionGetToolPriceForModel
GetToolPriceForModel returns the price ($/1K calls) for a tool given a model name. Lookup: longest prefix match → tool default → 0.
setting/operation_setting/tools.go:192
↓ 5 callersFunctionGetUserUsableGroups
(userGroup string)
service/group.go:14
↓ 5 callersFunctionGetUsernameById
GetUsernameById gets username from Redis first, falls back to DB if needed
model/user.go:1425
↓ 5 callersFunctionHasGeminiUsageMetadataTokens
(metadata *GeminiUsageMetadata)
relaykit/dto/billing_usage.go:190
↓ 5 callersFunctionHostProtocol
(name string)
pkg/jsplugin/routing.go:93
↓ 5 callersMethodInsert
()
model/subscription.go:230
↓ 5 callersFunctionIssueAccessToken
(identity AuthIdentity)
service/auth_token.go:60
↓ 5 callersMethodListArtifacts
(task *model.Task)
relay/channel/adapter.go:104
↓ 5 callersFunctionListModels
(c *gin.Context, modelType int)
controller/model.go:218
↓ 5 callersFunctionLoadFileSource
LoadFileSource 加载文件源数据 这是统一的入口,会自动处理缓存和不同的来源类型
service/file_service.go:47
↓ 5 callersMethodLookupDeclaredRoute
LookupDeclaredRoute resolves a manifest path declaration. It does not match an incoming concrete URL; runtime matching is delegated to Gin.
pkg/jsplugin/routing.go:437
↓ 5 callersFunctionNewFileSourceFromData
(data string, mimeType string)
relaykit/types/file_source.go:134
↓ 5 callersFunctionNewGeminiChatBillingUsage
(metadata *GeminiUsageMetadata)
relaykit/dto/billing_usage.go:106
↓ 5 callersFunctionNewRWMap
()
types/rw_map.go:27
↓ 5 callersFunctionNewUserSortOptions
(sortBy string, sortOrder string)
model/user.go:36
↓ 5 callersFunctionOaiResponsesStreamHandler
(c *gin.Context, info *relaycommon.RelayInfo, resp *http.Response)
relay/channel/openai/relay_responses.go:75
↓ 5 callersFunctionOaiStreamHandler
(c *gin.Context, info *relaycommon.RelayInfo, resp *http.Response)
relay/channel/openai/relay-openai.go:104
↓ 5 callersFunctionOpenAIChatRequestToClaudeMessages
(c context.Context, info convmeta.Meta, textRequest dto.GeneralOpenAIRequest)
relaykit/relayconvert/request_compat.go:18
↓ 5 callersFunctionOpenaiImageHandler
OpenaiImageHandler handles non-streaming OpenAI image responses (generations/edits), returning the parsed usage for billing.
relay/channel/openai/relay_image.go:34
↓ 5 callersMethodPlugins
()
pkg/jsplugin/routing.go:483
↓ 5 callersFunctionPreConsumeBilling
PreConsumeBilling 根据用户计费偏好创建 BillingSession 并执行预扣费。 会话存储在 relayInfo.Billing 上,供后续 Settle / Refund 使用。
service/billing.go:20
↓ 5 callersMethodProtocolSupports
ProtocolSupports reports whether the named protocol claim includes mode.
pkg/jsplugin/registry.go:97
↓ 5 callersFunctionRecordTopupLog
(userId int, content string, callerIp string, paymentMethod string, callbackPaymentMethod string)
model/log.go:269
↓ 5 callersFunctionRegister
Register registers an OAuth provider with the given name
oauth/registry.go:19
↓ 5 callersFunctionRelayTaskSubmit
RelayTaskSubmit 完成 task 提交的全部流程(每次尝试调用一次): 刷新渠道元数据 → 确定 platform/adaptor → 验证请求 → 估算计费(EstimateBilling) → 计算价格 → 预扣费(仅首次)→ 构建/发送/解析上游请求 → 提交后计费调整(Adju
relay/relay_task.go:196
↓ 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 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:488
↓ 5 callersFunctionSha1
(data []byte)
common/hash.go:22
↓ 5 callersFunctionShouldPreserveThinkingSuffix
ShouldPreserveThinkingSuffix 判断模型是否配置为保留 thinking/-nothinking/-low/-high/-medium 后缀
setting/model_setting/global.go:67
↓ 5 callersFunctionStrToMap
(str string)
common/str.go:47
↓ 5 callersFunctionTaskArtifactContent
(c *gin.Context)
controller/task.go:279
↓ 5 callersMethodToResponse
()
model/system_task.go:416
↓ 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:556
↓ 5 callersMethodUpdateAbilities
UpdateAbilities updates abilities of this channel. Make sure the channel is completed before calling this function.
model/ability.go:263
↓ 5 callersFunctionUpdateModelRatioByJSONString
(jsonStr string)
setting/ratio_setting/model_ratio.go:373
↓ 5 callersFunctionUpdateUserBindColumn
UpdateUserBindColumn 第三方账号绑定字段的专用更新。 绑定操作必须只写绑定列:若改为“读取完整用户 → 改一个字段 → 整体更新”, 读快照期间并发发生的封禁、降权或分组变更会被旧快照覆盖恢复。 角色、状态、分组只允许通过各自带锁/CAS 的专用方法修改。
model/user.go:207
↓ 5 callersFunctionUploadTaskPlugin
(c *gin.Context)
controller/task_plugin.go:36
↓ 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 callersFunctionallowPrivateTaskMediaTest
(t *testing.T)
controller/task_generic_test.go:57
↓ 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 callersFunctionasciiFold
asciiFold maps only 'A'–'Z' onto 'a'–'z'. Every other byte is unchanged. Unicode case folding is intentionally not applied: U+212A (KELVIN SIGN) must
pkg/jsplugin/model_fold.go:6
↓ 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 callersFunctionchannelMatchesExpectedTaskPlugin
(c *gin.Context, channel *model.Channel, expected string)
middleware/distributor.go:207
↓ 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 callersFunctioncreateReserveTestUser
(t *testing.T, quota int)
model/quota_reserve_test.go:14
↓ 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 callersFunctionevaluateTaskVisualConfig
( config: TaskVisualConfig, sample: Record<string, number | string>, schema?: BillingUsageSchema )
web/src/features/pricing/lib/task-expr.ts:280
↓ 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 callersFunctiongetChannelTypeIcon
(type: number)
web/src/features/channels/lib/channel-utils.ts:47
↓ 5 callersFunctiongetChannelTypeLabel
(type: number)
web/src/features/channels/lib/channel-utils.ts:39
← previousnext →701–800 of 10,934, ranked by callers