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
↓ 9 callers
Function
EffectiveEffort
(intent Intent)
relaykit/relayconvert/reasoning/intent.go:654
↓ 9 callers
Method
EnsureClaudeConvertInfo
EnsureClaudeConvertInfo lazily creates and returns the mutable OpenAI→Claude stream conversion state. For non-nil receivers, the same instance must be
relaykit/relayconvert/convmeta/meta.go:43
↓ 9 callers
Function
EnsureLegacyAccessTokenRetireAt
EnsureLegacyAccessTokenRetireAt records the legacy token deadline on first start (now + 30 days) and loads the stored value. The first node to start w
model/user_access_token.go:305
↓ 9 callers
Method
Events
()
service/request_policy.go:84
↓ 9 callers
Function
FormatClaudeResponseInfo
(claudeResponse *dto.ClaudeResponse, oaiResponse *dto.ChatCompletionsStreamResponse, claudeInfo *ClaudeRespons
relay/channel/claude/relay-claude.go:85
↓ 9 callers
Function
GenerateHMACWithKey
(key []byte, data string)
common/crypto.go:12
↓ 9 callers
Function
GetByTaskId
(userId int, taskId string)
model/task.go:472
↓ 9 callers
Function
GetContextKeyType
(c *gin.Context, key constant.ContextKey)
common/gin.go:267
↓ 9 callers
Function
GetJsonString
(data any)
common/str.go:100
↓ 9 callers
Method
GetMaxTokens
()
relaykit/dto/openai_request.go:470
↓ 9 callers
Function
GetModelRatioCopy
()
setting/ratio_setting/model_ratio.go:684
↓ 9 callers
Method
GetScopes
GetScopes returns the stored scope list; a malformed value grants nothing.
model/user_access_token.go:59
↓ 9 callers
Function
GetTaskPluginDisabledFactoryKeys
()
setting/task_plugin.go:101
↓ 9 callers
Function
GetVerificationRequirements
(identity AuthIdentity, scope string)
service/security_verification.go:367
↓ 9 callers
Function
InitSessionCookieSettings
()
common/session_cookie.go:44
↓ 9 callers
Function
IsPaymentComplianceConfirmed
()
setting/operation_setting/payment_setting.go:55
↓ 9 callers
Function
IssueAccessToken
(identity AuthIdentity)
service/auth_token.go:60
↓ 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
pluginkit/routing.go:269
↓ 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
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
Function
RoutingMatchModelName
RoutingMatchModelName returns the name used for channel-ability and token-limit fallback matching: strip @ modifiers and legacy aliases first, then ap
setting/ratio_setting/model_ratio.go:711
↓ 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
SetTaskPluginProtocolRouter
(router *gin.Engine)
router/task-plugin-protocol-router.go:13
↓ 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
ValidateSSRFProtectedFetchURL
(urlStr string)
service/http_client.go:71
↓ 9 callers
Function
WithFetcher
WithFetcher makes utils.fetch available to the hook called with ctx.
pluginkit/fetch.go:70
↓ 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
compilePluginProtocolRetrieveEndpoint
(t *testing.T, key, source string, options pluginruntime.Options)
controller/plugin_protocol_test.go:1565
↓ 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.
pluginkit/meta.go:2133
↓ 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
findMarketplaceVersion
( plugin: MarketplacePlugin, version: string )
web/src/features/task-plugins/lib/marketplace.ts:369
↓ 9 callers
Function
flattenBinary
( node: ExpressionNode, operator: string )
web/src/features/pricing/lib/billing-expression/display.ts:49
↓ 9 callers
Function
formatBillingCondition
( source: string, t: Translate, locale = 'en' )
web/src/features/pricing/lib/billing-expression/condition-display.ts:243
↓ 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
hostConfig
()
pluginkit/host.go:115
↓ 9 callers
Function
intPtr
(v int)
relaykit/relayconvert/internal/oai_chat/to_oai_responses_resp.go:314
↓ 9 callers
Function
integerValue
(value any)
pluginkit/provider.go:1734
↓ 9 callers
Function
newAuthzTestDB
(t *testing.T)
service/authz/authz_test.go:14
↓ 9 callers
Function
newConvertRequestFailedError
(c *gin.Context, info *relaycommon.RelayInfo, err error)
relay/convert_request_error.go:13
↓ 9 callers
Function
newDoubaoPlugin
(t *testing.T)
plugins/doubao_responses_test.go:59
↓ 9 callers
Function
newPluginProtocolRetrieveContext
(responseID string)
controller/plugin_protocol_test.go:1581
↓ 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:1591
↓ 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:792
↓ 9 callers
Method
reset
()
router/provider_plugin_relay_test.go:94
↓ 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
setupDashboardAuthMiddlewareTest
(t *testing.T)
middleware/auth_test.go:27
↓ 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
Function
stop
()
web/src/features/playground/hooks/use-stream-request.ts:177
↓ 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:126
↓ 9 callers
Function
validateChannel
validateChannel 通用的渠道校验函数
controller/channel.go:584
↓ 9 callers
Function
writeAuthSessionError
(c *gin.Context, err error)
controller/auth_session.go:164
↓ 8 callers
Method
AddAbilities
(tx *gorm.DB)
model/ability.go:237
↓ 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:90
↓ 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
ConvertStreamResponseChunk
(c context.Context, info convmeta.Meta, state *ResponseStreamState, response any)
relaykit/relayconvert/response_registry.go:326
↓ 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
DecreaseUserQuota
(id int, quota int, db bool)
model/user.go:1403
← previous
next →
701–800 of 15,592, ranked by callers