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
↓ 4 callers
Function
LookupResponseConverter
(converter string)
relaykit/relayconvert/response_registry.go:219
↓ 4 callers
Function
MapToJsonStr
(m map[string]any)
common/str.go:41
↓ 4 callers
Function
MergeBillingUsageNonZero
MergeBillingUsageNonZero preserves non-zero provider-native fields across partial stream snapshots. A snapshot from a different billing dialect remain
relaykit/dto/usage_merge.go:101
↓ 4 callers
Function
MergeExplicit
MergeExplicit combines two structured representations of the same request. primary wins wherever they disagree; callers pass the more specific represe
relaykit/relayconvert/reasoning/intent.go:290
↓ 4 callers
Function
MetadataRecordVersion
(local *Model, localVendor, upstreamVendor *Vendor)
model/model_metadata_sync.go:74
↓ 4 callers
Method
ModelListRoute
ModelListRoute returns the explicitly configured OpenAI Models discovery route. Template routes that merely happen to match /v1/models are not discove
relaykit/dto/channel_settings.go:296
↓ 4 callers
Function
NewChannelSortOptions
(sortBy string, sortOrder string, idSort bool)
model/channel.go:97
↓ 4 callers
Function
NewOutboundJSONBody
NewOutboundJSONBody wraps the already-marshaled upstream request body into a BodyStorage. When disk cache is enabled and the payload exceeds the confi
relay/common/outbound_body.go:26
↓ 4 callers
Function
NewURLFileSource
--------------------------------------------------------------------------- Constructors -------------------------------------------------------------
relaykit/types/file_source.go:123
↓ 4 callers
Function
NormalizeResetPeriod
(period string)
model/subscription.go:347
↓ 4 callers
Function
NormalizeTaskAction
NormalizeTaskAction maps persisted legacy action names to the canonical task action vocabulary. Unknown platform-specific actions pass through unchang
constant/task.go:32
↓ 4 callers
Function
ObserveChannelAffinityUsageCacheByRelayFormat
ObserveChannelAffinityUsageCacheByRelayFormat records usage cache stats with a stable rate mode derived from relay format.
service/channel_affinity.go:797
↓ 4 callers
Method
OtherRatioMultiplier
()
types/price_data.go:83
↓ 4 callers
Method
ParseBatchResult
(tasks []*model.Task, resp *http.Response, body []byte)
service/task_polling.go:42
↓ 4 callers
Function
ParseGeminiModelSuffix
ParseGeminiModelSuffix is the gemini-* counterpart of ParseClaudeModelSuffix and honours allowSuffixAlias the same way.
relaykit/relayconvert/reasoning/suffix.go:180
↓ 4 callers
Method
ParseInput
()
relaykit/dto/embedding.go:79
↓ 4 callers
Function
ParseOpenAIReasoningEffortFromModelSuffix
ParseOpenAIReasoningEffortFromModelSuffix applies RelayKit's positive family whitelist and the host EffortTailModelIDs escape hatch so real model IDs
setting/reasoning/suffix.go:28
↓ 4 callers
Method
Path
Path is the diagnostic path of the definition in the source tool list.
relaykit/relayconvert/convmeta/websearch.go:83
↓ 4 callers
Function
PluginCredentialViews
PluginCredentialViews lists the credential lines of a channel without their secrets; a static key line has no label or account.
service/provider_plugin_login.go:285
↓ 4 callers
Function
PluginRouteBindings
PluginRouteBindings returns the addresses plugin serves: each declared route and, unless the route lives under the plugin's own prefix, its /{key} cop
pkg/jsplugin/routing.go:995
↓ 4 callers
Method
PluginsByModel
PluginsByModel returns all plugins declaring model, in ascending key order.
pkg/jsplugin/routing.go:528
↓ 4 callers
Function
PostAudioConsumeQuota
(ctx *gin.Context, relayInfo *relaycommon.RelayInfo, usage *dto.Usage, extraContent []*common.Message)
service/quota.go:294
↓ 4 callers
Function
PreviewModelPricingConversion
(name string, draft PricingValues)
model/model_pricing_conversion.go:195
↓ 4 callers
Method
ProcessEvent
(event *dto.ResponsesStreamResponse)
relaykit/relayconvert/internal/oai_responses/to_oai_chat_stream_resp.go:684
↓ 4 callers
Method
ProviderUserIDColumn
ProviderUserIDColumn returns the users-table column that stores this provider's user ID, used by bind flows to update only the binding column instead
oauth/provider.go:41
↓ 4 callers
Function
QuotaRoundChecked
QuotaRoundChecked is QuotaRound but also returns a non-nil *QuotaClamp when the value was clamped, so billing callers can audit it.
common/quota_math.go:140
↓ 4 callers
Function
ReasoningStateOf
ReasoningStateOf is a nil-safe reader for Meta.ReasoningState.
relaykit/relayconvert/convmeta/meta.go:331
↓ 4 callers
Function
RecordPolicyFailure
RecordPolicyFailure appends the failed attempt and the retry decision made for it. The health entry mirrors the check in ProcessChannelError, which pe
service/request_policy.go:100
↓ 4 callers
Function
Redeem
(key string, userId int)
model/redemption.go:136
↓ 4 callers
Function
RedisHGetObj
(key string, obj any)
common/redis.go:161
↓ 4 callers
Function
RefreshLoginSession
(rawRefreshToken, expectedSID, ip, userAgent string)
service/auth_session.go:234
↓ 4 callers
Method
Refund
Refund 退还所有预扣费额度(资金来源 + 令牌),幂等安全。 通过 gopool 异步执行。如果已经结算或退款则不做任何操作。
relay/common/billing.go:14
↓ 4 callers
Function
RefundMidjourneyQuota
RefundMidjourneyQuota reverses every accounting element recorded for a billed legacy task.
service/midjourney.go:96
↓ 4 callers
Function
RegisterCustom
RegisterCustom registers a custom OAuth provider (can be unregistered later)
oauth/registry.go:31
↓ 4 callers
Method
RelayConfig
RelayConfig returns the relay routes as the Advanced Custom configuration of one request. A plugin-converter route reaches the Advanced Custom code as
pkg/jsplugin/registry.go:179
↓ 4 callers
Function
RelayTaskPluginEndpoint
RelayTaskPluginEndpoint keeps unclaimed shared-endpoint traffic on its existing handler while claimed requests enter the generation-pinned host-owned
controller/relay.go:491
↓ 4 callers
Method
RelaysModel
RelaysModel reports whether a relay route accepts model for client requests: the plugin serves the model on chat paths, not only as a task. The model
pkg/jsplugin/registry.go:237
↓ 4 callers
Method
ReplaceOtherRatios
(ratios map[string]float64)
types/price_data.go:54
↓ 4 callers
Function
ResetUserPasswordByEmail
(email string, password string)
model/user.go:1188
↓ 4 callers
Function
ResolveCacheWriteMode
ResolveCacheWriteMode describes display and migration only. A generic engine fallback is not configured cache-write pricing. Only Claude names inherit
model/model_pricing_conversion.go:137
↓ 4 callers
Function
ResolveHeaderOverride
(info *common.RelayInfo, c *gin.Context)
relay/channel/api_request.go:296
↓ 4 callers
Function
RespondTaskPluginError
RespondTaskPluginError gives a pinned plugin a sanitized error DTO and writes its native error body with the host's status, unless the body is a reply
middleware/task_plugin.go:1635
↓ 4 callers
Function
ResponsesFinishReasonFromStatus
(resp *dto.OpenAIResponsesResponse)
relaykit/relayconvert/internal/oai_responses/to_oai_chat_resp.go:39
↓ 4 callers
Function
ResponsesStreamEventToChatChunks
(event *dto.ResponsesStreamResponse, state *ResponsesToChatStreamState)
relaykit/relayconvert/internal/oai_responses/to_oai_chat_stream_resp.go:85
↓ 4 callers
Method
ResponsesToolName
ResponsesToolName restores the Responses namespace and tool name of an upstream function name. Names that were not flattened from a namespace return a
relaykit/relayconvert/convmeta/meta.go:137
↓ 4 callers
Function
RevokeDeletedChannelCredentials
RevokeDeletedChannelCredentials revokes the plugin credentials of deleted task plugin channels, in the background.
service/provider_plugin.go:706
↓ 4 callers
Function
RevokePluginCredentials
RevokePluginCredentials calls the plugin's revoke for each removed credential line of the plugin, in the background. It never blocks the removal and o
service/provider_plugin.go:540
↓ 4 callers
Method
RouteGroups
RouteGroups returns the inner router's registrations: one per method and path shape, without the skipped routes.
pkg/jsplugin/routing.go:628
↓ 4 callers
Function
RunExprByHashWithRequest
(exprStr, hash string, params TokenParams, request RequestInput)
pkg/billingexpr/run.go:45
↓ 4 callers
Function
SelectChannelForRequest
SelectChannelForRequest resolves the channel for one attempt with the rules shared by the HTTP distributor and the Responses WebSocket relay: a pinned
service/channel_select.go:308
↓ 4 callers
Function
SessionCookieOriginGuard
SessionCookieOriginGuard protects cookie-authenticated refresh/logout endpoints when secure cookie mode is enabled. In insecure local development mode
middleware/auth_origin.go:18
↓ 4 callers
Method
SetAccessToken
Deprecated: 旧版面板访问令牌,仅在升级后的过渡期内使用;删除 users.access_token 列时一并移除。
model/user.go:142
↓ 4 callers
Function
SetApiRouter
(router *gin.Engine)
router/api-router.go:17
↓ 4 callers
Method
SetIndex
set index
relaykit/dto/claude.go:632
↓ 4 callers
Method
SetMediaContent
(content []MediaContent)
relaykit/dto/openai_request.go:729
↓ 4 callers
Method
SetMessage
(message string)
relaykit/types/error.go:181
↓ 4 callers
Method
SetRoot
(key string, value any)
model/log_other.go:111
↓ 4 callers
Function
SetTaskRouter
SetTaskRouter registers the generic task-plugin API surface. Gin requires every route sharing a path position to use the same wildcard name, so the f
router/task-router.go:14
↓ 4 callers
Function
SettleBilling
--------------------------------------------------------------------------- SettleBilling — 后结算辅助函数 --------------------------------------------------
service/billing.go:65
↓ 4 callers
Function
ShouldCopyUpstreamHeader
ShouldCopyUpstreamHeader checks whether a given upstream response header should be copied to the client response. It returns false for Content-Length
service/http.go:31
↓ 4 callers
Method
ShouldPreserveThinkingSuffix
(modelName string)
relaykit/relayconvert/convmeta/options.go:119
↓ 4 callers
Function
SplitProviderConverter
SplitProviderConverter returns the converter the host runs for a route converter and whether the plugin's convert hooks run too: "plugin" is "none" wi
pkg/jsplugin/registry.go:153
↓ 4 callers
Function
Stopped
Stopped reports a task error a request plugin's rejection or failure caused; it is neither retried nor hidden from the client.
relay/requestplugin/relay.go:214
↓ 4 callers
Method
SupportsJSONSchemaModel
(modelName string)
relaykit/relayconvert/convmeta/options.go:108
↓ 4 callers
Function
SystemPerformanceCheck
SystemPerformanceCheck 检查系统性能中间件
middleware/performance.go:14
↓ 4 callers
Method
ToOpenAIVideo
()
model/task.go:677
↓ 4 callers
Function
TokenModelLimitAllows
TokenModelLimitAllows reports whether a token model-limit map authorizes model. Exact name, wildcard-normalized name, and routing-normalized name (mod
middleware/distributor.go:586
↓ 4 callers
Function
TrimEffortSuffixWithSuffixes
(modelName string, suffixes []string)
relaykit/relayconvert/reasoning/suffix.go:114
↓ 4 callers
Function
TryReserveTokenQuota
TryReserveTokenQuota atomically checks and deducts a token quota. Unlimited tokens skip the balance check but still update remain/used accounting.
model/quota_reserve.go:202
↓ 4 callers
Function
UnregisterCustomProvider
UnregisterCustomProvider unregisters a custom provider by slug
oauth/registry.go:158
↓ 4 callers
Method
UpdateImageCount
UpdateImageCount replaces the billable quantity without changing the frozen request parameters or multiplying the legacy and expression prices togethe
relay/common/relay_info.go:255
↓ 4 callers
Function
UpdateUserSetting
(userId int, setting dto.UserSetting)
model/user.go:185
↓ 4 callers
Function
UpdateUserUsedQuota
UpdateUserUsedQuota adjusts accumulated usage without changing request count.
model/user.go:1444
↓ 4 callers
Function
UsageFromResponsesUsage
(src *dto.Usage)
relaykit/relayconvert/internal/oai_responses/to_oai_chat_resp.go:183
↓ 4 callers
Function
UsesFixedPricingByHash
UsesFixedPricingByHash avoids hashing an expression already in a snapshot.
pkg/billingexpr/fixed.go:17
↓ 4 callers
Function
ValidateAccountEmail
ValidateAccountEmail is shared with registration mail delivery so binding cannot bypass the site's existing domain, alias and address-length rules.
service/email_binding.go:36
↓ 4 callers
Function
ValidateMetadataValues
(values MetadataValues)
model/model_metadata_sync.go:99
↓ 4 callers
Function
ValidateNumericCode
ValidateNumericCode 验证数字验证码格式
common/totp.go:129
↓ 4 callers
Function
VendorRecordVersion
(v *Vendor)
model/vendor_management.go:73
↓ 4 callers
Function
VerifyTaskArtifactAccess
VerifyTaskArtifactAccess verifies the route binding without reading task, user, or token state. Signature comparison is constant-time.
service/task_artifact_access.go:48
↓ 4 callers
Function
WaffoPancakeBuyerIdentityFromUserID
WaffoPancakeBuyerIdentityFromUserID renders the canonical buyer identity for checkout. Webhook handlers compare against the value rendered here to rej
service/waffo_pancake.go:161
↓ 4 callers
Method
WriteContext
(c *gin.Context)
model/user_cache.go:41
↓ 4 callers
Function
abortTaskPluginRouteErrorDetail
(c *gin.Context, status int, detail string)
middleware/task_plugin.go:1706
↓ 4 callers
Function
abortWithWebMessage
abortWithWebMessage answers a web console request; the web console translates the message, and code, when set, stays a stable error code.
middleware/auth.go:376
↓ 4 callers
Function
activeRules
(config)
plugins/tasks/request-redact/plugin.js:330
↓ 4 callers
Method
admit
admit reserves size bytes for a request, or drops it when the queue is full.
relay/requestplugin/report.go:467
↓ 4 callers
Function
appendRequestPluginRecord
appendRequestPluginRecord shows users what the request plugins changed in their request. A retry rewrites the attempt's entries in place, so the log k
service/log_info_generate.go:163
↓ 4 callers
Function
appendSeparatedText
(builder *strings.Builder, text string)
relaykit/relayconvert/internal/oai_responses/to_oai_chat_resp.go:314
↓ 4 callers
Function
applyAuthBundle
( bundle: AuthBundle, synchronizeTabs = true )
web/src/lib/auth-session.ts:150
↓ 4 callers
Function
applyAuthFlowMatch
(query *gorm.DB, token string, match AuthFlowMatch)
model/auth_flow.go:127
↓ 4 callers
Method
applyCompletionUsageFacts
(result *relaycommon.TaskInfo, facts any, models ...string)
relay/channel/task/jsplugin/adaptor.go:1178
↓ 4 callers
Function
applyEffects
applyEffects applies a result's effects to body and headers through the host's own decoder, so every effect also passes the host's checks.
plugins/request_plugins_test.go:53
↓ 4 callers
Function
applyOriginTaskIntent
(c *gin.Context, intent map[string]any, meta pluginruntime.Meta)
middleware/task_plugin.go:1335
↓ 4 callers
Function
applyRechargeRate
* Apply recharge rate to price * * priceRate represents how much users need to recharge (in the display currency) * to get 1 USD credit. usdExchang
web/src/features/pricing/lib/price.ts:131
↓ 4 callers
Function
applyTaskCredential
applyTaskCredential puts a credential's headers and query on a task request.
relay/channel/task/jsplugin/credential.go:103
↓ 4 callers
Method
applyUpstreamCredentials
applyUpstreamCredentials sets ctx.upstream together with the credentials every driver hook reads. A New API channel (type 60) is another gateway: the
relay/channel/task/jsplugin/adaptor.go:1545
↓ 4 callers
Function
applyWebSocketSubprotocolAuthorization
(header http.Header)
middleware/auth.go:649
↓ 4 callers
Function
arrayIndex
arrayIndex reads an RFC 6901 array index: digits without a leading zero.
pkg/requestpatch/patch.go:573
↓ 4 callers
Function
artifactData
(ctx)
plugins/tasks/alibaba/plugin.js:1289
↓ 4 callers
Function
artifactData
(ctx)
plugins/tasks/doubao/plugin.js:984
← previous
next →
1,701–1,800 of 15,409, ranked by callers