Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/QuantumNous/new-api
/ functions
Functions
11,560 in github.com/QuantumNous/new-api
⨍
Functions
11,560
◇
Types & classes
1,706
↓ 7 callers
Function
resolveLocalizedText
( value: LocalizedTextValue | undefined | null, language: string )
web/src/lib/localized-text.ts:36
↓ 7 callers
Function
respondPluginProtocolError
(c *gin.Context, status int, code, message string)
controller/plugin_protocol.go:1268
↓ 7 callers
Method
responseSnapshot
(responseError *dto.PluginResponsesError)
relay/plugin_protocol.go:1004
↓ 7 callers
Function
setupLogin
setupLogin creates a server-controlled login Session and returns the shared authentication bundle used by every login method.
controller/user.go:184
↓ 7 callers
Function
setupTokenControllerTestDB
(t *testing.T)
controller/token_test.go:107
↓ 7 callers
Function
syncCreditUserQuotaCache
syncCreditUserQuotaCache 在授信事务(充值/兑换等)提交后同步把增量补进缓存 余额。预扣以缓存值为准(存在期间),授信不能绕过它,否则新到账的额度在 缓存过期前不可用;缓存未命中无需处理,下次读取会从已提交的数据库余额水合。
model/user_cache.go:158
↓ 7 callers
Function
syncTaskPluginsOnce
()
controller/task_plugin.go:605
↓ 7 callers
Function
taskSubmissionRelayInfo
(billing relaycommon.BillingSettler)
controller/relay_task_plugin_test.go:377
↓ 7 callers
Function
taskSubmissionTestContext
()
controller/relay_task_plugin_test.go:370
↓ 7 callers
Function
testVideoResponsesProtocol
(t *testing.T, testCase videoResponsesTestCase)
plugins/video_responses_test_helpers_test.go:26
↓ 7 callers
Function
useDebounce
(value: T, delay: number = 500)
web/src/hooks/use-debounce.ts:27
↓ 7 callers
Function
useTableUrlState
( params: UseTableUrlStateParams )
web/src/hooks/use-table-url-state.ts:107
↓ 7 callers
Function
userSessionCacheKey
(sid string)
model/user_session.go:124
↓ 7 callers
Function
writeAuthSessionError
(c *gin.Context, err error)
controller/auth_session.go:164
↓ 6 callers
Function
ActivateTaskPlugin
(key, version string)
model/task_plugin.go:170
↓ 6 callers
Method
ActiveOverridePlugins
()
pkg/jsplugin/registry.go:601
↓ 6 callers
Function
AdvanceCurrentSessionToUserVersion
AdvanceCurrentSessionToUserVersion is used when the security mutation and AuthVersion increment were committed in the same transaction (for example, a
service/auth_session.go:180
↓ 6 callers
Function
ApplyToOpenAIChat
ApplyToOpenAIChat writes the portable portion of an intent to the OpenAI pivot. reasoning_effort carries level-based strength; a JSON-excluded DTO sta
relaykit/relayconvert/reasoning/intent.go:378
↓ 6 callers
Method
BuildContentRequest
(task *model.Task, artifactKey string, clientRequest TaskArtifactClientRequest)
relay/channel/adapter.go:117
↓ 6 callers
Method
BuildModelListRequest
(info *relaycommon.RelayInfo)
relay/channel/advancedcustom/adaptor.go:196
↓ 6 callers
Function
ClaimExternalIdentityWithTx
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 callers
Function
CompleteSubscriptionOrder
Complete a subscription order (idempotent). Creates a UserSubscription snapshot from the plan. expectedPaymentProvider guards against cross-gateway ca
model/subscription.go:569
↓ 6 callers
Function
ComputeTieredQuotaWithRequest
(snap *BillingSnapshot, params TokenParams, request RequestInput)
pkg/billingexpr/settle.go:24
↓ 6 callers
Function
ConsumeAuthFlow
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 callers
Function
ConvertResponse
(c *gin.Context, info *relaycommon.RelayInfo, target types.RelayFormat, response any)
service/response_converter.go:10
↓ 6 callers
Function
ConvertStreamResponseChunk
(c context.Context, info convmeta.Meta, state *ResponseStreamState, response any)
relaykit/relayconvert/response_registry.go:326
↓ 6 callers
Function
FatalLog
(v ...any)
common/sys_log.go:31
↓ 6 callers
Function
FinalizeStreamResponse
(c *gin.Context, info *relaycommon.RelayInfo, state *relayconvert.ResponseStreamState)
service/response_converter.go:34
↓ 6 callers
Function
FinalizeStreamResponse
(c context.Context, info convmeta.Meta, state *ResponseStreamState)
relaykit/relayconvert/response_registry.go:360
↓ 6 callers
Function
GeminiChatHandler
(c *gin.Context, info *relaycommon.RelayInfo, resp *http.Response)
relay/channel/gemini/relay-gemini.go:361
↓ 6 callers
Function
GenerateFinalUsageResponse
(id string, createAt int64, model string, usage dto.Usage)
relay/helper/common.go:217
↓ 6 callers
Function
GenerateTextOtherInfo
(ctx *gin.Context, relayInfo *relaycommon.RelayInfo, modelRatio, groupRatio, completionRatio float64, cacheTo
service/log_info_generate.go:97
↓ 6 callers
Function
GetActiveSystemTask
(taskType string)
model/system_task.go:132
↓ 6 callers
Function
GetBillingExpr
(model string)
setting/billing_setting/tiered_billing.go:64
↓ 6 callers
Function
GetContextKey
(c *gin.Context, key constant.ContextKey)
common/gin.go:161
↓ 6 callers
Function
GetContextKeyBool
(c *gin.Context, key constant.ContextKey)
common/gin.go:173
↓ 6 callers
Method
GetIdentifier
()
relaykit/types/file_source.go:15
↓ 6 callers
Method
GetModels
()
model/channel.go:294
↓ 6 callers
Function
GetPointer
(v T)
common/utils.go:302
↓ 6 callers
Function
GetRequestAutoGroups
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 callers
Function
GetSubscriptionPlanById
(id int)
model/subscription.go:385
↓ 6 callers
Method
GetTokenCountMeta
()
relaykit/dto/request_common.go:9
↓ 6 callers
Method
GetTools
GetTools 获取工具列表
relaykit/dto/claude.go:420
↓ 6 callers
Function
GetTopupGroupRatio
(name string)
common/topup-ratio.go:32
↓ 6 callers
Function
GetUserSessionBySID
(sid string)
model/user_session.go:198
↓ 6 callers
Function
GroupRatio2JSONString
()
setting/ratio_setting/group_ratio.go:71
↓ 6 callers
Function
HeaderNavModulePublicOrUserAuth
(module string)
middleware/header_nav.go:125
↓ 6 callers
Function
IncreaseTokenQuota
(tokenId int, key string, quota int)
model/token.go:377
↓ 6 callers
Method
Insert
()
model/topup.go:53
↓ 6 callers
Method
Insert
()
model/midjourney.go:164
↓ 6 callers
Method
ListArtifacts
(task *model.Task)
relay/channel/adapter.go:105
↓ 6 callers
Method
MatchPathForModel
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:191
↓ 6 callers
Function
MidjourneyErrorWrapper
(code int, desc string)
service/error.go:21
↓ 6 callers
Function
MigrateRetiredFrontendOptions
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 callers
Function
OpenaiHandler
(c *gin.Context, info *relaycommon.RelayInfo, resp *http.Response)
relay/channel/openai/relay-openai.go:241
↓ 6 callers
Method
ParseTaskResult
(task *model.Task, resp *http.Response, respBody []byte)
relay/channel/adapter.go:80
↓ 6 callers
Function
PrepareTieredBillingForSelectedGroup
PrepareTieredBillingForSelectedGroup refreshes routing-dependent billing state before an upstream attempt. An existing session reserves any higher est
service/tiered_settle.go:125
↓ 6 callers
Function
QuotaRound
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 callers
Function
ReloadPolicy
()
service/authz/enforcer.go:69
↓ 6 callers
Function
RemoveDisabledFields
RemoveDisabledFields 从请求 JSON 数据中移除渠道设置中禁用的字段 service_tier: 服务层级字段,可能导致额外计费(OpenAI、Claude、Responses API 支持) inference_geo: Claude 数据驻留推理区域字段(仅 Claude
relay/common/relay_info.go:1050
↓ 6 callers
Method
ResolvedPin
ResolvedPin returns the winning pin after priority resolution. Lowest Rank wins. Pins that name the same channel are merged (stricter RetryMode). over
dto/channel_constraints.go:72
↓ 6 callers
Function
ResponseChunkData
(c *gin.Context, resp dto.ResponsesStreamResponse, data string)
relay/helper/common.go:87
↓ 6 callers
Function
SanitizeURLForLog
(rawURL string)
relay/common/relay_utils.go:40
↓ 6 callers
Method
SetModelName
(modelName string)
relaykit/dto/request_common.go:11
↓ 6 callers
Function
SettleMidjourneyTaskBilling
SettleMidjourneyTaskBilling charges a persisted legacy task and records the applied stages.
service/midjourney.go:64
↓ 6 callers
Method
SetupRequestHeader
(c *gin.Context, req *http.Header, info *relaycommon.RelayInfo)
relay/channel/adapter.go:21
↓ 6 callers
Function
TaskErrorWrapper
(err error, code string, statusCode int)
service/error.go:200
↓ 6 callers
Method
ToBaseUser
()
model/user.go:115
↓ 6 callers
Function
UpdateAutoGroupsByJsonString
(jsonString string)
setting/auto_group.go:34
↓ 6 callers
Function
UpdateConfigFromMap
UpdateConfigFromMap 从map更新配置对象(导出函数)
setting/config/config.go:281
↓ 6 callers
Function
UpdateGroupRatioByJSONString
(jsonStr string)
setting/ratio_setting/group_ratio.go:75
↓ 6 callers
Function
UpdateOption
(c *gin.Context)
controller/option.go:139
↓ 6 callers
Function
UpdateVideoTasks
UpdateVideoTasks 按渠道更新所有视频任务
service/task_polling.go:385
↓ 6 callers
Function
UpstreamModelName
UpstreamModelName / ChannelTypeOf are nil-safe accessors for optional Meta values (converters are often called with a nil Meta in tests and compat shi
relaykit/relayconvert/convmeta/meta.go:221
↓ 6 callers
Function
UsageFromChatUsage
(src *dto.Usage)
relaykit/relayconvert/response_compat.go:156
↓ 6 callers
Function
UsageFromChatUsage
(src *dto.Usage)
relaykit/relayconvert/internal/oai_chat/to_oai_responses_resp.go:145
↓ 6 callers
Method
ValidateNetworkTarget
ValidateNetworkTarget validates the host and port before dialing.
common/ssrf_protection.go:290
↓ 6 callers
Function
ValidateWalletQuota
ValidateWalletQuota enforces the upper bound shared by wallet mutations. Negative balances remain valid because billing can temporarily overdraw a wal
common/quota_math.go:22
↓ 6 callers
Method
acquire
( pluginKey string, userID int, tokenID int, )
controller/plugin_protocol_limiter.go:65
↓ 6 callers
Function
applyOriginTaskIntent
(c *gin.Context, intent map[string]any, meta pluginruntime.Meta)
middleware/task_plugin.go:1022
↓ 6 callers
Function
buildOpenAIStyleUsageFromClaudeUsage
(usage *dto.Usage)
relay/channel/claude/relay-claude.go:57
↓ 6 callers
Function
canonicalUsageFromResponse
(response any)
relaykit/relayconvert/response_registry.go:844
↓ 6 callers
Function
clearAuthentication
( synchronizeTabs = true, bootstrapState: AuthBootstrapState = 'complete' )
web/src/lib/auth-session.ts:186
↓ 6 callers
Function
combineBillingExpr
( baseExpr: string, requestRuleExpr: string )
web/src/features/pricing/lib/billing-expr.ts:933
↓ 6 callers
Function
convert
(value any, target any)
relay/channel/task/jsplugin/adaptor.go:1545
↓ 6 callers
Function
createEpayTestOrder
(t *testing.T, userId int, tradeNo string, provider string, status string)
model/payment_method_guard_test.go:177
↓ 6 callers
Function
createOAuthFlow
( provider: string, intent: 'login' | 'bind' )
web/src/features/auth/api.ts:167
↓ 6 callers
Method
ensureStart
()
relaykit/relayconvert/internal/oai_responses/to_oai_chat_stream_resp.go:158
↓ 6 callers
Function
fetchLogs
( endpoint: string, params: T, isAdmin: boolean )
web/src/features/usage-logs/api.ts:42
↓ 6 callers
Function
formatBillingCurrencyFromUSD
( amountUSD: number | null | undefined, options?: CurrencyFormatOptions )
web/src/lib/currency.ts:471
↓ 6 callers
Function
formatNumber
( value: number | null | undefined, locales?: Intl.LocalesArgument )
web/src/lib/format.ts:32
↓ 6 callers
Function
formatPricingNumber
(value: unknown)
web/src/features/system-settings/models/pricing-format.ts:55
↓ 6 callers
Function
formatTokens
(value: number)
web/src/features/rankings/lib/format.ts:24
↓ 6 callers
Function
formatUptimePct
(pct: number)
web/src/features/performance-metrics/lib/format.ts:31
↓ 6 callers
Function
formatUserLogs
(logs []*Log, startIdx int)
model/log.go:116
↓ 6 callers
Function
getAuthenticatedUser
(c *gin.Context)
controller/passkey.go:654
↓ 6 callers
Function
getCookie
(name: string)
web/src/lib/cookies.ts:29
↓ 6 callers
Function
getCurrentVersion
(message: Message)
web/src/features/playground/lib/message/message-utils.ts:42
↓ 6 callers
Function
getRouteIncomingPath
(route: AdvancedCustomRoute)
web/src/features/channels/components/dialogs/advanced-custom-editor-dialog.tsx:163
↓ 6 callers
Function
getSuccessRateTextClass
(rate: number)
web/src/features/performance-metrics/lib/format.ts:88
← previous
next →
601–700 of 11,560, ranked by callers