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
↓ 9 callers
Method
JSONString
JSONString returns the complete stored representation, including all privileged scopes. API projections must use the role-specific formatter.
model/log_other.go:187
↓ 9 callers
Method
JSValue
JSValue shares the request with hooks without copying it: the engine never writes JavaScript changes back into Go values, so the request must only sta
pkg/jsplugin/routing.go:350
↓ 9 callers
Function
NotifyAccountSecurityChange
NotifyAccountSecurityChange never includes credentials or tokens. The caller records delivery failure independently from the already-committed change.
service/account_security.go:47
↓ 9 callers
Function
PassThrough
PassThrough runs the attempt stages of a channel attempt whose upstream body no effect can change: the stored client body of a pass-through channel, o
relay/requestplugin/relay.go:400
↓ 9 callers
Function
PluginOfChannel
PluginOfChannel returns the plugin a task plugin channel is bound to. Its credential hooks serve the channel whatever parts the plugin has.
service/provider_plugin.go:50
↓ 9 callers
Method
Plugins
()
pkg/jsplugin/routing.go:612
↓ 9 callers
Function
RecalculateTaskQuota
RecalculateTaskQuota 通用的异步差额结算。 actualQuota 是任务完成后的实际应扣额度,与预扣额度 (task.Quota) 做差额结算。 reason 写入日志内容(例如按 token 重算或 adaptor 调整)。 clamps 可选:若计算 actualQuota
service/task_billing.go:314
↓ 9 callers
Function
RecordConsumeLog
(c *gin.Context, userId int, params RecordConsumeLogParams)
model/log.go:340
↓ 9 callers
Method
RecordError
(msg string)
relay/common/stream_status.go:87
↓ 9 callers
Function
RecordLog
(userId int, logType int, content *common.Message)
model/log.go:149
↓ 9 callers
Method
Request
Request parameter duration's unit is seconds
common/rate-limit.go:152
↓ 9 callers
Function
RevokeUserSession
(userID int, sid, reason string)
model/user_session.go:566
↓ 9 callers
Function
RouteTag
(tag string)
middleware/logger.go:14
↓ 9 callers
Method
SetRequestPluginIngress
SetRequestPluginIngress keeps what the request's ingress stage did, which every channel attempt starts from.
relay/common/request_plugin.go:235
↓ 9 callers
Function
ShouldPreserveThinkingSuffix
ShouldPreserveThinkingSuffix reports whether the full model name is exempt from host thinking-suffix and @-modifier parsing. Exact blacklist entries m
setting/model_setting/global.go:145
↓ 9 callers
Function
TaskErrorWrapper
TaskErrorWrapper masks the upstream addresses of the task channel in network errors; see common.MaskSensitiveInfo.
service/error.go:202
↓ 9 callers
Function
UpdateVideoTasks
UpdateVideoTasks 按渠道更新所有视频任务
service/task_polling.go:461
↓ 9 callers
Function
UserUsableGroups2JSONString
()
setting/user_usable_group.go:28
↓ 9 callers
Function
ValidateSSRFProtectedFetchURL
(urlStr string)
service/http_client.go:71
↓ 9 callers
Method
Write
(b []byte)
middleware/audit.go:25
↓ 9 callers
Function
authSigningKey
(purpose string)
service/auth_token.go:54
↓ 9 callers
Function
calculateTextToolCallSurcharge
(ctx *gin.Context, relayInfo *relaycommon.RelayInfo, summary *textQuotaSummary)
service/text_quota.go:152
↓ 9 callers
Function
callbackParams
(values url.Values)
service/provider_plugin_login_test.go:42
↓ 9 callers
Function
channelMatchesExpectedTaskPlugin
(c *gin.Context, channel *model.Channel, expected string)
middleware/distributor.go:164
↓ 9 callers
Function
compilePluginProtocolRetrieveEndpoint
(t *testing.T, key, source string, options pluginruntime.Options)
controller/plugin_protocol_test.go:1561
↓ 9 callers
Function
createScopedAccessToken
(t *testing.T, userID int, expiresAt int64, scopes ...string)
controller/access_token_audit_test.go:112
↓ 9 callers
Function
credentialLine
(t *testing.T, credential jsplugin.Credential)
service/provider_plugin_test.go:292
↓ 9 callers
Function
decodeLocalizedText
decodeLocalizedText reads a string or locale object as LocalizedText; subject names it in errors.
pkg/jsplugin/registry.go:2531
↓ 9 callers
Function
defaultHTTPTransportPolicy
()
service/http_transport_policy.go:24
↓ 9 callers
Function
effectiveBillingUsage
(usage *dto.Usage)
service/billing_usage.go:19
↓ 9 callers
Function
flattenBinary
( node: ExpressionNode, operator: string )
web/src/features/pricing/lib/billing-expression/display.ts:49
↓ 9 callers
Function
formatLogQuota
(quota: number)
web/src/lib/format.ts:253
↓ 9 callers
Function
formatPricingNumber
(value: unknown)
web/src/features/system-settings/models/pricing-format.ts:55
↓ 9 callers
Function
getUserAuthFenceKey
Fence and version keys use the user cache key as their hash tag so the cache fill script and the floor MGET stay in one slot on sharded Redis.
model/user_auth_cache.go:29
↓ 9 callers
Function
intPtr
(v int)
relaykit/relayconvert/internal/oai_chat/to_oai_responses_resp.go:314
↓ 9 callers
Function
integerValue
(value any)
pkg/jsplugin/provider.go:1750
↓ 9 callers
Function
newAuthzTestDB
(t *testing.T)
service/authz/authz_test.go:14
↓ 9 callers
Function
newDoubaoPlugin
(t *testing.T)
plugins/doubao_responses_test.go:59
↓ 9 callers
Function
newPluginProtocolRetrieveContext
(responseID string)
controller/plugin_protocol_test.go:1577
↓ 9 callers
Function
newTestResponsesStreamState
()
relaykit/relayconvert/internal/oai_responses/to_oai_chat_resp_test.go:578
↓ 9 callers
Function
performRateLimitRequest
(router http.Handler, path string, remoteAddr string)
middleware/rate_limit_test.go:43
↓ 9 callers
Function
plainObject
(value)
plugins/tasks/kling/plugin.js:285
↓ 9 callers
Function
pluginProtocolRetrieveDeps
(pinned pluginruntime.PinnedEndpoint, task *model.Task, exists bool, err error)
controller/plugin_protocol_test.go:1587
↓ 9 callers
Function
processHeaderOverride
processHeaderOverride applies channel header overrides, with placeholder substitution. Supported placeholders: - {api_key}: resolved to the channel AP
relay/channel/api_request.go:197
↓ 9 callers
Function
rawJSON
(value any)
relaykit/relayconvert/internal/toolconv/decode.go:923
↓ 9 callers
Function
receive
(t *testing.T, received chan serviceRequest)
relay/requestplugin/requestplugin_test.go:711
↓ 9 callers
Method
reset
()
router/provider_plugin_relay_test.go:94
↓ 9 callers
Function
routingProtocolExport
(name string)
pkg/jsplugin/routing_test.go:1232
↓ 9 callers
Function
run
( raceAttempt: number, allowMismatchRetry: boolean )
web/src/lib/auth-session.ts:218
↓ 9 callers
Function
runScheduledPlugin
runScheduledPlugin calls the hook without channel locks. Its result is applied only while the prepared key still matches the stored key.
service/provider_plugin_scheduled.go:260
↓ 9 callers
Function
safeJsonParse
( value: string | undefined | null, options: SafeJsonParseOptions<T> = {} )
web/src/features/system-settings/utils/json-parser.ts:113
↓ 9 callers
Function
setupOriginTaskDB
(t *testing.T)
middleware/task_plugin_origin_task_test.go:26
↓ 9 callers
Function
setupSub2APIBalanceTest
setupSub2APIBalanceTest wires an in-memory SQLite DB into model.DB so Channel.UpdateBalance can persist, mirroring the pattern used by other controlle
controller/channel_billing_sub2api_test.go:20
↓ 9 callers
Function
setupTelegramOAuthTest
(t *testing.T)
controller/telegram_test.go:60
↓ 9 callers
Function
setupTokenControllerTestDB
(t *testing.T)
controller/token_test.go:115
↓ 9 callers
Method
stop
()
web/src/components/ai-elements/prompt-input.tsx:1052
↓ 9 callers
Function
submitAlibabaRequest
Exercise the production host's usage validation as well as the converter, without sending a paid generation request or needing a database.
plugins/alibaba_responses_test.go:329
↓ 9 callers
Function
trimmed
(value)
plugins/tasks/xai/plugin.js:132
↓ 9 callers
Function
update
()
web/src/lib/theme-color.ts:55
↓ 9 callers
Function
useApiKeys
()
web/src/features/keys/components/api-keys-provider.tsx:182
↓ 9 callers
Function
useCredentialTestDB
useCredentialTestDB points model.DB at a new in-memory SQLite database holding models.
relay/channel/task/jsplugin/credential_test.go:134
↓ 9 callers
Function
useModels
()
web/src/features/models/components/models-provider.tsx:125
↓ 9 callers
Function
validateChannel
validateChannel 通用的渠道校验函数
controller/channel.go:580
↓ 9 callers
Function
writeAuthSessionError
(c *gin.Context, err error)
controller/auth_session.go:164
↓ 8 callers
Method
AdjustBillingOnSubmit
AdjustBillingOnSubmit returns adjusted OtherRatios from the upstream submit response. Called after a successful ParseResponse. If the upstream returne
relay/channel/adapter.go:63
↓ 8 callers
Method
ApplyTick
ApplyTick maps bounded plugin semantics onto host-owned Responses events. taskStatus is the current durable DB status (for example, IN_PROGRESS, SUCCE
relay/plugin_protocol.go:443
↓ 8 callers
Method
BeginAttempt
(channel *model.Channel, group string)
service/request_policy.go:89
↓ 8 callers
Method
CallPathWithMemberJSON
CallPathWithMemberJSON is CallPathWithAdmissionTimeout that also returns the result's member as the text JSON.stringify writes for it, which keeps the
pkg/jsplugin/engine.go:401
↓ 8 callers
Function
ChannelSatisfiesFilters
ChannelSatisfiesFilters reports whether ch passes every filter. On false, it returns the first violated filter in filterEvalOrder for error attributio
model/channel_constraint.go:21
↓ 8 callers
Method
Close
()
relay/channel/openai/image_stream_test.go:275
↓ 8 callers
Function
CompileFromCache
CompileFromCache compiles an expression string, using a cached program when available. The cache is keyed by the SHA-256 hex digest of the expression.
pkg/billingexpr/compile.go:171
↓ 8 callers
Function
ComputeTieredQuotaWithRequest
(snap *BillingSnapshot, params TokenParams, request RequestInput)
pkg/billingexpr/settle.go:28
↓ 8 callers
Method
ConvOptions
ConvOptions returns the request-scoped conversion options snapshot. Must never return nil.
relaykit/relayconvert/convmeta/meta.go:64
↓ 8 callers
Function
Count
Count returns the token count of text for model. GPT and o-series models are counted with their tiktoken encoding; other models use Estimate.
tokenkit/tokenizer.go:27
↓ 8 callers
Function
CreateBodyStorage
CreateBodyStorage stores data in memory or on disk according to cache settings. It takes ownership of data; callers must keep its backing array immuta
common/body_storage.go:313
↓ 8 callers
Method
CreatedEvent
()
relay/plugin_protocol.go:429
↓ 8 callers
Method
Deadline
Deadline returns the write deadline for n more bytes written at now.
relay/helper/stream_scanner.go:89
↓ 8 callers
Function
DecideRelayRetry
DecideRelayRetry is the single retry decision for relay attempts. The reason is recorded in the request policy decision events of the log details.
service/relay_error.go:20
↓ 8 callers
Function
DecreaseUserQuota
(id int, quota int, db bool)
model/user.go:1387
↓ 8 callers
Function
DisableChannel
disable & notify
service/channel.go:30
↓ 8 callers
Method
Error
()
relay/requestplugin/socket.go:378
↓ 8 callers
Method
Events
()
service/request_policy.go:83
↓ 8 callers
Method
Export
Export returns one module export without exposing engine values outside the engine boundary. It is used for declarative exports such as meta.
pkg/jsplugin/engine.go:219
↓ 8 callers
Method
Fields
Fields returns the response fields the web console translates. Callers put the English text in the field their response shape already uses.
common/message.go:44
↓ 8 callers
Method
FinalResponse
FinalResponse validates a plugin-authored complete Responses object and overwrites every host-owned identity and lifecycle field. Unknown protocol fie
relay/plugin_protocol.go:562
↓ 8 callers
Function
FormatClaudeResponseInfo
(claudeResponse *dto.ClaudeResponse, oaiResponse *dto.ChatCompletionsStreamResponse, claudeInfo *ClaudeRespons
relay/channel/claude/relay-claude.go:85
↓ 8 callers
Function
GetAuditLogs
(filter AuditLogFilter, start, limit, viewerRole int)
model/audit_log.go:139
↓ 8 callers
Function
GetClaudeSettings
GetClaudeSettings 获取Claude配置
setting/model_setting/claude.go:45
↓ 8 callers
Function
GetContextKey
(c *gin.Context, key constant.ContextKey)
common/gin.go:182
↓ 8 callers
Function
GetGroupRatioCopy
()
setting/ratio_setting/group_ratio.go:62
↓ 8 callers
Method
GetHeaderOverride
()
model/channel.go:1266
↓ 8 callers
Function
GetHttpClientWithProxy
GetHttpClientWithProxy returns the default client or a cached proxy-enabled client.
service/http_client.go:393
↓ 8 callers
Function
GetInstances
GetInstances returns the instance list in option order. The list is shared and must not be changed.
setting/request_plugin_setting/config.go:66
↓ 8 callers
Function
GetModelRatio
(name string)
setting/ratio_setting/model_ratio.go:385
↓ 8 callers
Function
GetMonitorSetting
()
setting/operation_setting/monitor_setting.go:41
↓ 8 callers
Function
GetOIDCSettings
()
setting/system_setting/oidc.go:28
↓ 8 callers
Function
GetQuotaSetting
()
setting/operation_setting/quota_setting.go:29
↓ 8 callers
Method
GetTokenCountMeta
()
relaykit/dto/request_common.go:9
↓ 8 callers
Function
GetTopUpByTradeNo
(tradeNo string)
model/topup.go:136
↓ 8 callers
Method
GetUpstreamModelName
()
relaykit/relayconvert/convmeta/meta.go:22
← previous
next →
701–800 of 15,409, ranked by callers