Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/QuantumNous/new-api
/ functions
Functions
9,195 in github.com/QuantumNous/new-api
⨍
Functions
9,195
◇
Types & classes
1,481
↓ 3 callers
Function
GetUniqueUserByEmail
(email string)
model/user.go:1033
↓ 3 callers
Method
GetWeight
()
model/channel.go:490
↓ 3 callers
Function
HandleClaudeResponseData
(c *gin.Context, info *relaycommon.RelayInfo, claudeInfo *ClaudeResponseInfo, httpResp *http.Response, data []
relay/channel/claude/relay-claude.go:217
↓ 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
Function
HardDeleteUserById
(id int)
model/user.go:484
↓ 3 callers
Method
HasImage
()
relay/common/relay_utils.go:23
↓ 3 callers
Method
IncrementFailedAttempts
IncrementFailedAttempts 增加失败尝试次数
model/twofa.go:132
↓ 3 callers
Method
Insert
Insert 创建新的供应商记录
model/vendor_meta.go:27
↓ 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
IsLocked
IsLocked 检查账户是否被锁定
model/twofa.go:180
↓ 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
ListActiveUserSessions
(userID int, currentSID string, now int64)
model/user_session.go:395
↓ 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
Method
ModelListRoute
ModelListRoute returns the explicitly configured OpenAI Models discovery route. Template routes that merely happen to match /v1/models are not discove
dto/channel_settings.go:152
↓ 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
NormalizeOrigin
NormalizeOrigin validates and canonicalizes a browser origin. Only an exact scheme/host/effective-port match is meaningful; paths and wildcards are no
common/session_cookie.go:14
↓ 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
Function
ParseProxyURLRuntime
ParseProxyURLRuntime validates and normalizes a proxy URL for runtime use. The boolean result reports whether a legacy path, query, or fragment was re
common/proxy_url.go:19
↓ 3 callers
Method
ParseSystem
()
dto/claude.go:481
↓ 3 callers
Method
ParseTaskResult
(respBody []byte)
relay/channel/adapter.go:78
↓ 3 callers
Function
PaymentReturnURL
(suffix string)
service/return_path.go:9
↓ 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:582
↓ 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
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
RedisDelKey
(key string)
common/redis.go:99
↓ 3 callers
Function
RedisHGetObj
(key string, obj interface{})
common/redis.go:161
↓ 3 callers
Function
RefreshCodexChannelCredential
(ctx context.Context, channelID int, opts CodexCredentialRefreshOptions)
service/codex_credential_refresh.go:42
↓ 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
RequireSecurityProof
RequireSecurityProof validates a proof against the authenticated dashboard session and writes the shared proof error contract on failure.
middleware/secure_verification.go:26
↓ 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
RevokeByRefreshToken
(rawRefreshToken, expectedSID, reason string)
service/auth_session.go:263
↓ 3 callers
Function
RevokeOtherUserSessions
(userID int, currentSID, reason string)
model/user_session.go:704
↓ 3 callers
Function
RevokeUserSessionByRefreshHash
RevokeUserSessionByRefreshHash is used when logout is authenticated only by the HttpOnly refresh cookie. Possession of a SID alone is insufficient. Th
model/user_session.go:600
↓ 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:1413
↓ 3 callers
Function
RotateUserSessionRefresh
RotateUserSessionRefresh atomically rotates HMAC digests. The UPDATE itself is a compare-and-swap so SQLite, where lockForUpdate is intentionally a no
model/user_session.go:451
↓ 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
SetUserAuthVersionFence
SetUserAuthVersionFence publishes a fail-closed version before a restrictive database update. Pending fences expire only after every pre-existing user
model/user_auth_cache.go:129
↓ 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:241
↓ 3 callers
Function
ShouldRetryByStatusCode
(code int)
setting/operation_setting/status_code_ranges.go:80
↓ 3 callers
Function
StrToMap
(str string)
common/str.go:56
↓ 3 callers
Function
String2Int
(str string)
common/str.go:84
↓ 3 callers
Function
StringsContains
(strs []string, str string)
common/str.go:92
↓ 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:612
↓ 3 callers
Method
SupportsPathForModel
SupportsPathForModel reports whether any route matches requestPath and model.
dto/channel_settings.go:171
↓ 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:436
↓ 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:1332
↓ 3 callers
Function
UpdateModelRatioByJSONString
(jsonStr string)
setting/ratio_setting/model_ratio.go:384
↓ 3 callers
Function
UpdatePasskeyAssertionState
UpdatePasskeyAssertionState persists only fields produced by a successful assertion. Registration identity (credential ID, public key, AAGUID, transpo
model/passkey.go:164
↓ 3 callers
Function
UpdatePendingTopUpStatus
(tradeNo string, expectedPaymentProvider string, targetStatus string)
model/topup.go:82
↓ 3 callers
Method
ValidateBackupCodeAndUpdateUsage
ValidateBackupCodeAndUpdateUsage 验证备用码并更新使用记录
model/twofa.go:366
↓ 3 callers
Method
ValidateResolvedIP
ValidateResolvedIP validates a domain's resolved IP immediately before dialing it.
common/ssrf_protection.go:319
↓ 3 callers
Method
ValidateSettings
()
model/channel.go:946
↓ 3 callers
Function
ValidateToolPricesJSON
ValidateToolPricesJSON validates an operator-supplied complete price map. A numeric zero is valid and intentionally disables the matching rule.
setting/operation_setting/tools.go:129
↓ 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
WriteHeaders
(originModel string, httpHeader *http.Header)
setting/model_setting/claude.go:51
↓ 3 callers
Function
apiKeyHeaderAuth
()
web/src/features/channels/lib/advanced-custom.ts:208
↓ 3 callers
Function
applyAuthTemplate
(template string, apiKey string)
relay/channel/advancedcustom/adaptor.go:509
↓ 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
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
authFlowTokenHash
(token string)
model/auth_flow.go:92
↓ 3 callers
Function
authHelper
(c *gin.Context, minRole int)
middleware/auth.go:45
↓ 3 callers
Function
bearerHeaderAuth
()
web/src/features/channels/lib/advanced-custom.ts:202
↓ 3 callers
Function
buildAlphaSearchRequestBody
buildAlphaSearchRequestBody returns RawBody unchanged unless the model was mapped, in which case only the "model" field is rewritten so unknown fields
relay/alpha_search_handler.go:123
↓ 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
← previous
next →
901–1,000 of 9,195, ranked by callers