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
↓ 7 callers
Function
createUserSessionTestUser
(t *testing.T, userID int, authVersion int64)
model/user_session_test.go:66
↓ 7 callers
Function
credentialTaskInfo
(baseURL, key string, channelType int)
relay/channel/task/jsplugin/credential_test.go:163
↓ 7 callers
Function
creditTopUpQuota
creditTopUpQuota atomically enforces the wallet ceiling while adding quota. Keeping the predicate and increment in one UPDATE prevents two concurrent
model/topup.go:90
↓ 7 callers
Function
currentEnforcer
()
service/authz/enforcer.go:63
↓ 7 callers
Method
disabled
disabled receives the channel reread after UpdateChannelStatus succeeds. Checking the export table precedes all scheduler allocation and JS work.
service/provider_plugin_scheduled.go:146
↓ 7 callers
Function
filterDisabledFactory
(factory map[string]*LoadedPlugin, disabled map[string]struct{})
pkg/jsplugin/registry.go:496
↓ 7 callers
Function
formatCurrencyFromUSD
( amountUSD: number | null | undefined, options?: CurrencyFormatOptions )
web/src/lib/currency.ts:408
↓ 7 callers
Function
formatPricingAmount
( value: string | number, currency = USD_PRICING_CURRENCY )
web/src/features/model-pricing/currency.ts:61
↓ 7 callers
Function
formatUptimePct
(pct: number)
web/src/features/performance-metrics/lib/format.ts:31
↓ 7 callers
Function
getChannelTypeLabel
(type: number)
web/src/features/channels/lib/channel-utils.ts:39
↓ 7 callers
Function
getServerErrorMessageKey
(value: unknown)
web/src/lib/server-error-message.ts:111
↓ 7 callers
Function
getServerErrorSources
( value: unknown )
web/src/lib/server-error-message.ts:94
↓ 7 callers
Function
getSubscriptionPlanByIdTx
(tx *gorm.DB, id int)
model/subscription.go:401
↓ 7 callers
Function
getTaskEnumFields
( schema: BillingUsageSchema | null | undefined )
web/src/features/pricing/lib/task-expr.ts:79
↓ 7 callers
Function
getTaskPricingDisplayTiers
( expression: string | null | undefined, schema: BillingUsageSchema | null | undefined )
web/src/features/pricing/lib/task-matrix-display.ts:63
↓ 7 callers
Function
getUserQuotaForPaymentGuardTest
(t *testing.T, userID int)
model/payment_method_guard_test.go:84
↓ 7 callers
Function
imageContent
(body)
plugins/tasks/alibaba/plugin.js:733
↓ 7 callers
Function
initDefaultHTTPClientFixture
(t *testing.T)
service/http_client_transport_test.go:45
↓ 7 callers
Function
invalidateVendorData
(client: QueryClient)
web/src/features/models/vendor-api.ts:97
↓ 7 callers
Function
manageMultiKeys
( params: MultiKeyManageParams )
web/src/features/channels/api.ts:562
↓ 7 callers
Function
metadataTransaction
metadataTransaction serializes changes to vendors and model ownership before acquiring model/vendor row locks. The option anchor also covers empty tab
model/model_metadata_sync.go:19
↓ 7 callers
Function
newAccessTokenTestRouter
newAccessTokenTestRouter mirrors the production paths, so the access token route rules keyed by gin full path apply unchanged.
controller/access_token_audit_test.go:75
↓ 7 callers
Function
newAuthenticatedContext
(t *testing.T, method string, target string, body any, userID int)
controller/token_test.go:192
↓ 7 callers
Function
newOuterPluginTestEngine
()
router/plugin_router_test.go:1048
↓ 7 callers
Method
newRefreshToken
newRefreshToken stores a refresh token the fake server accepts.
service/provider_plugin_test.go:324
↓ 7 callers
Function
newSub2APITestChannel
(t *testing.T, serverURL string)
controller/channel_billing_sub2api_test.go:37
↓ 7 callers
Function
newTaskUpstream
(t *testing.T)
relay/channel/task/jsplugin/credential_test.go:86
↓ 7 callers
Function
numberValue
(value: unknown)
web/src/features/dashboard/lib/flow.ts:149
↓ 7 callers
Function
omniModel
(ctx)
plugins/tasks/vertex-ai/plugin.js:136
↓ 7 callers
Function
parseTaskTiersFromExpr
( exprStr: string, schema: BillingUsageSchema | null | undefined, includeBooleanConditions = false )
web/src/features/pricing/lib/billing-expr.ts:339
↓ 7 callers
Function
parseTiersFromExpr
(exprStr: string)
web/src/features/pricing/lib/billing-expr.ts:320
↓ 7 callers
Function
plainObject
(value)
plugins/tasks/vertex-ai/plugin.js:121
↓ 7 callers
Function
pluginProtocolTestSSEEventTypes
(body string)
controller/plugin_protocol_test.go:1545
↓ 7 callers
Function
postAddChannel
(t *testing.T, userID, role int, body string)
controller/channel_task_plugin_bind_test.go:46
↓ 7 callers
Function
pricingEndpointTypesByModel
(t *testing.T)
model/pricing_endpoint_test.go:67
↓ 7 callers
Function
rateLimitFactory
(maxRequestNum int, duration int64, mark string)
middleware/rate-limit.go:148
↓ 7 callers
Function
registerNetPlugin
(t *testing.T)
relay/requestplugin/requestplugin_test.go:785
↓ 7 callers
Function
registerRotatingPlugin
(t *testing.T, key, extra string)
router/provider_plugin_relay_test.go:421
↓ 7 callers
Function
requestContextDone
(c *gin.Context)
relay/helper/common.go:193
↓ 7 callers
Function
requireOptionMissing
(t *testing.T, db *gorm.DB, key string)
model/frontend_option_migration_test.go:37
↓ 7 callers
Method
resolveForConversion
(c *gin.Context, info *relaycommon.RelayInfo)
relay/channel/advancedcustom/adaptor.go:386
↓ 7 callers
Method
responseSnapshot
(responseError *dto.PluginResponsesError)
relay/plugin_protocol.go:1002
↓ 7 callers
Function
routingProtocolExport
(name string)
pkg/jsplugin/routing_test.go:655
↓ 7 callers
Function
sanitizeFetchModelsError
(err error, key string)
controller/channel_upstream_update.go:287
↓ 7 callers
Method
sent
(t *testing.T, path string)
relay/channel/task/jsplugin/credential_test.go:101
↓ 7 callers
Function
setupTaskPluginBindChannelTest
(t *testing.T)
controller/channel_task_plugin_bind_test.go:22
↓ 7 callers
Function
sseData
sseData returns the data of each event of a stream.
relay/requestplugin/requestplugin_test.go:1116
↓ 7 callers
Method
sync
sync puts the steps and the record of the reply checks after the attempt's other entries on info, where the consume or error log reads them.
relay/requestplugin/reply.go:1494
↓ 7 callers
Function
syncCreditUserQuotaCache
syncCreditUserQuotaCache 在授信事务(充值/兑换等)提交后同步把增量补进缓存 余额。预扣以缓存值为准(存在期间),授信不能绕过它,否则新到账的额度在 缓存过期前不可用;缓存未命中无需处理,下次读取会从已提交的数据库余额水合。
model/user_cache.go:174
↓ 7 callers
Function
tasksToDto
(tasks []*model.Task, fillUser bool, viewerRole int)
controller/task.go:440
↓ 7 callers
Function
transformChannelToFormDefaults
( channel: Channel )
web/src/features/channels/lib/channel-form.ts:518
↓ 7 callers
Function
useAccountSecurity
()
web/src/features/security/hooks/use-account-security.ts:34
↓ 7 callers
Function
useCanEditModelPricing
()
web/src/features/model-pricing/api.ts:125
↓ 7 callers
Function
useIsMobile
()
web/src/hooks/use-mobile.ts:23
↓ 7 callers
Function
userSessionCacheDeadline
()
model/user_session.go:131
↓ 7 callers
Function
vendorAPIError
(c *gin.Context, err error)
controller/vendor_meta.go:95
↓ 7 callers
Function
visitExpression
( node: ExpressionNode, visitor: (node: ExpressionNode) => void )
web/src/features/pricing/lib/billing-expression/types.ts:166
↓ 7 callers
Function
withBasePricing
(model: PricingModel)
web/src/features/pricing/lib/plugin-pricing.ts:104
↓ 7 callers
Function
withRelayHTTPTransportSettings
(t *testing.T)
service/http_client_transport_test.go:27
↓ 6 callers
Function
AccessTokenHint
AccessTokenHint is the last four characters of a token, shown so users can tell their tokens apart. PostgreSQL pads legacy CHAR(32) values with spaces
model/user_access_token.go:225
↓ 6 callers
Function
AccessTokenScopeOf
AccessTokenScopeOf is the token scope key for a Casbin permission.
service/access_token_scope.go:118
↓ 6 callers
Function
AdvanceCurrentSessionToUserVersion
AdvanceCurrentSessionToUserVersion is used when the security mutation and AuthVersion increment were committed in the same transaction (for example, a
service/auth_session.go:200
↓ 6 callers
Function
ApplyChannelAffinityOverrideTemplate
ApplyChannelAffinityOverrideTemplate merges per-rule channel override templates onto the selected channel override config.
service/channel_affinity.go:533
↓ 6 callers
Function
ApplyResponsesUsage
(dst *dto.Usage, src *dto.Usage)
service/responses_usage.go:154
↓ 6 callers
Function
ApplyToOpenAIChat
ApplyToOpenAIChat writes the portable portion of an intent to the OpenAI pivot. reasoning_effort carries level-based strength; a JSON-excluded DTO sta
relaykit/relayconvert/reasoning/intent.go:452
↓ 6 callers
Method
ApplyVendorToolUsage
ApplyVendorToolUsage writes the vendor-billed counts of one upstream response into BuiltInTools. Protocol items counted earlier for the same key are r
relay/common/tool_usage.go:85
↓ 6 callers
Function
AttachRequest
(format types.RelayFormat, request any, set Set, options *convmeta.Options)
relaykit/relayconvert/internal/toolconv/encode.go:17
↓ 6 callers
Function
AutoGroups2JsonString
()
setting/auto_group.go:35
↓ 6 callers
Method
CallPathWithAdmissionTimeout
CallPathWithAdmissionTimeout gives long-lived observers a separate bound for waiting on JavaScript capacity. Once admitted, the hook receives the engi
pluginkit/engine.go:384
↓ 6 callers
Method
CallPathWithMemberJSON
CallPathWithMemberJSON is CallPathWithAdmissionTimeout that also returns the result's member as the text JSON.stringify writes for it, which keeps the
pluginkit/engine.go:399
↓ 6 callers
Method
CallSignRequest
CallSignRequest runs signRequest(ctx, {method, url, headers, bodySha256}).
pluginkit/provider.go:448
↓ 6 callers
Function
ChatCompletionsRequestToResponsesRequest
(ctx context.Context, req *dto.GeneralOpenAIRequest)
relaykit/relayconvert/internal/oai_chat/to_oai_responses_req.go:83
↓ 6 callers
Function
ClaimExternalIdentityWithTx
ClaimExternalIdentityWithTx atomically claims a provider subject for one user. Repeating the exact mapping is idempotent; every competing subject or u
model/external_identity_claim.go:37
↓ 6 callers
Method
Clear
()
types/rw_map.go:54
↓ 6 callers
Function
CommonClaudeHeadersOperation
(c *gin.Context, req *http.Header, info *relaycommon.RelayInfo)
relay/channel/claude/adaptor.go:105
↓ 6 callers
Function
CompleteSubscriptionOrder
Complete a subscription order (idempotent). Creates a UserSubscription snapshot from the plan. expectedPaymentProvider guards against cross-gateway ca
model/subscription.go:581
↓ 6 callers
Function
ConsumeAuthFlow
ConsumeAuthFlow atomically validates and consumes a flow. Optional match fields are enforced when non-zero so tokens cannot cross purposes or users.
model/auth_flow.go:239
↓ 6 callers
Method
ConvertImageRequest
(c *gin.Context, info *relaycommon.RelayInfo, request dto.ImageRequest)
relay/channel/adapter.go:27
↓ 6 callers
Function
ConvertResponse
(c *gin.Context, info *relaycommon.RelayInfo, target types.RelayFormat, response any)
service/response_converter.go:10
↓ 6 callers
Method
ConvertToOpenAIVideo
(originTask *model.Task)
relay/channel/adapter.go:101
↓ 6 callers
Function
CreateUserAccessToken
CreateUserAccessToken inserts a token while holding the owner's users row, so concurrent creates cannot exceed limit. Expired rows awaiting cleanup co
model/user_access_token.go:120
↓ 6 callers
Method
Delete
()
model/channel.go:687
↓ 6 callers
Function
DeleteTaskPluginVersion
(c *gin.Context)
controller/task_plugin.go:589
↓ 6 callers
Function
DryRun
DryRun runs the four stages on input without sending or charging anything. It stops at a rejection or a failure that stops the request.
relay/requestplugin/relay.go:635
↓ 6 callers
Function
EffortFromBudget
(budget int)
relaykit/relayconvert/reasoning/intent.go:674
↓ 6 callers
Function
Estimate
Estimate returns the estimated token count of text for model, using the weights of the model's family. It never runs a tokenizer; use Count for an exa
tokenkit/tokenkit.go:140
↓ 6 callers
Method
EstimateBillingValidated
(c *gin.Context, info *relaycommon.RelayInfo)
relay/channel/adapter.go:140
↓ 6 callers
Function
EvaluateTaskCompletionUsage
EvaluateTaskCompletionUsage evaluates actual facts against the frozen task expression. It neither mutates the snapshot nor moves funds: synchronous su
service/task_billing.go:444
↓ 6 callers
Function
ExceedsMaxTokensLimit
ExceedsMaxTokensLimit checks token limits before they reach billing arithmetic.
relay/helper/valid_request.go:128
↓ 6 callers
Function
ExtractRequest
(format types.RelayFormat, request any)
relaykit/relayconvert/internal/toolconv/decode.go:17
↓ 6 callers
Function
FatalLog
(v ...any)
common/sys_log.go:55
↓ 6 callers
Method
FetchBatchTasks
(baseURL, key string, tasks []*model.Task, proxy string)
service/task_polling.go:41
↓ 6 callers
Function
FinalizeStreamResponse
(c *gin.Context, info *relaycommon.RelayInfo, state *relayconvert.ResponseStreamState)
service/response_converter.go:34
↓ 6 callers
Function
FormatAdminLogs
FormatAdminLogs removes root-only diagnostics while retaining operational admin_info. Root callers must not pass their results through this formatter.
model/log.go:125
↓ 6 callers
Function
FromOpenAIChat
(req *dto.GeneralOpenAIRequest)
relaykit/relayconvert/reasoning/intent.go:361
↓ 6 callers
Function
GenerateFinalUsageResponse
(id string, createAt int64, model string, usage dto.Usage)
relay/helper/common.go:376
↓ 6 callers
Function
GetActiveSystemTask
(taskType string)
model/system_task.go:142
↓ 6 callers
Method
GetBalanceDetail
GetBalanceDetail returns the channel's last balance query, nil before the first one.
model/channel_balance.go:22
↓ 6 callers
Method
GetByModel
GetByModel returns the deterministic effective plugin metadata used for a model-level host concern such as billing. When multiple providers expose the
pkg/jsplugin/routing.go:153
↓ 6 callers
Method
GetCacheCreation1hTokens
()
relaykit/dto/claude.go:712
← previous
next →
1,001–1,100 of 15,592, ranked by callers