Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/QuantumNous/new-api
/ functions
Functions
15,592 in github.com/QuantumNous/new-api
⨍
Functions
15,592
◇
Types & classes
2,267
↓ 4 callers
Method
ImageCount
ImageCount resolves the validated request quantity. Top-level zero retains its legacy default of one; an explicit provider count must be positive.
relaykit/dto/openai_image.go:60
↓ 4 callers
Function
ImageHelper
(c *gin.Context, info *relaycommon.RelayInfo)
relay/image_handler.go:32
↓ 4 callers
Method
IncrSendResponseCount
()
relaykit/relayconvert/convmeta/meta.go:57
↓ 4 callers
Function
IncrementDiskFiles
IncrementDiskFiles 增加磁盘文件计数
common/disk_cache_config.go:109
↓ 4 callers
Method
Init
(info *relaycommon.RelayInfo)
relay/channel/aws/adaptor.go:83
↓ 4 callers
Function
InitTask
(platform constant.TaskPlatform, relayInfo *commonRelay.RelayInfo)
model/task.go:272
↓ 4 callers
Function
InjectTieredBillingInfo
InjectTieredBillingInfo overlays tiered billing fields onto an existing module-specific other map. Call this after GenerateTextOtherInfo / GenerateCla
service/log_info_generate.go:350
↓ 4 callers
Method
Insert
()
model/model_meta.go:236
↓ 4 callers
Method
Insert
(inviterId int)
model/user.go:675
↓ 4 callers
Method
Insert
()
model/token.go:307
↓ 4 callers
Function
InvalidateSubscriptionPlanCache
InvalidateSubscriptionPlanCache drops a plan written on this node from the cache and tells the other nodes to drop their copies.
model/subscription.go:137
↓ 4 callers
Function
IsAlwaysSkipRetryStatusCode
(code int)
setting/operation_setting/status_code_ranges.go:70
↓ 4 callers
Method
IsCustomTool
IsCustomTool reports whether name was encoded from a Responses custom tool.
relaykit/relayconvert/convmeta/meta.go:126
↓ 4 callers
Function
IsDiskCacheEnabled
IsDiskCacheEnabled 是否启用磁盘缓存
common/disk_cache_config.go:44
↓ 4 callers
Method
IsEnabled
IsEnabled returns whether this OAuth provider is enabled
oauth/provider.go:16
↓ 4 callers
Function
IsQwenThinkingBudgetModel
(modelName string)
relaykit/dto/openai_request.go:398
↓ 4 callers
Function
IsRequestBodyTooLargeError
(err error)
common/gin.go:29
↓ 4 callers
Method
IsStream
(c *http.Request)
relaykit/dto/request_common.go:10
↓ 4 callers
Method
IsToolCall
()
relaykit/dto/openai_response.go:164
↓ 4 callers
Function
LegacyAccessTokenRetireAt
()
model/user_access_token.go:322
↓ 4 callers
Function
ListSystemInstances
()
model/system_instance.go:72
↓ 4 callers
Function
LocalLogPreview
LocalLogPreview limits log-only content unless debug logging is enabled.
common/str.go:20
↓ 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 /v1/models relay route, with the converter as the manifest declares it.
pluginkit/meta.go:353
↓ 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:302
↓ 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
NormalizeRouteMethod
NormalizeRouteMethod returns the canonical spelling of a plugin route method, rejecting methods routes may not use.
pluginkit/routing.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
Method
PluginsByModel
PluginsByModel returns all plugins declaring model, in ascending key order.
pkg/jsplugin/routing.go:162
↓ 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
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
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
pluginkit/meta.go:316
↓ 4 callers
Method
ReplaceOtherRatios
(ratios map[string]float64)
types/price_data.go:54
↓ 4 callers
Function
ResetUserPasswordByEmail
(email string, password string)
model/user.go:1204
↓ 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:1628
↓ 4 callers
Function
ResponseGeminiChat2OpenAI
(id string, created int64, response *dto.GeminiChatResponse)
relaykit/relayconvert/internal/gemini_chat/to_oai_chat_resp.go:81
↓ 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:262
↓ 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:304
↓ 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
SetDashboardRouter
(router *gin.Engine)
router/dashboard.go:10
↓ 4 callers
Method
SetIndex
set index
relaykit/dto/claude.go:632
↓ 4 callers
Method
SetMediaContent
(content []MediaContent)
relaykit/dto/openai_request.go:732
↓ 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
SettleBilling
--------------------------------------------------------------------------- SettleBilling — 后结算辅助函数 --------------------------------------------------
service/billing.go:65
↓ 4 callers
Method
SetupRequestHeader
(c *gin.Context, header *http.Header, info *relaycommon.RelayInfo)
relay/channel/advancedcustom/adaptor.go:267
↓ 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
Function
ShouldDisableChannel
(err *types.NewAPIError)
service/channel.go:65
↓ 4 callers
Method
ShouldPreserveThinkingSuffix
(modelName string)
relaykit/relayconvert/convmeta/options.go:119
↓ 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
Function
StreamResponseGeminiChat2OpenAI
(geminiResponse *dto.GeminiChatResponse)
relaykit/relayconvert/internal/gemini_chat/to_oai_chat_resp.go:193
↓ 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:678
↓ 4 callers
Function
TokenAuthReadOnly
TokenAuthReadOnly 宽松版本的令牌认证中间件,用于只读查询接口。 只验证令牌 key 是否存在,不检查过期时间和额度。 即使令牌已过期或已耗尽,也允许访问;已禁用的令牌会被拒绝。 仍然检查令牌 IP 白名单和用户是否被封禁。
middleware/auth.go:459
↓ 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:589
↓ 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:1460
↓ 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
← previous
next →
1,701–1,800 of 15,592, ranked by callers