MCPcopy Create free account

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

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

↓ 8 callersFunctionRecalculateTaskQuota
RecalculateTaskQuota 通用的异步差额结算。 actualQuota 是任务完成后的实际应扣额度,与预扣额度 (task.Quota) 做差额结算。 reason 用于日志记录(例如 "token重算" 或 "adaptor调整")。 clamps 可选:若计算 actualQuo
service/task_billing.go:201
↓ 8 callersFunctionRecordConsumeLog
(c *gin.Context, userId int, params RecordConsumeLogParams)
model/log.go:343
↓ 8 callersMethodRecordError
(msg string)
relay/common/stream_status.go:55
↓ 8 callersFunctionRefundTaskQuota
RefundTaskQuota 统一的任务失败退款逻辑。 当异步任务失败时,将预扣的 quota 退还给用户(支持钱包和订阅),并退还令牌额度。
service/task_billing.go:165
↓ 8 callersFunctionResetProxyClientCache
ResetProxyClientCache 清空代理客户端缓存,确保下次使用时重新初始化
service/http_client.go:112
↓ 8 callersMethodSetEstimatePromptTokens
func (info *RelayInfo) SetPromptTokens(promptTokens int) { info.promptTokens = promptTokens }
relay/common/relay_info.go:656
↓ 8 callersMethodSetProgressStr
(progress string)
dto/openai_video.go:33
↓ 8 callersFunctionUpdateChannelUsedQuota
(id int, quota int)
model/channel.go:855
↓ 8 callersFunctionUpdateUserUsedQuotaAndRequestCount
(id int, quota int)
model/user.go:1130
↓ 8 callersMethodUpdateWithStatus
UpdateWithStatus performs a conditional UPDATE guarded by fromStatus (CAS). Returns (true, nil) if this caller won the update, (false, nil) if another
model/task.go:431
↓ 8 callersFunctionValidateSSRFProtectedFetchURL
(urlStr string)
service/http_client.go:52
↓ 8 callersFunctioncanManageTargetRole
(myRole int, targetRole int)
controller/user.go:346
↓ 8 callersFunctioncreateLog
(log *Log)
model/log.go:101
↓ 8 callersFunctiongetLastLog
(t *testing.T)
service/task_billing_test.go:273
↓ 8 callersFunctiongetLobeHubIcon
(iconName, size = 14)
web/classic/src/helpers/render.jsx:427
↓ 8 callersFunctiongetLogo
()
web/classic/src/helpers/utils.jsx:55
↓ 8 callersFunctionhandleInputChange
(value, e)
web/classic/src/components/settings/OtherSetting.jsx:93
↓ 8 callersFunctionhasParsedChildren
( node: ParsedNode )
web/default/src/components/ai-elements/response-node-guards.ts:36
↓ 8 callersMethodmemCache
()
pkg/cachex/hybrid_cache.go:69
↓ 8 callersFunctionmetricValue
(metrics: FlowMetrics, metric: FlowMetric)
web/default/src/features/dashboard/lib/flow.ts:164
↓ 8 callersFunctionnewImageTestContext
(t *testing.T, body, contentType string, isStream bool)
relay/channel/openai/image_stream_test.go:19
↓ 8 callersFunctionnormalizeHeaderContextKey
(key string)
relay/common/override.go:1507
↓ 8 callersFunctiononRefresh
()
web/classic/src/components/settings/RatioSetting.jsx:80
↓ 8 callersMethodredisOn
()
pkg/cachex/hybrid_cache.go:59
↓ 8 callersFunctionrenderLimitedItems
({ items, renderItem, maxDisplay = 3 })
web/classic/src/components/common/ui/RenderUtils.jsx:26
↓ 8 callersFunctionrequireDeploymentID
(c *gin.Context)
controller/deployment.go:120
↓ 8 callersFunctionresetPricingEndpointTestTables
(t *testing.T)
model/pricing_endpoint_test.go:14
↓ 8 callersFunctionsafeNumberFieldProps
(field: ControllerRenderProps<TFieldValues, TName>)
web/default/src/features/system-settings/utils/numeric-field.ts:71
↓ 8 callersFunctionstaticProtection
(protection *common.SSRFProtection)
service/protected_fetch_client_test.go:26
↓ 8 callersFunctiontieredQuota
--------------------------------------------------------------------------- BuildTieredTokenParams: token normalization and ratio parity tests -------
service/tiered_settle_test.go:417
↓ 8 callersFunctionupdateOption
(key, value)
web/classic/src/components/settings/OtherSetting.jsx:66
↓ 8 callersFunctionuseContextValue
()
web/default/src/components/ai-elements/context.tsx:52
↓ 8 callersFunctionuseSubscriptions
()
web/default/src/features/subscriptions/components/subscriptions-provider.tsx:82
↓ 8 callersFunctionuseSystemConfig
(options: UseSystemConfigOptions = {})
web/default/src/hooks/use-system-config.ts:144
↓ 8 callersFunctionuseUsageLogsContext
()
web/default/src/features/usage-logs/components/usage-logs-provider.tsx:78
↓ 7 callersFunctionApplyParamOverrideWithRelayInfo
(jsonData []byte, info *RelayInfo)
relay/common/override.go:178
↓ 7 callersFunctionDecreaseUserQuota
(id int, quota int, db bool)
model/user.go:1078
↓ 7 callersMethodError
()
types/error.go:123
↓ 7 callersFunctionGenerateHMAC
(data string)
common/crypto.go:17
↓ 7 callersFunctionGetGroupRatioCopy
()
setting/ratio_setting/group_ratio.go:62
↓ 7 callersMethodGetImageMedia
()
dto/openai_request.go:311
↓ 7 callersFunctionGetModelRatio
(name string)
setting/ratio_setting/model_ratio.go:396
↓ 7 callersFunctionGetPaymentSetting
()
setting/operation_setting/payment_setting.go:29
↓ 7 callersMethodGetResultURL
GetResultURL 获取任务结果 URL(视频地址等) 新数据存在 PrivateData.ResultURL 中;旧数据回退到 FailReason(历史兼容)
model/task.go:132
↓ 7 callersFunctionGetSSRFProtectedHTTPClient
GetSSRFProtectedHTTPClient 返回带拨号时 SSRF 校验的客户端。 ssrfProtectedHTTPClient 由 InitHttpClient 在启动时初始化,运行期只读。
service/http_client.go:96
↓ 7 callersFunctionGetTopUpByTradeNo
(tradeNo string)
model/topup.go:72
↓ 7 callersFunctionInitSessionCookieSettings
()
common/session_cookie.go:10
↓ 7 callersMethodIsNormalEnd
()
relay/common/stream_status.go:88
↓ 7 callersFunctionLoadFromJsonStringWithCallback
LoadFromJsonStringWithCallback loads a JSON string into the RWMap and calls the callback on success.
types/rw_map.go:85
↓ 7 callersFunctionModelPriceHelper
(c *gin.Context, info *relaycommon.RelayInfo, promptTokens int, meta *types.TokenCountMeta)
relay/helper/price.go:72
↓ 7 callersFunctionNewOpenAIChatBillingUsage
(usage *Usage)
dto/billing_usage.go:56
↓ 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:1485
↓ 7 callersMethodRead
(p []byte)
relay/channel/openai/image_stream_test.go:152
↓ 7 callersFunctionRedisHSetField
(key, field string, value interface{})
common/redis.go:302
↓ 7 callersFunctionResponsesRequestToChatCompletionsRequest
(req *dto.OpenAIResponsesRequest)
service/relayconvert/internal/oai_responses/to_oai_chat_req.go:27
↓ 7 callersMethodSetMetadata
(k string, v any)
dto/openai_video.go:37
↓ 7 callersMethodSetWithTTL
(key string, v V, ttl time.Duration)
pkg/cachex/hybrid_cache.go:111
↓ 7 callersFunctionT
T translates a message key using the language from gin context
i18n/i18n.go:90
↓ 7 callersMethodToVideoStatus
()
model/task.go:17
↓ 7 callersFunctionUsingLogDatabase
(databaseType DatabaseType)
common/database.go:40
↓ 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:39
↓ 7 callersFunctionbuildBillingText
(key, vars)
web/classic/src/helpers/render.jsx:1257
↓ 7 callersFunctioncountLogs
(t *testing.T)
service/task_billing_test.go:283
↓ 7 callersFunctiondisplayAmountToQuota
(amount)
web/classic/src/helpers/quota.js:38
↓ 7 callersFunctiongeminiStreamHandler
(c *gin.Context, info *relaycommon.RelayInfo, resp *http.Response, callback func(data string, geminiResponse *
relay/channel/gemini/relay-gemini.go:135
↓ 7 callersFunctiongetCurrencyLabel
()
web/default/src/lib/currency.ts:526
↓ 7 callersFunctiongetEffectiveRatio
* Helper function to get effective ratio and label * @param {number} groupRatio - The default group ratio * @param {number} user_group_ratio - The u
web/classic/src/helpers/render.jsx:1180
↓ 7 callersFunctiongetSelf
()
web/default/src/lib/api.ts:181
↓ 7 callersFunctiongetSubscriptionPlanByIdTx
(tx *gorm.DB, id int)
model/subscription.go:389
↓ 7 callersFunctiongetSystemName
()
web/classic/src/helpers/utils.jsx:49
↓ 7 callersFunctionhasPermission
( user: AuthUser | null | undefined, resource: string, action: string )
web/default/src/lib/admin-permissions.ts:57
↓ 7 callersFunctioninsertPricingEndpointAbility
(t *testing.T, channelID int, modelName string)
model/pricing_endpoint_test.go:49
↓ 7 callersFunctioninsertPricingEndpointChannel
(t *testing.T, channelID int, channelType int, settings dto.ChannelOtherSettings)
model/pricing_endpoint_test.go:34
↓ 7 callersFunctionisTagAggregateRow
(row: Channel | TagRow)
web/default/src/features/channels/lib/channel-utils.ts:615
↓ 7 callersFunctionloadChannels
( page, pageSize, idSort, enableTagMode, typeKey = activeTypeKey, statusF, )
web/classic/src/hooks/channels/useChannelsData.jsx:320
↓ 7 callersFunctionmanageMultiKeys
( params: MultiKeyManageParams )
web/default/src/features/channels/api.ts:362
↓ 7 callersFunctionmustRawMessage
(t *testing.T, value any)
service/relayconvert/internal/oai_responses/to_oai_chat_req_test.go:265
↓ 7 callersFunctionnewAuthzTestDB
(t *testing.T)
service/authz/authz_test.go:14
↓ 7 callersFunctionnewTestResponsesStreamState
()
service/relayconvert/internal/oai_responses/to_oai_chat_resp_test.go:378
↓ 7 callersFunctionnumberValue
(value: unknown)
web/default/src/features/dashboard/lib/flow.ts:145
↓ 7 callersMethodresolveForConversion
(c *gin.Context, info *relaycommon.RelayInfo)
relay/channel/advancedcustom/adaptor.go:297
↓ 7 callersFunctionsetupLogin
setup session & cookies and then return user info
controller/user.go:138
↓ 7 callersFunctionsetupUserUpdateTestState
(t *testing.T)
model/user_update_test.go:15
↓ 7 callersFunctiontestRelayInfo
()
relay/channel/task/ali/adaptor_test.go:12
↓ 7 callersFunctionuseTableUrlState
( params: UseTableUrlStateParams )
web/default/src/hooks/use-table-url-state.ts:107
↓ 6 callersFunctionCompleteSubscriptionOrder
Complete a subscription order (idempotent). Creates a UserSubscription snapshot from the plan. expectedPaymentProvider guards against cross-gateway ca
model/subscription.go:563
↓ 6 callersMethodConvertOpenAIRequest
(c *gin.Context, info *relaycommon.RelayInfo, request *dto.GeneralOpenAIRequest)
relay/channel/adapter.go:20
↓ 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:299
↓ 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 callersMethodGetAutoBan
()
model/channel.go:338
↓ 6 callersFunctionGetContextKeyBool
(c *gin.Context, key constant.ContextKey)
common/gin.go:173
↓ 6 callersFunctionGetContextKeyString
(c *gin.Context, key constant.ContextKey)
common/gin.go:165
↓ 6 callersFunctionGetEnvOrDefaultString
(env string, defaultValue string)
common/env.go:21
↓ 6 callersMethodGetIdentifier
()
types/file_source.go:15
↓ 6 callersFunctionGetSubscriptionPlanById
(id int)
model/subscription.go:385
↓ 6 callersFunctionGetTaskAdaptor
(platform constant.TaskPlatform)
relay/relay_adaptor.go:138
← previousnext →301–400 of 10,602, ranked by callers