Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/QuantumNous/new-api
/ functions
Functions
9,732 in github.com/QuantumNous/new-api
⨍
Functions
9,732
◇
Types & classes
1,519
↓ 9 callers
Function
RefundTaskQuota
RefundTaskQuota 统一的任务失败退款逻辑。 当异步任务失败时,退还资金与令牌额度,并回减用户和渠道用量。 返回资金来源是否已成功退还;失败时保留 quota,供显式重试或人工对账。
service/task_billing.go:166
↓ 9 callers
Function
RevokeAllUserSessions
(userID int, reason string)
model/user_session.go:708
↓ 9 callers
Function
SetDatabaseTypes
(mainType DatabaseType, logType DatabaseType)
common/database.go:31
↓ 9 callers
Function
StringData
(c *gin.Context, str string)
relay/helper/common.go:97
↓ 9 callers
Method
ToOpenAIError
()
relaykit/types/error.go:180
↓ 9 callers
Method
Type
()
service/system_task.go:35
↓ 9 callers
Function
UpdateMaxTokenAutoGroups
(value string)
setting/auto_group.go:63
↓ 9 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:423
↓ 9 callers
Function
UsedVars
UsedVars returns the set of identifier names referenced by an expression. The result is cached alongside the compiled program. Returns nil for empty i
pkg/billingexpr/compile.go:249
↓ 9 callers
Function
UserSubject
UserSubject is the casbin subject string for a single user.
service/authz/permission.go:20
↓ 9 callers
Method
Value
()
model/task.go:96
↓ 9 callers
Function
addNewRecord
(type_ int, id int, value int)
model/utils.go:42
↓ 9 callers
Method
convertToAliRequest
(info *relaycommon.RelayInfo, req relaycommon.TaskSubmitReq)
relay/channel/task/ali/adaptor.go:351
↓ 9 callers
Function
fetchChannelUpstreamModelIDs
(channel *model.Channel)
controller/channel_upstream_update.go:363
↓ 9 callers
Function
getChannelAffinityCache
()
service/channel_affinity.go:81
↓ 9 callers
Function
getUserAuthFenceKey
(userId int)
model/user_auth_cache.go:26
↓ 9 callers
Function
isAuthBundle
(value: unknown)
web/src/lib/auth-session.ts:129
↓ 9 callers
Function
parseQuotaFromDollars
(amount: number)
web/src/lib/format.ts:84
↓ 9 callers
Function
populateUserCache
(user User)
model/user_cache.go:70
↓ 9 callers
Function
recordManageAuditFor
recordManageAuditFor 记录一条管理审计日志,日志归属于操作者;targetUserId 只表示被操作用户,用于在结构化参数中保留目标上下文。
controller/audit.go:99
↓ 9 callers
Function
safeNumberFieldProps
(field: ControllerRenderProps<TFieldValues, TName>)
web/src/features/system-settings/utils/numeric-field.ts:76
↓ 9 callers
Function
streamValuesFromAny
(value any)
relaykit/relayconvert/response_registry.go:626
↓ 9 callers
Function
useApiKeys
()
web/src/features/keys/components/api-keys-provider.tsx:182
↓ 9 callers
Function
useIsMobile
()
web/src/hooks/use-mobile.ts:23
↓ 9 callers
Function
useModels
()
web/src/features/models/components/models-provider.tsx:131
↓ 9 callers
Function
useThemeCustomization
()
web/src/context/theme-customization-provider.tsx:260
↓ 8 callers
Method
Close
()
relay/channel/openai/image_stream_test.go:165
↓ 8 callers
Method
ConvertOpenAIRequest
(c *gin.Context, info *relaycommon.RelayInfo, request *dto.GeneralOpenAIRequest)
relay/channel/adapter.go:21
↓ 8 callers
Function
ConvertStreamResponseChunk
(c context.Context, info convmeta.Meta, state *ResponseStreamState, response any)
relaykit/relayconvert/response_registry.go:301
↓ 8 callers
Method
DeleteMany
DeleteMany accepts either fully namespaced keys or raw keys and deletes them. It returns a map keyed by fully namespaced keys.
pkg/cachex/hybrid_cache.go:231
↓ 8 callers
Function
FinalizeStreamResponse
(c context.Context, info convmeta.Meta, state *ResponseStreamState)
relaykit/relayconvert/response_registry.go:326
↓ 8 callers
Function
FlushWriter
(c *gin.Context)
relay/helper/common.go:17
↓ 8 callers
Function
GetFetchSetting
()
setting/system_setting/fetch_setting.go:32
↓ 8 callers
Function
GetGeminiSettings
GetGeminiSettings 获取Gemini配置
setting/model_setting/gemini.go:65
↓ 8 callers
Function
GetOIDCSettings
()
setting/system_setting/oidc.go:28
↓ 8 callers
Function
GetSystemTaskByTaskID
(taskID string)
model/system_task.go:121
↓ 8 callers
Function
GetTopUpByTradeNo
(tradeNo string)
model/topup.go:135
↓ 8 callers
Function
GetUUID
()
relaykit/relayconvert/kitutil/value.go:44
↓ 8 callers
Method
HasChannelMeta
HasChannelMeta reports whether upstream channel information is attached; converters use it to decide if GetUpstreamModelName is meaningful.
relaykit/relayconvert/convmeta/meta.go:23
↓ 8 callers
Function
NewOpenAIChatBillingUsage
(usage *Usage)
relaykit/dto/billing_usage.go:56
↓ 8 callers
Function
NewResponseStreamState
(from types.RelayFormat, target types.RelayFormat, options ResponseStreamOptions)
relaykit/relayconvert/response_registry.go:272
↓ 8 callers
Function
OaiResponsesHandler
(c *gin.Context, info *relaycommon.RelayInfo, resp *http.Response)
relay/channel/openai/relay_responses.go:20
↓ 8 callers
Function
OpenaiImageStreamHandler
(c *gin.Context, info *relaycommon.RelayInfo, resp *http.Response)
relay/channel/openai/relay_image.go:93
↓ 8 callers
Function
ParseAccessToken
(raw string)
service/auth_token.go:85
↓ 8 callers
Function
PrepareMidjourneyTaskBilling
PrepareMidjourneyTaskBilling sets the durable refund marker before the task is inserted.
service/midjourney.go:35
↓ 8 callers
Method
Read
(p []byte)
common/body_storage.go:196
↓ 8 callers
Function
RecalculateTaskQuota
RecalculateTaskQuota 通用的异步差额结算。 actualQuota 是任务完成后的实际应扣额度,与预扣额度 (task.Quota) 做差额结算。 reason 用于日志记录(例如 "token重算" 或 "adaptor调整")。 clamps 可选:若计算 actualQuo
service/task_billing.go:214
↓ 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
ResetProxyClientCache
ResetProxyClientCache clears cached proxy and non-default direct policy clients and closes idle connections on every transport/shard. The package-leve
service/http_client.go:430
↓ 8 callers
Method
SetEstimatePromptTokens
func (info *RelayInfo) SetPromptTokens(promptTokens int) { info.promptTokens = promptTokens }
relay/common/relay_info.go:714
↓ 8 callers
Method
SetProgressStr
(progress string)
relaykit/dto/openai_video.go:33
↓ 8 callers
Function
SetToolPriceForTest
SetToolPriceForTest injects a tool price and rebuilds the lookup index. Tests only.
setting/operation_setting/tools.go:222
↓ 8 callers
Function
T
T translates a message key using the language from gin context
i18n/i18n.go:90
↓ 8 callers
Function
UpdateUserUsableGroupsByJSONString
(jsonStr string)
setting/user_usable_group.go:38
↓ 8 callers
Function
ValidateSSRFProtectedFetchURL
(urlStr string)
service/http_client.go:70
↓ 8 callers
Function
calculateTextToolCallSurcharge
(ctx *gin.Context, relayInfo *relaycommon.RelayInfo, summary *textQuotaSummary)
service/text_quota.go:148
↓ 8 callers
Function
canManageTargetRole
(myRole int, targetRole int)
controller/user.go:371
↓ 8 callers
Function
createLog
(log *Log)
model/log.go:101
↓ 8 callers
Function
defaultHTTPTransportPolicy
()
service/http_transport_policy.go:22
↓ 8 callers
Function
getTokenUsedQuota
(t *testing.T, id int)
service/task_billing_test.go:289
↓ 8 callers
Function
getUserAuthVersionKey
(userId int)
model/user_auth_cache.go:30
↓ 8 callers
Function
hasParsedChildren
( node: ParsedNode )
web/src/components/ai-elements/response-node-guards.ts:36
↓ 8 callers
Function
isTagAggregateRow
(row: Channel | TagRow)
web/src/features/channels/lib/channel-utils.ts:617
↓ 8 callers
Method
memCache
()
pkg/cachex/hybrid_cache.go:69
↓ 8 callers
Function
metricValue
(metrics: FlowMetrics, metric: FlowMetric)
web/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
newTestResponsesStreamState
()
relaykit/relayconvert/internal/oai_responses/to_oai_chat_resp_test.go:436
↓ 8 callers
Function
normalizeHeaderContextKey
(key string)
relay/common/override.go:1558
↓ 8 callers
Method
redisOn
()
pkg/cachex/hybrid_cache.go:59
↓ 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
resetSessionCookieSettingsAfterTest
(t *testing.T)
common/url_validator_test.go:125
↓ 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:664
↓ 8 callers
Function
useContextValue
()
web/src/components/ai-elements/context.tsx:52
↓ 8 callers
Function
useRateLimitMiniRedis
(t *testing.T)
middleware/rate_limit_test.go:20
↓ 8 callers
Function
useSubscriptions
()
web/src/features/subscriptions/components/subscriptions-provider.tsx:82
↓ 8 callers
Function
useSystemConfig
(options: UseSystemConfigOptions = {})
web/src/hooks/use-system-config.ts:144
↓ 8 callers
Function
useUsageLogsContext
()
web/src/features/usage-logs/components/usage-logs-provider.tsx:78
↓ 7 callers
Function
ConfigureTrustedProxies
(engine *gin.Engine)
middleware/trusted_proxies.go:22
↓ 7 callers
Method
GetAutoBan
()
model/channel.go:338
↓ 7 callers
Function
GetContextKeyString
(c *gin.Context, key constant.ContextKey)
common/gin.go:165
↓ 7 callers
Function
GetGroupRatioCopy
()
setting/ratio_setting/group_ratio.go:62
↓ 7 callers
Method
GetImageMedia
()
relaykit/dto/openai_request.go:327
↓ 7 callers
Function
GetModelRatio
(name string)
setting/ratio_setting/model_ratio.go:385
↓ 7 callers
Function
GetMonitorSetting
()
setting/operation_setting/monitor_setting.go:41
↓ 7 callers
Function
GetPasskeyByUserID
(userID int)
model/passkey.go:123
↓ 7 callers
Function
GetPaymentSetting
()
setting/operation_setting/payment_setting.go:29
↓ 7 callers
Method
GetResultURL
GetResultURL 获取任务结果 URL(视频地址等) 新数据存在 PrivateData.ResultURL 中;旧数据回退到 FailReason(历史兼容)
model/task.go:136
↓ 7 callers
Function
GetSSRFProtectedHTTPClient
GetSSRFProtectedHTTPClient 返回带拨号时 SSRF 校验的客户端。 ssrfProtectedHTTPClient 由 InitHttpClient 在启动时初始化,运行期只读。
service/http_client.go:136
↓ 7 callers
Method
GetUpstreamModelName
()
relaykit/relayconvert/convmeta/meta.go:20
↓ 7 callers
Method
GetUsageMetadata
()
relaykit/dto/gemini.go:496
↓ 7 callers
Function
GetUserSessionCached
GetUserSessionCached validates cached state first and falls back to the database on a miss or Redis read failure. A deny tombstone never falls back.
model/user_session.go:211
↓ 7 callers
Function
HeaderNavModuleAuth
(module string)
middleware/header_nav.go:104
↓ 7 callers
Method
IsNormalEnd
()
relay/common/stream_status.go:88
↓ 7 callers
Function
IssueSecurityProof
(identity AuthIdentity, method string, scopes []string)
service/auth_token.go:132
↓ 7 callers
Function
LoadFromJsonStringWithCallback
(m *RWMap[K, V], jsonStr string, onSuccess func())
types/rw_map.go:83
↓ 7 callers
Function
LogDatabaseType
()
common/database.go:19
↓ 7 callers
Function
ModelPriceHelper
(c *gin.Context, info *relaycommon.RelayInfo, promptTokens int, meta *types.TokenCountMeta)
relay/helper/price.go:73
← previous
next →
301–400 of 9,732, ranked by callers