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
↓ 2 callers
Function
NewConfigManager
()
setting/config/config.go:21
↓ 2 callers
Function
NewDiskCachedData
(diskPath string, mimeType string, size int64)
relaykit/types/file_source.go:171
↓ 2 callers
Function
NewEnterpriseClient
NewEnterpriseClient creates a new IO.NET API client targeting the enterprise API base URL.
pkg/ionet/client.go:74
↓ 2 callers
Function
NewJSONState
(limit int)
pluginkit/json_state.go:252
↓ 2 callers
Function
NewMemoryCachedData
(base64Data string, mimeType string, size int64)
relaykit/types/file_source.go:162
↓ 2 callers
Function
NewMessage
(msgType MsgType, flag MsgTypeFlagBits)
relay/channel/volcengine/protocols.go:245
↓ 2 callers
Function
NewRealtime
NewRealtime starts the request plugins of a Realtime session on its channel. toClient and toTarget write one event to the client and to the upstream.
relay/requestplugin/socket.go:228
↓ 2 callers
Function
NewReplayableBodyReader
NewReplayableBodyReader returns a request body over storage with its own cursor. Closing the body, as net/http does, never closes the storage.
common/body_storage.go:438
↓ 2 callers
Function
NormalizeAccessTokenScopeList
NormalizeAccessTokenScopeList trims, de-duplicates and sorts scope keys. It only checks the shape; grantability is checked against the scope catalog.
service/security_verification.go:134
↓ 2 callers
Function
NormalizeAccessTokenScopes
NormalizeAccessTokenScopes validates a requested grant against the catalog the user sees and returns it trimmed, de-duplicated and sorted.
service/access_token_scope.go:174
↓ 2 callers
Function
NormalizeBackupCode
NormalizeBackupCode 标准化备用码格式
common/totp.go:101
↓ 2 callers
Function
NormalizeBillingPreference
NormalizeBillingPreference clamps the billing preference to valid values.
common/str.go:109
↓ 2 callers
Function
NormalizeCacheCreationSplit
(totalTokens int, tokens5m int, tokens1h int)
relaykit/relayconvert/response_compat.go:34
↓ 2 callers
Function
NormalizeChannelGroupFilter
(group string)
model/channel.go:147
↓ 2 callers
Function
NormalizeChannelTestConcurrency
(concurrency int)
setting/operation_setting/monitor_setting.go:65
↓ 2 callers
Function
NormalizePasskeyRPID
(value string, configuredOrigins ...string)
setting/system_setting/passkey.go:57
↓ 2 callers
Function
NormalizeRoutePath
NormalizeRoutePath validates the canonical path syntax used by plugin route declarations. A trailing slash is allowed and remains significant.
pluginkit/routing.go:357
↓ 2 callers
Method
NormalizeRouteToggles
NormalizeRouteToggles keeps the plugin_routes entries that name a relay route other than a management route and differ from its default; it returns ni
pluginkit/meta.go:239
↓ 2 callers
Function
ObjectValue
(value any, fallbackKey string)
relaykit/relayconvert/internal/oai_responses/req_helpers.go:195
↓ 2 callers
Function
OpenAIFinishReasonToClaudeStopReason
(finishReason string)
relaykit/reasonmap/reasonmap.go:31
↓ 2 callers
Function
PROFILE_BY_NAME
(name: string)
web/src/features/pricing/lib/mock-stats.ts:229
↓ 2 callers
Function
PanicRecover
PanicRecover is the server-wide panic recovery. Gin logs the panic stack through common.ErrorLogWriter so it reaches the current log file.
middleware/recover.go:33
↓ 2 callers
Function
ParseClaudeModelSuffix
ParseClaudeModelSuffix folds the naked claude-* aliases (-thinking, -nothinking, -thinking-<budget>, and effort tails such as -high) into an Intent. a
relaykit/relayconvert/reasoning/suffix.go:143
↓ 2 callers
Function
ParseExprVersion
ParseExprVersion extracts the version tag and body from an expression string. Format: "v1:tier(...)" → version=1, body="tier(...)". No prefix defaults
pkg/billingexpr/compile.go:29
↓ 2 callers
Function
ParseFileReference
ParseFileReference resolves a ref produced by FileReference back to the multipart field and the zero-based file index within that field.
pluginkit/routing.go:225
↓ 2 callers
Function
ParseLegacyModelSuffix
ParseLegacyModelSuffix parses the old naked aliases only for positively matched GPT/o-series, Claude, and Gemini model families. The provider prefix b
setting/reasoning/suffix.go:35
↓ 2 callers
Method
ParseMediaContent
()
relaykit/dto/claude.go:110
↓ 2 callers
Function
ParseOAuthKey
(raw string)
relay/channel/codex/oauth_key.go:21
↓ 2 callers
Function
ParsePasskeyRPIDs
(value string, configuredOrigins ...string)
setting/system_setting/passkey.go:99
↓ 2 callers
Function
ParseProxyURLStrict
ParseProxyURLStrict validates and normalizes a proxy URL for persistence.
common/proxy_url.go:12
↓ 2 callers
Function
ParseTaskPluginDisabledFactoryKeys
(raw string)
setting/task_plugin.go:86
↓ 2 callers
Function
ParseThinkingModifier
ParseThinkingModifier maps an explicit @thinking value onto a portable Intent. on/adaptive/off and integer budgets (including -1) are accepted; values
relaykit/relayconvert/reasoning/suffix.go:87
↓ 2 callers
Function
PaymentReturnURL
(suffix string)
service/return_path.go:9
↓ 2 callers
Function
PermissionsForRole
PermissionsForRole returns the permissions whose DefaultRoles include roleKey.
service/authz/registry.go:56
↓ 2 callers
Method
Persist
(ctx context.Context, task *model.Task, artifact types.TaskArtifact, content io.Reader)
service/task_artifact_store.go:29
↓ 2 callers
Function
PluginBalanceUSD
PluginBalanceUSD is a balance result in USD for the balance column: USD as it is, CNY at the exchange-rate setting. ok is false for another currency,
service/provider_plugin_balance.go:17
↓ 2 callers
Function
PluginBillingExprKey
(pluginKey, model string)
setting/billing_setting/tiered_billing.go:86
↓ 2 callers
Function
PluginFetcher
PluginFetcher returns the utils.fetch of a plugin's hooks on a channel: the base URL host and the plugin's allowedHosts only, through the channel prox
service/provider_plugin.go:61
↓ 2 callers
Function
PluginModelListKey
PluginModelListKey returns the key line the model list request of a channel uses: its first enabled key that is a static key or a credential of the pl
service/provider_plugin.go:598
↓ 2 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
pluginkit/routing.go:558
↓ 2 callers
Method
PluginValue
PluginValue returns the state as a hook argument: nil when it is absent or null, otherwise its JSON text for the hook to receive parsed.
relay/plugin_protocol.go:107
↓ 2 callers
Function
PostWssConsumeQuota
(ctx *gin.Context, relayInfo *relaycommon.RelayInfo, modelName string, usage *dto.RealtimeUsage, extraContent
service/quota.go:159
↓ 2 callers
Method
PreConsume
PreConsume 从该资金来源预扣 amount 额度
service/funding_source.go:19
↓ 2 callers
Function
PreConsumeTokenQuota
(relayInfo *relaycommon.RelayInfo, quota int)
service/quota.go:408
↓ 2 callers
Function
PrepareRequestBilling
PrepareRequestBilling estimates and reserves one request's charge. Transports provide the current request body through BodyStorage or BillingRequestIn
relay/request_billing.go:21
↓ 2 callers
Method
PresentationLoss
PresentationLoss builds a warning-severity diagnostic for this definition.
relaykit/relayconvert/convmeta/websearch.go:93
↓ 2 callers
Function
PreviewVendorOperation
(operation VendorOperation)
model/vendor_management.go:197
↓ 2 callers
Function
ProcessStreamResponse
(streamResponse dto.ChatCompletionsStreamResponse, responseTextBuilder *strings.Builder, toolCount *int)
relay/channel/openai/helper.go:123
↓ 2 callers
Method
Purge
()
pkg/cachex/hybrid_cache.go:159
↓ 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
RedactCredentialLines
RedactCredentialLines replaces every credential line of a channel key with its summary, so the key can be shown to an administrator.
pluginkit/provider.go:139
↓ 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:987
↓ 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
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
ReplayFixture
ReplayFixture compiles a plugin and runs every fixture case in declaration order. unixNow is fixed by the fixture to keep signing and timestamp hooks
pluginkit/fixture.go:37
↓ 2 callers
Function
ReplayFixtureWith
ReplayFixtureWith is ReplayFixture with the host's own admission: compile loads the plugin, for example CompilePlugin followed by the host's route che
pluginkit/fixture.go:44
↓ 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:529
↓ 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
Method
ResponseBodyLimit
ResponseBodyLimit is the number of response bytes this fetch can accept.
pluginkit/fetch.go:38
↓ 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
← previous
next →
3,401–3,500 of 15,592, ranked by callers