Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/QuantumNous/new-api
/ functions
Functions
9,514 in github.com/QuantumNous/new-api
⨍
Functions
9,514
◇
Types & classes
1,507
↓ 7 callers
Function
formatLogQuota
(quota: number)
web/src/lib/format.ts:208
↓ 7 callers
Function
geminiStreamHandler
(c *gin.Context, info *relaycommon.RelayInfo, resp *http.Response, callback func(data string, geminiResponse *
relay/channel/gemini/relay-gemini.go:147
↓ 7 callers
Function
getCurrencyLabel
()
web/src/lib/currency.ts:526
↓ 7 callers
Function
getSubscriptionPlanByIdTx
(tx *gorm.DB, id int)
model/subscription.go:389
↓ 7 callers
Function
hasPermission
( user: AuthUser | null | undefined, resource: string, action: string )
web/src/lib/admin-permissions.ts:75
↓ 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
manageMultiKeys
( params: MultiKeyManageParams )
web/src/features/channels/api.ts:363
↓ 7 callers
Function
newAuthzTestDB
(t *testing.T)
service/authz/authz_test.go:14
↓ 7 callers
Function
numberValue
(value: unknown)
web/src/features/dashboard/lib/flow.ts:145
↓ 7 callers
Function
rateLimitFactory
(maxRequestNum int, duration int64, mark string)
middleware/rate-limit.go:147
↓ 7 callers
Function
redisIPRateLimitKey
(mark string, clientIP string)
middleware/rate-limit.go:44
↓ 7 callers
Method
resolveForConversion
(c *gin.Context, info *relaycommon.RelayInfo)
relay/channel/advancedcustom/adaptor.go:342
↓ 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:154
↓ 7 callers
Function
setupTokenControllerTestDB
(t *testing.T)
controller/token_test.go:107
↓ 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/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
AdvanceCurrentSessionToUserVersion
AdvanceCurrentSessionToUserVersion is used when the security mutation and AuthVersion increment were committed in the same transaction (for example, a
service/auth_session.go:173
↓ 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
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
Method
EnsureClaudeConvertInfo
EnsureClaudeConvertInfo lazily creates and returns the mutable OpenAI→Claude stream conversion state. For non-nil receivers, the same instance must be
relaykit/relayconvert/convmeta/meta.go:37
↓ 6 callers
Function
FatalLog
(v ...any)
common/sys_log.go:31
↓ 6 callers
Method
FillUserById
()
model/user.go:961
↓ 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:313
↓ 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
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
Function
GetEnvOrDefaultString
(env string, defaultValue string)
common/env.go:21
↓ 6 callers
Method
GetIdentifier
()
relaykit/types/file_source.go:15
↓ 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
Function
GetTaskAdaptor
(platform constant.TaskPlatform)
relay/relay_adaptor.go:144
↓ 6 callers
Method
GetTools
GetTools 获取工具列表
relaykit/dto/claude.go:401
↓ 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
Method
Insert
()
model/topup.go:50
↓ 6 callers
Function
InvalidatePricingCache
()
model/pricing.go:80
↓ 6 callers
Method
IsToolCall
()
relaykit/dto/openai_response.go:159
↓ 6 callers
Function
LogDatabaseType
()
common/database.go:19
↓ 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:168
↓ 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:222
↓ 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:946
↓ 6 callers
Function
SanitizeURLForLog
(rawURL string)
relay/common/relay_utils.go:40
↓ 6 callers
Function
SetMainDatabaseType
(databaseType DatabaseType)
common/database.go:23
↓ 6 callers
Method
SetupRequestHeader
(c *gin.Context, req *http.Header, info *relaycommon.RelayInfo)
relay/channel/adapter.go:20
↓ 6 callers
Method
Size
Size 获取数据大小
common/body_storage.go:20
↓ 6 callers
Method
Source
Source 返回资金来源标识:"wallet" 或 "subscription"
service/funding_source.go:16
↓ 6 callers
Method
ToBaseUser
()
model/user.go:115
↓ 6 callers
Function
UnmarshalMetadata
UnmarshalMetadata converts a map[string]any metadata to a typed struct via JSON round-trip. This replaces the repeated pattern: json.Marshal(metadata)
relay/channel/task/taskcommon/helpers.go:16
↓ 6 callers
Function
UpdateAutoGroupsByJsonString
(jsonString string)
setting/auto_group.go:34
↓ 6 callers
Function
UpdateGroupRatioByJSONString
(jsonStr string)
setting/ratio_setting/group_ratio.go:75
↓ 6 callers
Function
UpdateVideoTasks
UpdateVideoTasks 按渠道更新所有视频任务
service/task_polling.go:352
↓ 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:195
↓ 6 callers
Function
UsageFromChatUsage
(src *dto.Usage)
relaykit/relayconvert/response_compat.go:91
↓ 6 callers
Method
ValidateNetworkTarget
ValidateNetworkTarget validates the host and port before dialing.
common/ssrf_protection.go:290
↓ 6 callers
Function
WithCompactModelSuffix
(modelName string)
setting/ratio_setting/compact_suffix.go:8
↓ 6 callers
Function
addNewRecord
(type_ int, id int, value int)
model/utils.go:42
↓ 6 callers
Function
cacheSetToken
(token Token)
model/token_cache.go:11
↓ 6 callers
Function
clearAuthentication
( synchronizeTabs = true, bootstrapState: AuthBootstrapState = 'complete' )
web/src/lib/auth-session.ts:185
↓ 6 callers
Function
createOAuthFlow
( provider: string, intent: 'login' | 'bind' )
web/src/features/auth/api.ts:141
↓ 6 callers
Function
currentEnforcer
()
service/authz/enforcer.go:63
↓ 6 callers
Function
fetchLogs
( endpoint: string, params: T, isAdmin: boolean )
web/src/features/usage-logs/api.ts:40
↓ 6 callers
Function
formatNumber
( value: number | null | undefined, locales?: Intl.LocalesArgument )
web/src/lib/format.ts:31
↓ 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
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
getSuccessRateTextClass
(rate: number)
web/src/features/performance-metrics/lib/format.ts:88
↓ 6 callers
Function
handleLoginSuccess
( bundle: AuthBundle, redirectTo?: string )
web/src/features/auth/hooks/use-auth-redirect.ts:40
↓ 6 callers
Function
hashStringToSeed
(input: string)
web/src/features/pricing/lib/seed.ts:30
↓ 6 callers
Function
initDefaultHTTPClientFixture
(t *testing.T)
service/http_client_transport_test.go:36
↓ 6 callers
Function
isApiSuccess
(response: ApiResponse)
web/src/features/wallet/api.ts:51
↓ 6 callers
Function
isValidOtherRatio
(ratio float64)
types/price_data.go:106
↓ 6 callers
Function
mustStreamChunks
(t *testing.T, state *ResponsesToChatStreamState, event *dto.ResponsesStreamResponse)
relaykit/relayconvert/internal/oai_responses/to_oai_chat_resp_test.go:443
↓ 6 callers
Function
mustUnmarshalFixture
(raw string, out any)
relaykit/relayconvert/golden_test.go:471
↓ 6 callers
Function
newAdvancedCustomModelListChannel
(baseURL string, key string, upstreamPath string, auth *dto.AdvancedCustomRouteAuth)
controller/channel_upstream_update_test.go:20
↓ 6 callers
Function
newAuthenticatedContext
(t *testing.T, method string, target string, body any, userID int)
controller/token_test.go:184
↓ 6 callers
Function
newClientIPRouter
()
middleware/trusted_proxies_test.go:24
↓ 6 callers
Function
newFakeSMTPServerWithSTARTTLSAdvertisement
(t *testing.T, advertiseSTARTTLS bool)
common/email_test.go:39
↓ 6 callers
Function
normalizeJsonString
(value: string)
web/src/features/system-settings/models/utils.ts:32
↓ 6 callers
Function
normalizeModelName
(model: string)
web/src/features/channels/lib/model-mapping-validation.ts:45
↓ 6 callers
Function
noteQuotaClamp
noteQuotaClamp records the first quota saturation event onto relayInfo so it can later be attached to the consume/task log for admin auditing. First n
service/text_quota.go:194
↓ 6 callers
Function
parseLogOther
(other: string)
web/src/features/usage-logs/lib/format.ts:159
↓ 6 callers
Function
parseTags
(tagsString?: string)
web/src/features/pricing/lib/filters.ts:163
← previous
next →
401–500 of 9,514, ranked by callers