Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/QuantumNous/new-api
/ functions
Functions
15,409 in github.com/QuantumNous/new-api
⨍
Functions
15,409
◇
Types & classes
2,241
↓ 5 callers
Function
DoRequest
(c *gin.Context, req *http.Request, info *common.RelayInfo)
relay/channel/api_request.go:528
↓ 5 callers
Function
EnableWorker
()
setting/system_setting/system_setting_old.go:9
↓ 5 callers
Function
ErrOptionWithNoRecordErrorLog
()
relaykit/types/error.go:395
↓ 5 callers
Method
EstimateBillingValidated
(c *gin.Context, info *relaycommon.RelayInfo)
relay/channel/adapter.go:140
↓ 5 callers
Function
ExtractRequest
(format types.RelayFormat, request any)
relaykit/relayconvert/internal/toolconv/decode.go:17
↓ 5 callers
Function
FinalizeChatCompletionsStreamToResponses
(state *ChatToResponsesStreamState)
relaykit/relayconvert/internal/oai_chat/to_oai_responses_stream_resp.go:387
↓ 5 callers
Function
FormatRootLogs
FormatRootLogs normalizes legacy metadata into the current scoped shape without removing root-only diagnostics.
model/log.go:133
↓ 5 callers
Function
FreshPluginCredentialLine
FreshPluginCredentialLine returns the line a request about to use the credential line at keyIndex sends: the line, or its refresh when it expires with
service/provider_plugin.go:383
↓ 5 callers
Function
FromOpenAIResponses
(req *dto.OpenAIResponsesRequest)
relaykit/relayconvert/reasoning/intent.go:513
↓ 5 callers
Function
GeminiTextGenerationHandler
(c *gin.Context, info *relaycommon.RelayInfo, resp *http.Response)
relay/channel/gemini/relay-gemini-native.go:21
↓ 5 callers
Function
GenRelayInfo
(c *gin.Context, relayFormat types.RelayFormat, request dto.Request, ws *websocket.Conn)
relay/common/relay_info.go:712
↓ 5 callers
Function
GetAudioCompletionRatio
(name string)
setting/ratio_setting/model_ratio.go:619
↓ 5 callers
Function
GetAudioRatio
(name string)
setting/ratio_setting/model_ratio.go:611
↓ 5 callers
Function
GetBuiltinBillingExpr
(model string)
setting/billing_setting/tiered_billing.go:81
↓ 5 callers
Function
GetChannelPollingLock
GetChannelPollingLock returns or creates a mutex for the given channel ID
model/channel.go:704
↓ 5 callers
Function
GetConsoleSetting
GetConsoleSetting 获取 ConsoleSetting 配置实例
setting/console_setting/config.go:37
↓ 5 callers
Function
GetDiskCacheDir
GetDiskCacheDir 获取统一的磁盘缓存目录 注意:每次调用都会重新计算,以响应配置变化
common/disk_cache.go:25
↓ 5 callers
Function
GetEmailBinding
(identity AuthSessionIdentity, token string)
model/email_binding.go:59
↓ 5 callers
Function
GetEndpointTypesByChannelType
GetEndpointTypesByChannelType 获取渠道最优先端点类型(所有的渠道都支持 OpenAI 端点)
common/endpoint_type.go:6
↓ 5 callers
Method
GetErrorType
()
relaykit/types/error.go:119
↓ 5 callers
Function
GetGroupGroupRatio
(userGroup, usingGroup string)
setting/ratio_setting/group_ratio.go:88
↓ 5 callers
Function
GetJsonType
(data RawMessage)
common/json.go:106
↓ 5 callers
Function
GetLatestSystemTasks
(taskTypes []string)
model/system_task.go:308
↓ 5 callers
Method
GetMaskedKey
()
model/token.go:84
↓ 5 callers
Function
GetModelPricingIssues
GetModelPricingIssues reads the provider variants of the pricing snapshot for every model a live plugin declares and an enabled channel serves, and ev
model/model_pricing_config.go:382
↓ 5 callers
Method
GetName
GetName returns the display name of the provider (e.g., "GitHub", "Discord")
oauth/provider.go:13
↓ 5 callers
Method
GetOpenAIError
GetOpenAIError 从动态错误类型中提取OpenAIError结构
relaykit/dto/openai_response.go:22
↓ 5 callers
Function
GetSelfUserById
GetSelfUserById reads dashboard profile data and password existence in one query. The password hash and management access token are never selected.
model/user.go:523
↓ 5 callers
Method
GetStringSystem
()
relaykit/dto/claude.go:593
↓ 5 callers
Function
GetTokenById
(id int)
model/token.go:274
↓ 5 callers
Function
GetTokenByIds
(id int, userId int)
model/token.go:264
↓ 5 callers
Function
GetUserOAuthBindingsByUserId
GetUserOAuthBindingsByUserId returns all OAuth bindings for a user
model/user_oauth_binding.go:24
↓ 5 callers
Function
GetUserUsableGroups
(userGroup string)
service/group.go:14
↓ 5 callers
Function
GetUserVerificationState
(userID int)
model/login_verification.go:23
↓ 5 callers
Function
HandleClaudeResponseData
(c *gin.Context, info *relaycommon.RelayInfo, claudeInfo *ClaudeResponseInfo, httpResp *http.Response, data []
relay/channel/claude/relay-claude.go:358
↓ 5 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:37
↓ 5 callers
Function
HandleStreamFinalResponse
(c *gin.Context, info *relaycommon.RelayInfo, claudeInfo *ClaudeResponseInfo)
relay/channel/claude/relay-claude.go:275
↓ 5 callers
Method
HasCallablePath
HasCallablePath reports whether an exported value, or a nested member below it, exists and is callable.
pkg/jsplugin/engine.go:290
↓ 5 callers
Function
HashBackupCode
HashBackupCode 对备用码进行哈希
common/totp.go:110
↓ 5 callers
Function
HostProtocol
(name string)
pkg/jsplugin/routing.go:112
↓ 5 callers
Function
Icon
Icon returns the embedded sidecar logo for a factory plugin, if the plugin directory ships an icon.svg or icon.png next to plugin.js.
plugins/embed.go:51
↓ 5 callers
Method
IncreaseRetry
()
service/channel_select.go:69
↓ 5 callers
Method
IncrementFailedAttempts
IncrementFailedAttempts 增加失败尝试次数
model/twofa.go:84
↓ 5 callers
Method
Info
(context.Context, string, ...any)
model/user_session_migration_test.go:37
↓ 5 callers
Method
Init
Init initializes the limiter once. Repeated calls leave the first configuration unchanged.
common/rate-limit.go:82
↓ 5 callers
Function
InitializeExternalIdentityClaims
InitializeExternalIdentityClaims imports legacy Telegram bindings after the claim table is migrated. Existing duplicate ownership fails migration rath
model/external_identity_claim.go:121
↓ 5 callers
Method
Insert
()
model/subscription.go:242
↓ 5 callers
Function
IntentFromState
IntentFromState reconstructs a portable intent from host- or pivot-carried conversion state. A nil state is an empty intent.
relaykit/relayconvert/reasoning/intent.go:96
↓ 5 callers
Method
IsLocked
IsLocked 检查账户是否被锁定
model/twofa.go:137
↓ 5 callers
Function
IsPasskeyDomainOption
ServerAddress and origins participate because either can change an implicit RP ID.
model/passkey_option.go:46
↓ 5 callers
Function
IsRequestPolicyOption
(key string)
model/request_policy.go:61
↓ 5 callers
Function
JsonRawMessageToString
JsonRawMessageToString returns JSON strings as their decoded value and other JSON values as raw text.
relaykit/relayconvert/kitutil/json.go:112
↓ 5 callers
Method
KeywordFields
KeywordFields returns the names of the keywords format properties.
pkg/jsplugin/config_schema.go:456
↓ 5 callers
Function
ListModels
(c *gin.Context, modelType int)
controller/model.go:218
↓ 5 callers
Function
ListUserAccessTokens
(userID int)
model/user_access_token.go:112
↓ 5 callers
Function
LoadFileSource
LoadFileSource 加载文件源数据 这是统一的入口,会自动处理缓存和不同的来源类型
service/file_service.go:47
↓ 5 callers
Function
LoadOptionsFromDatabase
LoadOptionsFromDatabase applies every stored option. A failed read keeps the options in memory as they are.
model/option.go:200
↓ 5 callers
Function
MaskSensitiveInfo
MaskSensitiveInfo masks the upstream addresses in str and leaves every other URL and domain readable. upstreamURLs are the channel base URL and the UR
relaykit/relayconvert/kitutil/mask.go:102
↓ 5 callers
Function
MergeClaudeUsageNonZero
(current *ClaudeUsage, incoming *ClaudeUsage)
relaykit/dto/usage_merge.go:151
↓ 5 callers
Function
MergeExplicitAndSuffix
MergeExplicitAndSuffix combines structured request fields with a model-name alias or @ modifier. The model name wins wherever the two disagree: it is
relaykit/relayconvert/reasoning/intent.go:217
↓ 5 callers
Function
MergeGeminiUsageMetadataNonZero
MergeGeminiUsageMetadataNonZero overlays Gemini's cumulative usage snapshots: a later non-zero field overwrites the current value without dropping fie
relaykit/dto/usage_merge.go:220
↓ 5 callers
Function
MessageWithRequestId
(message string, id string)
common/utils.go:268
↓ 5 callers
Function
MigrateAuditLogs
MigrateAuditLogs also supports independently configured ClickHouse log stores. No TTL clause or usage-log cleanup integration is intentional.
model/audit_log.go:251
↓ 5 callers
Function
ModelFamily
ModelFamily classifies a model name, case-insensitively. Vendor prefixes and date suffixes are allowed (for example us.anthropic.claude-opus-4-7-v1:0)
tokenkit/tokenkit.go:31
↓ 5 callers
Function
NamespacedToolName
NamespacedToolName is the upstream function name of a tool declared in a Responses tool namespace: "<namespace>__<name>", or the bare name for the def
relaykit/relayconvert/convmeta/meta.go:118
↓ 5 callers
Function
NewChatToResponsesStreamState
(id string, model string)
relaykit/relayconvert/internal/oai_chat/to_oai_responses_stream_resp.go:112
↓ 5 callers
Function
NewEstimatedGeminiChatBillingUsage
(usage *Usage)
relaykit/dto/billing_usage.go:124
↓ 5 callers
Function
NewFileSourceFromData
(data string, mimeType string)
relaykit/types/file_source.go:134
↓ 5 callers
Function
NewGenericOAuthProvider
NewGenericOAuthProvider creates a new generic OAuth provider from config
oauth/generic.go:73
↓ 5 callers
Function
NewRWMap
()
types/rw_map.go:27
↓ 5 callers
Function
NewRequestId
()
common/utils.go:256
↓ 5 callers
Function
NewSystemTaskProgressReporter
NewSystemTaskProgressReporter returns a throttled progress callback bound to a running task. Handlers call it with (processed, total) as they iterate
service/system_task.go:479
↓ 5 callers
Function
NewUserSortOptions
(sortBy string, sortOrder string)
model/user.go:36
↓ 5 callers
Function
NormalizeResponsesWebSearchAction
NormalizeResponsesWebSearchAction validates and canonicalizes the current Responses web_search_call action union. Claude emits {"query": ...}; the Res
relaykit/dto/openai_response.go:495
↓ 5 callers
Function
NotifyChannelWatchers
NotifyChannelWatchers sends a channel notice (a channel disabled or enabled automatically, or a test of all channels finished) to every administrator
service/user_notify.go:21
↓ 5 callers
Function
OaiStreamHandler
(c *gin.Context, info *relaycommon.RelayInfo, resp *http.Response)
relay/channel/openai/relay-openai.go:105
↓ 5 callers
Function
OpenAIChatRequestToClaudeMessages
(c context.Context, info convmeta.Meta, textRequest dto.GeneralOpenAIRequest)
relaykit/relayconvert/request_compat.go:20
↓ 5 callers
Function
ParseMultipartFormReusable
(c *gin.Context)
common/gin.go:367
↓ 5 callers
Method
ParseSystem
()
relaykit/dto/claude.go:604
↓ 5 callers
Function
PluginCredentialHookContext
PluginCredentialHookContext is the context of a login, refresh or revoke call on a channel: utils.fetch may POST, through the channel proxy, and alway
service/provider_plugin.go:143
↓ 5 callers
Function
PluginKeyToken
PluginKeyToken returns the exchangeKey token of the static key line of a channel: the cached one, or a new exchange when there is none or it expires w
service/provider_plugin.go:325
↓ 5 callers
Function
PreflightRoutingConflict
PreflightRoutingConflict reports whether admitting candidate into the current generation would collide on a channel type, a case-folded model name, or
pkg/jsplugin/routing.go:1216
↓ 5 callers
Method
ProtocolSupports
ProtocolSupports reports whether the named protocol claim includes mode.
pkg/jsplugin/registry.go:352
↓ 5 callers
Function
QuotaRoundStrict
QuotaRoundStrict rejects an unrepresentable pre-consume estimate.
pkg/billingexpr/round.go:17
↓ 5 callers
Function
RecordRequestPolicyTermination
RecordRequestPolicyTermination appends the final decision after routing has stopped. It never writes a log row itself: the per-channel error log writt
service/request_policy.go:169
↓ 5 callers
Function
RecordTopupLog
(userId int, content *common.Message, callerIp string, paymentMethod string, callbackPaymentMethod string)
model/log.go:253
↓ 5 callers
Function
RefreshUserGroupCache
RefreshUserGroupCache publishes current user metadata after a group change.
model/user_cache.go:217
↓ 5 callers
Method
RelayRoute
RelayRoute returns the relay route serving requestPath for model, with the converter as the manifest declares it.
pkg/jsplugin/registry.go:229
↓ 5 callers
Function
RequestPluginFetcher
RequestPluginFetcher returns the utils.fetch of a request processing instance's ingress, egress and report hooks: the plugin's allowedHosts and the ho
service/provider_plugin.go:79
↓ 5 callers
Function
RequirePermission
(permission authz.Permission)
middleware/auth.go:410
↓ 5 callers
Method
Reserve
Reserve 将预扣额度补到目标值;若目标值不高于当前预扣额度则不做任何事。
relay/common/billing.go:23
↓ 5 callers
Method
ResponseFailed
()
relay/common/stream_status.go:169
↓ 5 callers
Function
ResponsesResponseToChatCompletionsResponse
(resp *dto.OpenAIResponsesResponse, id string)
relaykit/relayconvert/internal/oai_responses/to_oai_chat_resp.go:59
↓ 5 callers
Function
RevokeUserAccessToken
RevokeUserAccessToken returns the generation actually revoked under the row lock. Deprecated: 旧版面板访问令牌,仅在升级后的过渡期内使用;删除 users.access_token 列时一并移除。
model/user.go:149
↓ 5 callers
Function
RoleSubject
RoleSubject is the casbin subject string for a role.
service/authz/permission.go:25
↓ 5 callers
Method
ServerEvent
ServerEvent passes one upstream event to the client: the text of each response through its reply check, and the events of each response to its report,
relay/requestplugin/socket.go:461
↓ 5 callers
Method
SetAutoGroups
(groups []string)
model/token.go:50
↓ 5 callers
Method
SetFirstResponseTime
()
relay/common/relay_info.go:1020
↓ 5 callers
Method
SetScopes
(scopes []string)
model/user_access_token.go:71
↓ 5 callers
Function
SetUserPermissions
(userID int, permissions PermissionsMap)
service/authz/override.go:20
← previous
next →
1,301–1,400 of 15,409, ranked by callers