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
↓ 2 callers
Method
Push
(target string, options *http.PushOptions)
router/plugin-router.go:591
↓ 2 callers
Function
QueryBalance
QueryBalance queries a channel's balance with the plugin's buildBalanceRequest and parseBalance, which may chain more requests. A request's path joins
relay/channel/providerplugin/management.go:160
↓ 2 callers
Function
QuerySummaryAll
(hours int, groups []string, recentModels ...string)
pkg/perf_metrics/metrics.go:212
↓ 2 callers
Function
QuotaFromFloat
QuotaFromFloat converts a computed quota value to int, truncating toward zero, with saturation. Use for float products of prices, ratios, and user-con
common/quota_math.go:112
↓ 2 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:133
↓ 2 callers
Function
RawJSONPresent
(raw json.RawMessage)
relaykit/relayconvert/internal/oai_responses/to_oai_chat_req.go:718
↓ 2 callers
Method
Read
([]byte)
middleware/gzip_test.go:141
↓ 2 callers
Function
ReadStartupSyncRevisions
ReadStartupSyncRevisions reads the newest sync task of every topic before the startup loads, so a write made while they run is reloaded once the loop
service/node_sync.go:98
↓ 2 callers
Function
RechargeWaffoPancake
(tradeNo string)
model/topup.go:657
↓ 2 callers
Function
RecordLogWithAdminInfo
RecordLogWithAdminInfo stores operator metadata under other.admin_info and an optional, user-visible operation descriptor under other.op for localizat
model/log.go:171
↓ 2 callers
Function
RedisDelKey
(key string)
common/redis.go:99
↓ 2 callers
Function
RedisKeyCacheSeconds
()
common/redis.go:19
↓ 2 callers
Method
Refresh
Refresh is RefreshPluginCredential on this refresher's single-flight group.
service/provider_plugin.go:165
↓ 2 callers
Function
RefreshTaskPluginRequest
RefreshTaskPluginRequest decodes a task submission again after a request plugin changed its stored body, so validation, pricing and the upstream body
middleware/task_plugin.go:994
↓ 2 callers
Function
RefreshTokenSID
(rawRefreshToken string)
service/auth_session.go:308
↓ 2 callers
Method
Refund
Refund 退还所有预扣费
service/funding_source.go:23
↓ 2 callers
Function
RefundFailedRequestBilling
RefundFailedRequestBilling applies the common final-failure policy after all eligible attempts have ended. A settled BillingSession never refunds agai
relay/request_billing.go:58
↓ 2 callers
Function
RegisterOrUpdateCustomProvider
RegisterOrUpdateCustomProvider registers or updates a single custom provider
oauth/registry.go:150
↓ 2 callers
Function
RegisterSystemTaskHandler
RegisterSystemTaskHandler registers a handler keyed by its Type(). It must be called before StartSystemTaskRunner (or any time, since the runner snaps
service/system_task.go:57
↓ 2 callers
Function
RegisterVerificationCodeWithKey
(key string, code string, purpose string)
common/verification.go:35
↓ 2 callers
Function
RejectConversionLoss
(policy ConversionLossPolicy, diagnostics []ConversionDiagnostic)
relaykit/types/conversion.go:61
↓ 2 callers
Function
RelayNotFound
(c *gin.Context)
controller/relay.go:471
↓ 2 callers
Function
ReleaseExternalIdentityWithTx
(tx *gorm.DB, provider string, userId int)
model/external_identity_claim.go:70
↓ 2 callers
Function
ReleaseSystemTaskLock
(taskID string, lockedBy string)
model/system_task.go:534
↓ 2 callers
Method
RemoveFilteredPolicy
(_ string, ptype string, fieldIndex int, fieldValues ...string)
service/authz/adapter.go:95
↓ 2 callers
Method
RemoveOtherRatiosFromFloat
(value float64)
types/price_data.go:106
↓ 2 callers
Function
RenewSystemTaskLock
(taskID string, lockedBy string, lockUntil int64)
model/system_task.go:487
↓ 2 callers
Function
ReorderChannelPriority
ReorderChannelPriority updates only priorities, including the routing copy in abilities. A snapshot check also protects preview/commit and undo from s
model/channel_priority.go:68
↓ 2 callers
Function
ReportCurrentSystemInstance
()
service/system_instance.go:85
↓ 2 callers
Function
ReportTask
ReportTask hands a task that reached its final state to the report hooks of the instances that matched its submission and are still enabled. It reads
relay/requestplugin/task_report.go:126
↓ 2 callers
Function
RequestAmount
(c *gin.Context)
controller/topup.go:507
↓ 2 callers
Function
RequestFunctionDeclarations
(raw []byte)
relaykit/relayconvert/internal/oai_responses/req_helpers.go:157
↓ 2 callers
Function
RequestToolChoiceToChat
(raw json.RawMessage)
relaykit/relayconvert/internal/oai_responses/to_oai_chat_req.go:447
↓ 2 callers
Function
RerankHandler
(c *gin.Context, info *relaycommon.RelayInfo, resp *http.Response)
relay/common_handler/rerank.go:19
↓ 2 callers
Function
ResendAccountEmailBinding
(identity AuthIdentity, token string, lang string)
service/email_binding.go:96
↓ 2 callers
Function
ResetDiskCacheStats
ResetDiskCacheStats 重置命中统计信息(不重置当前使用量)
common/disk_cache_config.go:147
↓ 2 callers
Method
Resolve
(task *model.Task, artifactKey string)
service/task_artifact_store.go:28
↓ 2 callers
Function
ResolveCompletionRatio
ResolveCompletionRatio applies relay's enforced and fallback ratios to a configuration snapshot or draft without consulting mutable saved settings.
setting/ratio_setting/model_ratio.go:456
↓ 2 callers
Function
ResolveIncomingBillingExprRequestInput
ResolveIncomingBillingExprRequestInput freezes the request context a billing expression reads. Only expressions that call param() read the body; for t
relay/helper/billing_expr_request.go:18
↓ 2 callers
Function
ResolveTaskBillingExpr
ResolveTaskBillingExpr selects the executing plugin's override before the model expression, retaining the model alias fallback and explicit modes. ove
setting/billing_setting/tiered_billing.go:110
↓ 2 callers
Function
ResolveTrustedProxies
ResolveTrustedProxies parses TRUSTED_PROXIES without applying it to an engine. The returned slice can be reused by the outer and plugin engines.
common/trusted_proxies.go:22
↓ 2 callers
Function
ResponseClaude2OpenAI
(claudeResponse *dto.ClaudeResponse)
relaykit/relayconvert/response_compat.go:100
↓ 2 callers
Function
ResponseGeminiChat2OpenAI
(id string, created int64, response *dto.GeminiChatResponse)
relaykit/relayconvert/response_compat.go:140
↓ 2 callers
Function
ResponseOpenAI2Gemini
(openAIResponse *dto.OpenAITextResponse, info convmeta.Meta)
relaykit/relayconvert/response_compat.go:128
↓ 2 callers
Function
ResponsesArgumentsString
ResponsesArgumentsString returns function call arguments in the string form expected by Chat Completions.
relaykit/dto/openai_response.go:572
↓ 2 callers
Function
ResponsesResponseToChatCompletionsResponse
(resp *dto.OpenAIResponsesResponse, id string)
relaykit/relayconvert/response_compat.go:176
↓ 2 callers
Function
ResponsesStatusFromChatFinishReason
(finishReason string)
relaykit/relayconvert/internal/oai_chat/to_oai_responses_resp.go:148
↓ 2 callers
Method
ResponsesToolState
ResponsesToolState returns the Responses tool encoding recorded by the latest request conversion, or nil when none was recorded. Response converters r
relaykit/relayconvert/convmeta/meta.go:48
↓ 2 callers
Function
ResponsesWebSocketHelper
(c *gin.Context, client *websocket.Conn, runner ResponsesWSRequestRunner)
relay/responses_websocket.go:130
↓ 2 callers
Function
RouteTaskPluginEndpoint
RouteTaskPluginEndpoint selects between ordinary relay and plugin channels before a plugin can validate or rewrite the client's request. Plugin calls
middleware/task_plugin.go:520
↓ 2 callers
Function
RunTaskPollingOnce
RunTaskPollingOnce performs one async-task (Suno/video) polling pass synchronously. It honors ctx cancellation (the system-task runner cancels it when
service/task_polling.go:164
↓ 2 callers
Method
SafetySettingFor
(category string)
relaykit/relayconvert/convmeta/options.go:112
↓ 2 callers
Method
Scan
Scan implements sql.Scanner interface
model/channel.go:191
↓ 2 callers
Function
SearchModels
(keyword string, vendor string, status string, syncOfficial string, offset int, limit int)
model/model_meta.go:486
↓ 2 callers
Function
SearchRedemptions
(keyword string, status string, startIdx int, num int)
model/redemption.go:62
↓ 2 callers
Function
SearchUsers
(keyword string, group string, role *int, status *int, startIdx int, num int, sortOptions ...UserSortOptions)
model/user.go:438
↓ 2 callers
Function
SecureVerificationRequired
SecureVerificationRequired protects channel key disclosure. Other sensitive operations validate their narrower proof scopes in their controller.
middleware/secure_verification.go:17
↓ 2 callers
Method
Serve
(c *gin.Context, task *model.Task, ref *StoredArtifactRef)
service/task_artifact_store.go:30
↓ 2 callers
Function
ServeFrontendFiles
ServeFrontendFiles serves files from the embedded frontend build. The build never changes while the process runs, so each file is gzip-compressed once
middleware/frontend_static.go:34
↓ 2 callers
Method
SetAudit
(key string, value any)
model/log_other.go:128
↓ 2 callers
Method
SetContent
(content any)
relaykit/dto/claude.go:106
↓ 2 callers
Function
SetExposeRatioEnabled
(enabled bool)
setting/ratio_setting/expose_ratio.go:11
↓ 2 callers
Method
SetIndex
(i int)
relaykit/dto/openai_response.go:135
↓ 2 callers
Function
SetLogLanguage
SetLogLanguage selects the language of server log lines. A language that starts with "zh" prints the Chinese text; anything else prints English.
common/log_text.go:20
↓ 2 callers
Function
SetLogging
(info LogFunc, errorFn LogFunc)
relaykit/relayconvert/kitutil/log.go:21
↓ 2 callers
Function
SetMediaResolver
(resolver MediaResolver)
relaykit/relayconvert/media.go:7
↓ 2 callers
Method
SetResponsesToolState
SetResponsesToolState replaces that record; nil clears it. Request conversion calls it on every attempt so retries never inherit a record from another
relaykit/relayconvert/convmeta/meta.go:52
↓ 2 callers
Function
SetSyncTopicErrors
SetSyncTopicErrors records the items of topic this node failed to load, by key; nil or empty clears them.
service/node_sync.go:66
↓ 2 callers
Function
SetSystemErrorLogging
SetSystemErrorLogging configures the hook for internal converter failures.
relaykit/relayconvert/kitutil/log.go:31
↓ 2 callers
Function
SetTaskPluginDisabledFactoryKeysOption
(keys []string)
setting/task_plugin.go:111
↓ 2 callers
Function
SetTaskPluginStatus
(c *gin.Context)
controller/task_plugin.go:711
↓ 2 callers
Function
SetUserLangLoader
SetUserLangLoader sets the function to load user language (called from model package)
i18n/i18n.go:124
↓ 2 callers
Function
SetWebRouter
(router *gin.Engine, assets WebAssets, pluginDispatcher gin.HandlerFunc)
router/web-router.go:21
↓ 2 callers
Method
Settle
Settle 根据实际消耗额度进行结算,计算 delta = actualQuota - preConsumedQuota, 同时调整资金来源(钱包/订阅)和令牌额度。
relay/common/billing.go:10
↓ 2 callers
Method
SetupRequestHeader
(c *gin.Context, header *http.Header, info *relaycommon.RelayInfo)
relay/channel/providerplugin/adaptor.go:106
↓ 2 callers
Method
SharedModel
SharedModel reports whether multiple plugins declare a model without copying its provider list on the relay hot path.
pkg/jsplugin/routing.go:537
↓ 2 callers
Function
ShouldAttachThoughtSignature
(opts *convmeta.Options)
relaykit/relayconvert/internal/shared/gemini/request.go:66
↓ 2 callers
Function
ShouldChatCompletionsUseResponsesGlobal
(channelID int, channelType int, model string)
service/openai_chat_responses_mode.go:47
↓ 2 callers
Function
ShouldDisableByStatusCode
(code int)
setting/operation_setting/status_code_ranges.go:53
↓ 2 callers
Method
Start
(server *smtp.ServerInfo)
common/email_ntlm_auth.go:21
↓ 2 callers
Method
StartHostedTool
(start HostedToolStreamStart)
relaykit/relayconvert/internal/oai_chat/to_oai_responses_stream_resp.go:139
↓ 2 callers
Function
StartOAuthVerification
(identity AuthIdentity, operation VerificationOperation, provider string)
service/oauth_verification.go:15
↓ 2 callers
Function
StartRealtime
StartRealtime takes the execution plan of a Realtime session. Its instances run on the session's events once the session knows its channel (NewRealtim
relay/requestplugin/socket.go:164
↓ 2 callers
Function
StopReasonClaudeToOpenAI
(reason string)
relaykit/relayconvert/internal/claude_messages/to_oai_chat_resp.go:31
↓ 2 callers
Method
Stopped
Stopped returns the error the client gets for a response an instance stopped, and nil for any other.
relay/requestplugin/socket.go:151
↓ 2 callers
Function
StreamResponseClaude2OpenAI
(claudeResponse *dto.ClaudeResponse)
relaykit/relayconvert/response_compat.go:50
↓ 2 callers
Function
StreamResponseGeminiChat2OpenAI
(geminiResponse *dto.GeminiChatResponse)
relaykit/relayconvert/response_compat.go:144
↓ 2 callers
Function
StreamResponseOpenAI2Claude
(openAIResponse *dto.ChatCompletionsStreamResponse, info *relaycommon.RelayInfo)
service/convert.go:13
↓ 2 callers
Function
StreamResponseOpenAI2Gemini
(openAIResponse *dto.ChatCompletionsStreamResponse, info *relaycommon.RelayInfo)
service/convert.go:25
↓ 2 callers
Function
StreamResponseOpenAI2Gemini
(openAIResponse *dto.ChatCompletionsStreamResponse, info convmeta.Meta)
relaykit/relayconvert/response_compat.go:132
↓ 2 callers
Function
String2Int
(str string)
common/str.go:77
↓ 2 callers
Function
SumUsedQuota
(logType int, startTimestamp int64, endTimestamp int64, modelName string, username string, tokenName string, c
model/log.go:693
↓ 2 callers
Method
SupportsImagineModel
(modelName string)
relaykit/relayconvert/convmeta/options.go:104
↓ 2 callers
Method
SupportsPassThroughBody
SupportsPassThroughBody reports whether the route converter leaves the request body untouched.
relaykit/dto/channel_settings.go:209
↓ 2 callers
Function
SyncTopicLoadFailed
SyncTopicLoadFailed records that this node's startup load of topic failed: StartNodeSync then leaves the topic unapplied, so the first tick loads it a
service/node_sync.go:112
↓ 2 callers
Function
TaskCreated
TaskCreated marks a submission whose task is stored: the task reports at its final state, so the submission does not report.
relay/requestplugin/task_report.go:116
↓ 2 callers
Function
TaskEgress
TaskEgress runs the egress stage on the upstream body a task submission attempt built, before it is sent. It changes nothing; an instance can only sto
relay/requestplugin/relay.go:172
↓ 2 callers
Function
TaskError
TaskError is the task error of a request plugin's rejection or failure: a local error, which never counts against the channel.
relay/requestplugin/relay.go:205
↓ 2 callers
Function
TaskExecutionSnapshotFromContext
TaskExecutionSnapshotFromContext captures immutable request and plugin provenance at submission time. It never copies plugin source or payloads.
service/task_plugin_audit.go:12
↓ 2 callers
Function
TaskGetAllTasks
(startIdx int, num int, queryParams SyncTaskQueryParams)
model/task.go:354
← previous
next →
3,401–3,500 of 15,409, ranked by callers