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
↓ 3 callers
Method
GetRetry
()
service/channel_select.go:23
↓ 3 callers
Method
GetStringSystem
()
dto/claude.go:470
↓ 3 callers
Function
GetSubscriptionOrderByTradeNo
(tradeNo string)
model/subscription.go:241
↓ 3 callers
Method
GetSystemRoleName
()
dto/openai_request.go:226
↓ 3 callers
Function
GetSystemStatus
GetSystemStatus 获取当前系统状态
common/system_monitor.go:79
↓ 3 callers
Method
GetTag
()
model/channel.go:327
↓ 3 callers
Function
GetToolPriceForModel
GetToolPriceForModel returns the price ($/1K calls) for a tool given a model name. Lookup: longest prefix match → tool default → 0.
setting/operation_setting/tools.go:119
↓ 3 callers
Function
GetUUID
()
common/utils.go:223
↓ 3 callers
Function
GetUniqueUserByEmail
(email string)
model/user.go:865
↓ 3 callers
Method
GetWeight
()
model/channel.go:484
↓ 3 callers
Function
HandleGroupRatio
HandleGroupRatio checks for "auto_group" in the context and updates the group ratio and relayInfo.UsingGroup if present
relay/helper/price.go:44
↓ 3 callers
Method
HasImage
()
relay/common/relay_utils.go:23
↓ 3 callers
Method
Insert
Insert 创建新的供应商记录
model/vendor_meta.go:27
↓ 3 callers
Function
InvalidateSubscriptionPlanCache
(planId int)
model/subscription.go:135
↓ 3 callers
Function
IsAlwaysSkipRetryStatusCode
(code int)
setting/operation_setting/status_code_ranges.go:70
↓ 3 callers
Function
IsDiskCacheAvailable
IsDiskCacheAvailable 检查是否可以创建新的磁盘缓存
common/disk_cache_config.go:170
↓ 3 callers
Method
IsEnabled
IsEnabled returns whether this OAuth provider is enabled
oauth/provider.go:16
↓ 3 callers
Method
IsLocked
IsLocked 检查账户是否被锁定
model/twofa.go:135
↓ 3 callers
Function
IsOpenAIReasoningOModel
(modelName string)
dto/openai_request.go:216
↓ 3 callers
Function
IsRequestBodyTooLargeError
(err error)
common/gin.go:25
↓ 3 callers
Function
IsSkipRetryError
(err *NewAPIError)
types/error.go:373
↓ 3 callers
Method
IsStream
(c *gin.Context)
dto/request_common.go:10
↓ 3 callers
Method
Items
Items 返回 Set 中所有元素组成的切片 注意:由于 map 的无序性,返回的切片元素顺序是随机的
types/set.go:36
↓ 3 callers
Function
LoadFromJsonString
(m *RWMap[K, V], jsonStr string)
types/rw_map.go:77
↓ 3 callers
Function
LocalLogPreview
LocalLogPreview limits log-only content unless debug logging is enabled.
common/str.go:27
↓ 3 callers
Function
LogJson
LogJson 仅供测试使用 only for test
logger/logger.go:176
↓ 3 callers
Function
LogQuotaData
(params QuotaDataLogParams)
model/usedata.go:78
↓ 3 callers
Function
LookupRequestConverter
(converter string)
service/relayconvert/request_registry.go:140
↓ 3 callers
Function
MainDatabaseType
()
common/database.go:15
↓ 3 callers
Function
ModelPriceHelperPerCall
ModelPriceHelperPerCall 按次/按量计费的 PriceHelper (MJ、Task)
relay/helper/price.go:186
↓ 3 callers
Function
NewChannelSortOptions
(sortBy string, sortOrder string, idSort bool)
model/channel.go:87
↓ 3 callers
Function
NewRequestId
()
common/utils.go:281
↓ 3 callers
Function
NewSSRFProtectionFromFetchSetting
NewSSRFProtectionFromFetchSetting builds an SSRFProtection from persisted fetch_setting values.
common/ssrf_protection.go:33
↓ 3 callers
Function
NewURLFileSource
--------------------------------------------------------------------------- Constructors -------------------------------------------------------------
types/file_source.go:123
↓ 3 callers
Method
NormalizeDefaults
()
model/subscription.go:204
↓ 3 callers
Function
NotifyRootUser
(t string, subject string, content string)
service/user_notify.go:16
↓ 3 callers
Method
ParseContent
()
dto/openai_request.go:527
↓ 3 callers
Method
ParseSystem
()
dto/claude.go:481
↓ 3 callers
Method
ParseTaskResult
(respBody []byte)
relay/channel/adapter.go:78
↓ 3 callers
Function
PostAudioConsumeQuota
(ctx *gin.Context, relayInfo *relaycommon.RelayInfo, usage *dto.Usage, extraContent string)
service/quota.go:282
↓ 3 callers
Method
ProcessEvent
(event *dto.ResponsesStreamResponse)
service/relayconvert/internal/oai_responses/to_oai_chat_stream_resp.go:565
↓ 3 callers
Function
QuotaFromFloatChecked
QuotaFromFloatChecked is QuotaFromFloat but also returns a non-nil *QuotaClamp when the value was clamped, so billing callers can audit it.
common/quota_math.go:105
↓ 3 callers
Function
QuotaRound
QuotaRound converts a float64 quota value to int using half-away-from-zero rounding, with saturation. Every tiered billing path (pre-consume, settleme
common/quota_math.go:119
↓ 3 callers
Function
RecordOperationAuditLog
RecordOperationAuditLog 记录管理/高危操作审计日志(type=LogTypeManage)。 logUserId 为日志归属者,管理审计日志应归属实际操作者;目标资源/用户放入 action params。username 内部按 logUserId 查询。content 为
model/log.go:229
↓ 3 callers
Function
RecordTaskBillingLog
(params RecordTaskBillingLogParams)
model/log.go:419
↓ 3 callers
Function
Redeem
(key string, userId int)
model/redemption.go:137
↓ 3 callers
Function
RefreshCodexOAuthTokenWithProxy
(ctx context.Context, refreshToken string, proxyURL string)
service/codex_oauth.go:33
↓ 3 callers
Function
RefreshPricing
RefreshPricing 强制立即重新计算与定价相关的缓存。 该方法用于需要最新数据的内部管理 API, 因此会绕过默认的 1 分钟延迟刷新。
model/pricing_refresh.go:6
↓ 3 callers
Function
ResponseOpenAI2Claude
(openAIResponse *dto.OpenAITextResponse, info *relaycommon.RelayInfo)
service/relayconvert/response_compat.go:23
↓ 3 callers
Function
ResponsesFinishReasonFromStatus
(resp *dto.OpenAIResponsesResponse)
service/relayconvert/internal/oai_responses/to_oai_chat_resp.go:38
↓ 3 callers
Function
ResponsesStreamEventToChatChunks
(event *dto.ResponsesStreamResponse, state *ResponsesToChatStreamState)
service/relayconvert/internal/oai_responses/to_oai_chat_stream_resp.go:71
↓ 3 callers
Function
RoleSubject
RoleSubject is the casbin subject string for a role.
service/authz/permission.go:25
↓ 3 callers
Function
RootUserExists
()
model/user.go:1234
↓ 3 callers
Function
SaveQuotaDataCache
()
model/usedata.go:100
↓ 3 callers
Function
SearchModels
(keyword string, vendor string, status string, syncOfficial string, offset int, limit int)
model/model_meta.go:194
↓ 3 callers
Method
SetReasoningContent
(s string)
dto/openai_response.go:117
↓ 3 callers
Method
SetStringContent
(content string)
dto/openai_request.go:509
↓ 3 callers
Function
SetUserPermissionsInTx
(tx *gorm.DB, userID int, permissions PermissionsMap)
service/authz/override.go:42
↓ 3 callers
Method
SetupRequestHeader
(c *gin.Context, header *http.Header, info *relaycommon.RelayInfo)
relay/channel/advancedcustom/adaptor.go:196
↓ 3 callers
Function
ShouldRetryByStatusCode
(code int)
setting/operation_setting/status_code_ranges.go:80
↓ 3 callers
Function
String2Int
(str string)
common/str.go:84
↓ 3 callers
Method
Summary
()
relay/common/stream_status.go:97
↓ 3 callers
Method
SupplementResponseOutput
(resp *dto.OpenAIResponsesResponse)
service/relayconvert/internal/oai_responses/to_oai_chat_stream_resp.go:595
↓ 3 callers
Method
SupportedEndpointTypesForModel
(model string)
dto/channel_settings.go:158
↓ 3 callers
Method
SupportsPathForModel
SupportsPathForModel reports whether any route matches requestPath and model.
dto/channel_settings.go:153
↓ 3 callers
Function
TaskBulkUpdateByID
TaskBulkUpdateByID performs an unconditional bulk UPDATE by primary key IDs. WARNING: This function has NO CAS (Compare-And-Swap) guard — it will over
model/task.go:455
↓ 3 callers
Function
ThemeAwarePath
ThemeAwarePath rewrites legacy /console/* paths to the default-theme equivalents when the active theme is "default". For "classic" (or any other them
common/constants.go:45
↓ 3 callers
Method
ToClaudeError
()
types/error.go:213
↓ 3 callers
Function
TrimEffortSuffixWithSuffixes
(modelName string, suffixes []string)
setting/reasoning/suffix.go:20
↓ 3 callers
Method
TryLock
()
controller/user.go:1263
↓ 3 callers
Function
UpdateModelRatioByJSONString
(jsonStr string)
setting/ratio_setting/model_ratio.go:384
↓ 3 callers
Function
UpdatePendingTopUpStatus
(tradeNo string, expectedPaymentProvider string, targetStatus string)
model/topup.go:82
↓ 3 callers
Method
UpdateWithTx
(tx *gorm.DB, updatePassword bool)
model/user.go:654
↓ 3 callers
Function
UpsertPasskeyCredential
(credential *PasskeyCredential)
model/passkey.go:180
↓ 3 callers
Method
ValidateBackupCodeAndUpdateUsage
ValidateBackupCodeAndUpdateUsage 验证备用码并更新使用记录
model/twofa.go:264
↓ 3 callers
Method
ValidateResolvedIP
ValidateResolvedIP validates a domain's resolved IP immediately before dialing it.
common/ssrf_protection.go:319
↓ 3 callers
Function
ValidateURLWithFetchSetting
ValidateURLWithFetchSetting 使用FetchSetting配置验证URL
common/ssrf_protection.go:380
↓ 3 callers
Function
VerifyCodeWithKey
(key string, code string, purpose string)
common/verification.go:47
↓ 3 callers
Method
WriteContext
(c *gin.Context)
model/user_cache.go:27
↓ 3 callers
Method
WriteHeaders
(originModel string, httpHeader *http.Header)
setting/model_setting/claude.go:51
↓ 3 callers
Function
apiKeyHeaderAuth
()
web/default/src/features/channels/lib/advanced-custom.ts:196
↓ 3 callers
Function
applyExplicitLogTextFilter
(tx *gorm.DB, column string, value string)
model/log.go:19
↓ 3 callers
Function
applyHeaderOverrideToRequest
(req *http.Request, headerOverride map[string]string)
relay/channel/api_request.go:294
↓ 3 callers
Function
applyPreset
(kind: 'today' | '7d' | 'week' | '30d' | 'month')
web/default/src/features/usage-logs/components/compact-date-time-range-picker.tsx:88
↓ 3 callers
Function
applyUpstreamContentLength
applyUpstreamContentLength populates req.ContentLength when the upstream body is wrapped in a BodyStorage (see relay/common/outbound_body.go). net/ht
relay/channel/api_request.go:36
↓ 3 callers
Function
asOAIChatResponse
(response any)
service/relayconvert/response_registry.go:983
↓ 3 callers
Function
asOAIChatStreamResponse
(response any)
service/relayconvert/response_registry.go:994
↓ 3 callers
Function
assignDisplayLogIds
(logs []*Log, startIdx int)
model/log.go:110
↓ 3 callers
Function
auditOperatorInfo
auditOperatorInfo 从上下文构建操作者身份信息(管理员 id/用户名/角色)。
controller/audit.go:69
↓ 3 callers
Function
authHelper
(c *gin.Context, minRole int)
middleware/auth.go:37
↓ 3 callers
Function
bearerHeaderAuth
()
web/default/src/features/channels/lib/advanced-custom.ts:190
↓ 3 callers
Function
buildApiPayload
( messages, systemPrompt, inputs, parameterEnabled, )
web/classic/src/helpers/api.js:112
↓ 3 callers
Function
buildChannelAffinityCacheKeySuffix
(rule operation_setting.ChannelAffinityRule, modelName string, usingGroup string, affinityValue string)
service/channel_affinity.go:337
↓ 3 callers
Function
buildChannelAffinityStatsContextForTest
(ruleName, usingGroup, keyFP string)
service/channel_affinity_usage_cache_test.go:15
↓ 3 callers
Function
buildClaudeUsageFromOpenAIUsage
(oaiUsage *dto.Usage)
service/relayconvert/internal/oai_chat/to_claude_messages_resp.go:20
↓ 3 callers
Function
buildFormDefaults
(defaults: FlatOAuthDefaults)
web/default/src/features/system-settings/auth/oauth-section.tsx:176
↓ 3 callers
Function
buildLogLikeCondition
(column string, value string)
model/log.go:33
↓ 3 callers
Function
buildMaskedTokenResponse
(token *model.Token)
controller/token.go:17
↓ 3 callers
Function
buildMessageDeltaPatchUsage
(claudeResponse *dto.ClaudeResponse, claudeInfo *ClaudeResponseInfo)
relay/channel/claude/relay-claude.go:64
↓ 3 callers
Function
buildOAuthCallbackUrl
( serverAddress: string, callbackPath: string, fallback: string )
web/default/src/features/system-settings/auth/oauth-callback-url.ts:28
← previous
next →
901–1,000 of 10,602, ranked by callers