Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/QuantumNous/new-api
/ functions
Functions
10,602 in github.com/QuantumNous/new-api
⨍
Functions
10,602
◇
Types & classes
1,425
↓ 8 callers
Function
RecalculateTaskQuota
RecalculateTaskQuota 通用的异步差额结算。 actualQuota 是任务完成后的实际应扣额度,与预扣额度 (task.Quota) 做差额结算。 reason 用于日志记录(例如 "token重算" 或 "adaptor调整")。 clamps 可选:若计算 actualQuo
service/task_billing.go:201
↓ 8 callers
Function
RecordConsumeLog
(c *gin.Context, userId int, params RecordConsumeLogParams)
model/log.go:343
↓ 8 callers
Method
RecordError
(msg string)
relay/common/stream_status.go:55
↓ 8 callers
Function
RefundTaskQuota
RefundTaskQuota 统一的任务失败退款逻辑。 当异步任务失败时,将预扣的 quota 退还给用户(支持钱包和订阅),并退还令牌额度。
service/task_billing.go:165
↓ 8 callers
Function
ResetProxyClientCache
ResetProxyClientCache 清空代理客户端缓存,确保下次使用时重新初始化
service/http_client.go:112
↓ 8 callers
Method
SetEstimatePromptTokens
func (info *RelayInfo) SetPromptTokens(promptTokens int) { info.promptTokens = promptTokens }
relay/common/relay_info.go:656
↓ 8 callers
Method
SetProgressStr
(progress string)
dto/openai_video.go:33
↓ 8 callers
Function
UpdateChannelUsedQuota
(id int, quota int)
model/channel.go:855
↓ 8 callers
Function
UpdateUserUsedQuotaAndRequestCount
(id int, quota int)
model/user.go:1130
↓ 8 callers
Method
UpdateWithStatus
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 callers
Function
ValidateSSRFProtectedFetchURL
(urlStr string)
service/http_client.go:52
↓ 8 callers
Function
canManageTargetRole
(myRole int, targetRole int)
controller/user.go:346
↓ 8 callers
Function
createLog
(log *Log)
model/log.go:101
↓ 8 callers
Function
getLastLog
(t *testing.T)
service/task_billing_test.go:273
↓ 8 callers
Function
getLobeHubIcon
(iconName, size = 14)
web/classic/src/helpers/render.jsx:427
↓ 8 callers
Function
getLogo
()
web/classic/src/helpers/utils.jsx:55
↓ 8 callers
Function
handleInputChange
(value, e)
web/classic/src/components/settings/OtherSetting.jsx:93
↓ 8 callers
Function
hasParsedChildren
( node: ParsedNode )
web/default/src/components/ai-elements/response-node-guards.ts:36
↓ 8 callers
Method
memCache
()
pkg/cachex/hybrid_cache.go:69
↓ 8 callers
Function
metricValue
(metrics: FlowMetrics, metric: FlowMetric)
web/default/src/features/dashboard/lib/flow.ts:164
↓ 8 callers
Function
newImageTestContext
(t *testing.T, body, contentType string, isStream bool)
relay/channel/openai/image_stream_test.go:19
↓ 8 callers
Function
normalizeHeaderContextKey
(key string)
relay/common/override.go:1507
↓ 8 callers
Function
onRefresh
()
web/classic/src/components/settings/RatioSetting.jsx:80
↓ 8 callers
Method
redisOn
()
pkg/cachex/hybrid_cache.go:59
↓ 8 callers
Function
renderLimitedItems
({ items, renderItem, maxDisplay = 3 })
web/classic/src/components/common/ui/RenderUtils.jsx:26
↓ 8 callers
Function
requireDeploymentID
(c *gin.Context)
controller/deployment.go:120
↓ 8 callers
Function
resetPricingEndpointTestTables
(t *testing.T)
model/pricing_endpoint_test.go:14
↓ 8 callers
Function
safeNumberFieldProps
(field: ControllerRenderProps<TFieldValues, TName>)
web/default/src/features/system-settings/utils/numeric-field.ts:71
↓ 8 callers
Function
staticProtection
(protection *common.SSRFProtection)
service/protected_fetch_client_test.go:26
↓ 8 callers
Function
tieredQuota
--------------------------------------------------------------------------- BuildTieredTokenParams: token normalization and ratio parity tests -------
service/tiered_settle_test.go:417
↓ 8 callers
Function
updateOption
(key, value)
web/classic/src/components/settings/OtherSetting.jsx:66
↓ 8 callers
Function
useContextValue
()
web/default/src/components/ai-elements/context.tsx:52
↓ 8 callers
Function
useSubscriptions
()
web/default/src/features/subscriptions/components/subscriptions-provider.tsx:82
↓ 8 callers
Function
useSystemConfig
(options: UseSystemConfigOptions = {})
web/default/src/hooks/use-system-config.ts:144
↓ 8 callers
Function
useUsageLogsContext
()
web/default/src/features/usage-logs/components/usage-logs-provider.tsx:78
↓ 7 callers
Function
ApplyParamOverrideWithRelayInfo
(jsonData []byte, info *RelayInfo)
relay/common/override.go:178
↓ 7 callers
Function
DecreaseUserQuota
(id int, quota int, db bool)
model/user.go:1078
↓ 7 callers
Method
Error
()
types/error.go:123
↓ 7 callers
Function
GenerateHMAC
(data string)
common/crypto.go:17
↓ 7 callers
Function
GetGroupRatioCopy
()
setting/ratio_setting/group_ratio.go:62
↓ 7 callers
Method
GetImageMedia
()
dto/openai_request.go:311
↓ 7 callers
Function
GetModelRatio
(name string)
setting/ratio_setting/model_ratio.go:396
↓ 7 callers
Function
GetPaymentSetting
()
setting/operation_setting/payment_setting.go:29
↓ 7 callers
Method
GetResultURL
GetResultURL 获取任务结果 URL(视频地址等) 新数据存在 PrivateData.ResultURL 中;旧数据回退到 FailReason(历史兼容)
model/task.go:132
↓ 7 callers
Function
GetSSRFProtectedHTTPClient
GetSSRFProtectedHTTPClient 返回带拨号时 SSRF 校验的客户端。 ssrfProtectedHTTPClient 由 InitHttpClient 在启动时初始化,运行期只读。
service/http_client.go:96
↓ 7 callers
Function
GetTopUpByTradeNo
(tradeNo string)
model/topup.go:72
↓ 7 callers
Function
InitSessionCookieSettings
()
common/session_cookie.go:10
↓ 7 callers
Method
IsNormalEnd
()
relay/common/stream_status.go:88
↓ 7 callers
Function
LoadFromJsonStringWithCallback
LoadFromJsonStringWithCallback loads a JSON string into the RWMap and calls the callback on success.
types/rw_map.go:85
↓ 7 callers
Function
ModelPriceHelper
(c *gin.Context, info *relaycommon.RelayInfo, promptTokens int, meta *types.TokenCountMeta)
relay/helper/price.go:72
↓ 7 callers
Function
NewOpenAIChatBillingUsage
(usage *Usage)
dto/billing_usage.go:56
↓ 7 callers
Function
ParseHTTPStatusCodeRanges
(input string)
setting/operation_setting/status_code_ranges.go:117
↓ 7 callers
Function
PostConsumeUserSubscriptionDelta
Update subscription used amount by delta (positive consume more, negative refund).
model/subscription.go:1485
↓ 7 callers
Method
Read
(p []byte)
relay/channel/openai/image_stream_test.go:152
↓ 7 callers
Function
RedisHSetField
(key, field string, value interface{})
common/redis.go:302
↓ 7 callers
Function
ResponsesRequestToChatCompletionsRequest
(req *dto.OpenAIResponsesRequest)
service/relayconvert/internal/oai_responses/to_oai_chat_req.go:27
↓ 7 callers
Method
SetMetadata
(k string, v any)
dto/openai_video.go:37
↓ 7 callers
Method
SetWithTTL
(key string, v V, ttl time.Duration)
pkg/cachex/hybrid_cache.go:111
↓ 7 callers
Function
T
T translates a message key using the language from gin context
i18n/i18n.go:90
↓ 7 callers
Method
ToVideoStatus
()
model/task.go:17
↓ 7 callers
Function
UsingLogDatabase
(databaseType DatabaseType)
common/database.go:40
↓ 7 callers
Function
attachQuotaSaturation
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 callers
Function
buildBillingText
(key, vars)
web/classic/src/helpers/render.jsx:1257
↓ 7 callers
Function
countLogs
(t *testing.T)
service/task_billing_test.go:283
↓ 7 callers
Function
displayAmountToQuota
(amount)
web/classic/src/helpers/quota.js:38
↓ 7 callers
Function
geminiStreamHandler
(c *gin.Context, info *relaycommon.RelayInfo, resp *http.Response, callback func(data string, geminiResponse *
relay/channel/gemini/relay-gemini.go:135
↓ 7 callers
Function
getCurrencyLabel
()
web/default/src/lib/currency.ts:526
↓ 7 callers
Function
getEffectiveRatio
* 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 callers
Function
getSelf
()
web/default/src/lib/api.ts:181
↓ 7 callers
Function
getSubscriptionPlanByIdTx
(tx *gorm.DB, id int)
model/subscription.go:389
↓ 7 callers
Function
getSystemName
()
web/classic/src/helpers/utils.jsx:49
↓ 7 callers
Function
hasPermission
( user: AuthUser | null | undefined, resource: string, action: string )
web/default/src/lib/admin-permissions.ts:57
↓ 7 callers
Function
insertPricingEndpointAbility
(t *testing.T, channelID int, modelName string)
model/pricing_endpoint_test.go:49
↓ 7 callers
Function
insertPricingEndpointChannel
(t *testing.T, channelID int, channelType int, settings dto.ChannelOtherSettings)
model/pricing_endpoint_test.go:34
↓ 7 callers
Function
isTagAggregateRow
(row: Channel | TagRow)
web/default/src/features/channels/lib/channel-utils.ts:615
↓ 7 callers
Function
loadChannels
( page, pageSize, idSort, enableTagMode, typeKey = activeTypeKey, statusF, )
web/classic/src/hooks/channels/useChannelsData.jsx:320
↓ 7 callers
Function
manageMultiKeys
( params: MultiKeyManageParams )
web/default/src/features/channels/api.ts:362
↓ 7 callers
Function
mustRawMessage
(t *testing.T, value any)
service/relayconvert/internal/oai_responses/to_oai_chat_req_test.go:265
↓ 7 callers
Function
newAuthzTestDB
(t *testing.T)
service/authz/authz_test.go:14
↓ 7 callers
Function
newTestResponsesStreamState
()
service/relayconvert/internal/oai_responses/to_oai_chat_resp_test.go:378
↓ 7 callers
Function
numberValue
(value: unknown)
web/default/src/features/dashboard/lib/flow.ts:145
↓ 7 callers
Method
resolveForConversion
(c *gin.Context, info *relaycommon.RelayInfo)
relay/channel/advancedcustom/adaptor.go:297
↓ 7 callers
Function
setupLogin
setup session & cookies and then return user info
controller/user.go:138
↓ 7 callers
Function
setupUserUpdateTestState
(t *testing.T)
model/user_update_test.go:15
↓ 7 callers
Function
testRelayInfo
()
relay/channel/task/ali/adaptor_test.go:12
↓ 7 callers
Function
useTableUrlState
( params: UseTableUrlStateParams )
web/default/src/hooks/use-table-url-state.ts:107
↓ 6 callers
Function
CompleteSubscriptionOrder
Complete a subscription order (idempotent). Creates a UserSubscription snapshot from the plan. expectedPaymentProvider guards against cross-gateway ca
model/subscription.go:563
↓ 6 callers
Method
ConvertOpenAIRequest
(c *gin.Context, info *relaycommon.RelayInfo, request *dto.GeneralOpenAIRequest)
relay/channel/adapter.go:20
↓ 6 callers
Function
FatalLog
(v ...any)
common/sys_log.go:31
↓ 6 callers
Function
FormatClaudeResponseInfo
(claudeResponse *dto.ClaudeResponse, oaiResponse *dto.ChatCompletionsStreamResponse, claudeInfo *ClaudeRespons
relay/channel/claude/relay-claude.go:82
↓ 6 callers
Function
GeminiChatHandler
(c *gin.Context, info *relaycommon.RelayInfo, resp *http.Response)
relay/channel/gemini/relay-gemini.go:299
↓ 6 callers
Function
GenerateFinalUsageResponse
(id string, createAt int64, model string, usage dto.Usage)
relay/helper/common.go:217
↓ 6 callers
Function
GetActiveSystemTask
(taskType string)
model/system_task.go:132
↓ 6 callers
Method
GetAutoBan
()
model/channel.go:338
↓ 6 callers
Function
GetContextKeyBool
(c *gin.Context, key constant.ContextKey)
common/gin.go:173
↓ 6 callers
Function
GetContextKeyString
(c *gin.Context, key constant.ContextKey)
common/gin.go:165
↓ 6 callers
Function
GetEnvOrDefaultString
(env string, defaultValue string)
common/env.go:21
↓ 6 callers
Method
GetIdentifier
()
types/file_source.go:15
↓ 6 callers
Function
GetSubscriptionPlanById
(id int)
model/subscription.go:385
↓ 6 callers
Function
GetTaskAdaptor
(platform constant.TaskPlatform)
relay/relay_adaptor.go:138
← previous
next →
301–400 of 10,602, ranked by callers