Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/QuantumNous/new-api
/ functions
Functions
10,942 in github.com/QuantumNous/new-api
⨍
Functions
10,942
◇
Types & classes
1,624
↓ 25 callers
Method
RoutingErrors
()
pkg/jsplugin/registry.go:628
↓ 25 callers
Function
TryTieredSettle
TryTieredSettle checks if the request uses tiered_expr billing and, if so, computes the actual quota using the captured BillingSnapshot. Returns: - ok
service/tiered_settle.go:163
↓ 25 callers
Function
UsingMainDatabase
(databaseType DatabaseType)
common/database.go:36
↓ 25 callers
Function
WithOpenAIError
(openAIError OpenAIError, statusCode int, ops ...NewAPIErrorOptions)
relaykit/types/error.go:317
↓ 24 callers
Method
Call
Call invokes one named module export and returns its JSON-compatible value.
pkg/jsplugin/engine.go:301
↓ 24 callers
Function
DecodeJson
(reader io.Reader, v any)
common/json.go:17
↓ 24 callers
Method
GetBaseURL
()
model/channel.go:521
↓ 24 callers
Function
IOCopyBytesGracefully
(c *gin.Context, src *http.Response, data []byte)
service/http.go:44
↓ 24 callers
Function
New
(plugin *pluginruntime.LoadedPlugin)
relay/channel/task/jsplugin/adaptor.go:85
↓ 24 callers
Method
StringContent
()
relaykit/dto/openai_request.go:499
↓ 24 callers
Method
addEventListener
( type: string, listener: (event: Event & { data?: string; readyState?: number }) => void )
web/src/features/playground/hooks/use-stream-request.test.ts:41
↓ 24 callers
Function
formatQuota
(quota: number)
web/src/lib/format.ts:73
↓ 24 callers
Function
setupTaskPluginControllerTest
(t *testing.T)
controller/task_plugin_test.go:24
↓ 23 callers
Method
GetPageSize
()
common/page_info.go:25
↓ 23 callers
Method
makeRequest
makeRequest performs an HTTP request and handles common response processing
pkg/ionet/client.go:99
↓ 23 callers
Function
pluginProtocolTestDeps
()
controller/plugin_protocol_test.go:1485
↓ 23 callers
Function
useStatus
()
web/src/hooks/use-status.ts:40
↓ 22 callers
Function
CompilePlugin
CompilePlugin validates a plugin without publishing it. Callers that refresh multiple plugins use this together with ReplaceOverrides so readers obser
pkg/jsplugin/registry.go:243
↓ 22 callers
Function
GetResponseID
(c *gin.Context)
relay/helper/common.go:174
↓ 22 callers
Function
GetUserCache
GetUserCache gets complete user cache from hash
model/user_cache.go:88
↓ 22 callers
Function
NewErrorWithStatusCode
(err error, errorCode ErrorCode, statusCode int, ops ...NewAPIErrorOptions)
relaykit/types/error.go:299
↓ 22 callers
Function
ResponseText2Usage
func GetPromptTokens(textRequest dto.GeneralOpenAIRequest, relayMode int) (int, error) { switch relayMode { case constant.RelayModeChatCompletions:
service/usage_helpr.go:22
↓ 22 callers
Function
compileRouterPlugin
(t *testing.T, key, version, routes string)
router/plugin_router_test.go:842
↓ 22 callers
Function
copyToClipboard
(text: string)
web/src/lib/copy-to-clipboard.ts:82
↓ 22 callers
Function
formatTimestampToDate
( timestamp?: number, unit: 'seconds' | 'milliseconds' = 'seconds' )
web/src/lib/format.ts:167
↓ 22 callers
Function
seedChannel
(t *testing.T, id int)
service/task_billing_test.go:119
↓ 21 callers
Method
AddOtherRatio
(key string, ratio float64)
types/price_data.go:35
↓ 21 callers
Method
Decode
(s string)
pkg/cachex/codec.go:12
↓ 21 callers
Function
GetEnvOrDefault
(env string, defaultValue int)
common/env.go:9
↓ 21 callers
Method
GetStartIdx
()
common/page_info.go:17
↓ 21 callers
Function
SetContextKey
(c *gin.Context, key constant.ContextKey, value any)
common/gin.go:157
↓ 21 callers
Method
Validate
()
relaykit/dto/channel_settings.go:371
↓ 21 callers
Method
Value
()
model/task.go:98
↓ 21 callers
Function
performPluginRequest
(handler http.Handler, method, path string)
router/plugin_router_test.go:879
↓ 21 callers
Function
seedToken
(t *testing.T, id int, userId int, key string, remainQuota int)
service/task_billing_test.go:91
↓ 21 callers
Function
serveTaskPluginProtocol
( c *gin.Context, pinned pluginruntime.PinnedEndpoint, deps pluginProtocolBridgeDeps, )
controller/plugin_protocol.go:140
↓ 21 callers
Function
testPluginRouteHandlers
( handler func(*gin.Context, *jsplugin.RoutingGeneration, jsplugin.RouteBinding), )
router/plugin_router_test.go:823
↓ 20 callers
Method
Encode
(v V)
pkg/cachex/codec.go:11
↓ 20 callers
Method
Error
Error lets the same typed value serve both as the settlement audit marker and as the fail-fast error returned by strict pre-consume conversions.
common/quota_math.go:52
↓ 20 callers
Method
RegisterFactory
(source string, options Options)
pkg/jsplugin/registry.go:205
↓ 20 callers
Function
SaveTaskPlugin
(plugin *TaskPlugin)
model/task_plugin.go:50
↓ 20 callers
Function
calculateTextQuotaSummary
calculateTextQuotaSummary expects a usage already remapped by effectiveBillingUsage; PostTextConsumeQuota performs that remap once and shares the resu
service/text_quota.go:231
↓ 20 callers
Function
compilePluginProtocolTestEndpoint
(t *testing.T, key, source string)
controller/plugin_protocol_test.go:1420
↓ 20 callers
Function
compileTaskRoutePlugin
(t *testing.T, source string)
middleware/task_plugin_test.go:1587
↓ 20 callers
Function
getTokenRemainQuota
(t *testing.T, id int)
service/task_billing_test.go:475
↓ 20 callers
Function
recordManageAudit
recordManageAudit 记录一条由操作者本人归属的管理/高危审计日志(资源类操作: 渠道 / 系统设置 / 兑换码等)。content 由 action+params 自动渲染。
controller/audit.go:93
↓ 20 callers
Function
useUserCacheMiniRedis
(t *testing.T)
model/user_cache_auth_version_test.go:17
↓ 19 callers
Function
CreateSystemTask
(taskType string, payload any, state any)
model/system_task.go:92
↓ 19 callers
Function
PrepareTaskPluginRoute
PrepareTaskPluginRoute resolves and executes the pinned declarative route. Query requests terminate here so channel distribution and billing are never
middleware/task_plugin.go:50
↓ 19 callers
Function
getLastLog
(t *testing.T)
service/task_billing_test.go:510
↓ 19 callers
Function
newPluginProtocolTestContext
(stream, requestBodyStream bool)
controller/plugin_protocol_test.go:1456
↓ 19 callers
Function
render
()
web/src/components/turnstile.tsx:45
↓ 18 callers
Method
Close
()
relaykit/types/file_source.go:209
↓ 18 callers
Method
Commit
Commit writes the capped completed-output count into RelayInfo once. Request tool declarations alone must not become billable calls.
relay/common/tool_usage.go:147
↓ 18 callers
Function
GetPageQuery
(c *gin.Context)
common/page_info.go:41
↓ 18 callers
Method
SetItems
(items any)
common/page_info.go:37
↓ 18 callers
Method
SetTotal
(total int)
common/page_info.go:33
↓ 18 callers
Function
UnmarshalBodyReusable
(c *gin.Context, v any)
common/gin.go:108
↓ 18 callers
Function
getCurrencyDisplay
()
web/src/lib/currency.ts:365
↓ 18 callers
Function
routingTestPluginSource
(key string, channelType int, models, metaFields, exports string)
pkg/jsplugin/routing_test.go:1015
↓ 18 callers
Function
safeJsonParseWithValidation
( value: string | undefined | null, options: SafeJsonParseWithValidationOptions<T> )
web/src/features/system-settings/utils/json-parser.ts:141
↓ 18 callers
Function
useChannels
()
web/src/features/channels/components/channels-provider.tsx:145
↓ 17 callers
Method
GetOtherSettings
()
model/channel.go:1032
↓ 17 callers
Method
ParseToolCalls
()
relaykit/dto/openai_request.go:483
↓ 17 callers
Function
mustCompileRoutingPlugin
(t *testing.T, key string, channelType int, models, metaFields, exports string)
pkg/jsplugin/routing_test.go:1008
↓ 17 callers
Function
pinTaskPluginRoute
(plugin *jsplugin.LoadedPlugin, routeIndex int)
middleware/task_plugin_test.go:1675
↓ 17 callers
Function
setupModelListControllerTestDB
(t *testing.T)
controller/model_list_test.go:37
↓ 17 callers
Function
setupUserSessionTest
(t *testing.T)
model/user_session_test.go:43
↓ 16 callers
Method
DoRequest
(c *gin.Context, info *relaycommon.RelayInfo, requestBody io.Reader)
relay/channel/adapter.go:28
↓ 16 callers
Function
GetChannelConstraints
(c *gin.Context)
service/channel_select.go:15
↓ 16 callers
Function
GetQuotaDisplayType
GetQuotaDisplayType 返回额度展示类型
setting/operation_setting/general_setting.go:55
↓ 16 callers
Method
InitChannelMeta
(c *gin.Context)
relay/common/relay_info.go:188
↓ 16 callers
Method
ParseContent
()
relaykit/dto/claude.go:168
↓ 16 callers
Function
PinTaskPluginEndpoint
PinTaskPluginEndpoint decides shared-endpoint ownership without executing plugin code. Invalid or unidentifiable ordinary requests deliberately fall t
middleware/task_plugin.go:318
↓ 16 callers
Function
PrepareTaskPluginEndpoint
PrepareTaskPluginEndpoint normalizes a claimed shared request through the deterministic parser pinned before distribution. A shared-model request can
middleware/task_plugin.go:506
↓ 16 callers
Function
RelayErrorHandler
(ctx context.Context, resp *http.Response, showBodyWhenFail bool)
service/error.go:87
↓ 16 callers
Method
Remove
(item T)
types/set.go:17
↓ 16 callers
Function
countLogs
(t *testing.T)
service/task_billing_test.go:520
↓ 16 callers
Function
newPluginRouterTest
( t *testing.T, plugins []*jsplugin.LoadedPlugin, handlers pluginRouteHandlers, )
router/plugin_router_test.go:780
↓ 16 callers
Function
normalizeAdvancedCustomConfig
( config: AdvancedCustomConfig )
web/src/features/channels/lib/advanced-custom.ts:552
↓ 16 callers
Function
pluginProtocolTestOutcome
( info *relaycommon.RelayInfo, pluginKey string, taskID string, _ ...any, )
controller/plugin_protocol_test.go:1498
↓ 16 callers
Function
setupStreamTest
(t *testing.T, body io.Reader)
relay/helper/stream_scanner_test.go:31
↓ 16 callers
Function
sideDrawerContentClassName
(className?: string)
web/src/components/drawer-layout.ts:24
↓ 16 callers
Function
useCopyToClipboard
(options?: UseCopyToClipboardOptions)
web/src/hooks/use-copy-to-clipboard.ts:36
↓ 15 callers
Function
CacheGetChannel
(id int)
model/channel_cache.go:219
↓ 15 callers
Method
Close
()
common/body_storage.go:214
↓ 15 callers
Function
ConvertRequest
(c context.Context, info convmeta.Meta, target types.RelayFormat, request any)
relaykit/relayconvert/request_registry.go:151
↓ 15 callers
Method
DoResponse
(c *gin.Context, resp *http.Response, info *relaycommon.RelayInfo)
relay/channel/adapter.go:29
↓ 15 callers
Function
FinishSystemTask
(taskID string, lockedBy string, status SystemTaskStatus, resultPayload any, errorMessage string)
model/system_task.go:383
↓ 15 callers
Function
GetPointer
(v T)
relaykit/relayconvert/kitutil/value.go:12
↓ 15 callers
Function
GetSessionAuthIdentity
GetSessionAuthIdentity returns only identities backed by a live dashboard session. PAT-authenticated requests intentionally fail this check.
middleware/auth.go:125
↓ 15 callers
Function
MainDatabaseType
()
common/database.go:15
↓ 15 callers
Function
NewPluginResponsesMachine
(taskID, model string, createdAt int64, limits PluginProtocolLimits)
relay/plugin_protocol.go:378
↓ 15 callers
Function
NormalizeEmail
(email string)
model/user.go:304
↓ 15 callers
Method
OtherRatios
()
types/price_data.go:58
↓ 15 callers
Function
RunExprWithRequest
(exprStr string, params TokenParams, request RequestInput)
pkg/billingexpr/run.go:28
↓ 15 callers
Method
Seek
(offset int64, whence int)
common/body_storage.go:205
↓ 15 callers
Function
SetEventStreamHeaders
(c *gin.Context)
relay/helper/common.go:45
↓ 15 callers
Method
String
()
service/http_transport_policy.go:89
↓ 15 callers
Method
Update
(updatePassword bool)
model/user.go:749
← previous
next →
101–200 of 10,942, ranked by callers