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
↓ 5 callers
Function
SetUserPermissionsInTx
(tx *gorm.DB, userID int, permissions PermissionsMap)
service/authz/override.go:42
↓ 5 callers
Function
SetVideoRouter
(router *gin.Engine)
router/video-router.go:10
↓ 5 callers
Function
SetupContextForToken
(c *gin.Context, token *model.Token, parts ...string)
middleware/auth.go:673
↓ 5 callers
Function
Sha1
(data []byte)
common/hash.go:22
↓ 5 callers
Function
ShouldSkipRetryAfterChannelAffinityFailure
(c *gin.Context)
service/channel_affinity.go:633
↓ 5 callers
Method
SkippedRoutes
SkippedRoutes returns the declared top-level routes the gateway does not register.
pkg/jsplugin/routing.go:695
↓ 5 callers
Function
SmokeTestTaskExpr
SmokeTestTaskExpr validates a task usage expression against the usage facts declared by its plugin. Literal u() keys must be declared; dynamic calls a
setting/billing_setting/tiered_billing.go:249
↓ 5 callers
Function
StreamResponseOpenAI2Claude
(openAIResponse *dto.ChatCompletionsStreamResponse, info convmeta.Meta)
relaykit/relayconvert/internal/oai_chat/to_claude_messages_resp.go:112
↓ 5 callers
Function
SubmitIngress
SubmitIngress takes the execution plan of a task or Midjourney submission and runs the ingress stage on its stored client body, once, before the body
relay/requestplugin/relay.go:65
↓ 5 callers
Method
Summary
()
relay/common/stream_status.go:218
↓ 5 callers
Method
SupportedEndpointTypesForModel
(model string)
relaykit/dto/channel_settings.go:333
↓ 5 callers
Function
SyncTaskPluginsOnceContext
SyncTaskPluginsOnceContext loads the enabled plugin rows into the registry and records the ones this node runs differently from the database as the pl
controller/task_plugin.go:1026
↓ 5 callers
Function
TaskPriceExpr
TaskPriceExpr reports whether expression can be a plugin's task price. An expression reading chat request quantities cannot. A plugin's own price alwa
setting/billing_setting/tiered_billing.go:155
↓ 5 callers
Method
ToFileSource
()
relaykit/dto/gemini.go:265
↓ 5 callers
Function
TryReserveUserQuota
TryReserveUserQuota atomically checks and deducts a user's wallet quota. 缓存命中时以缓存余额为准(避免批量模式下过期的数据库余额放大并发超扣); Redis 异常或水合失败时降级为数据库条件更新,保证服务可用。
model/quota_reserve.go:164
↓ 5 callers
Method
Update
()
model/subscription.go:249
↓ 5 callers
Function
UpdateOptionsBulk
UpdateOptionsBulk persists multiple key/value pairs in a single database transaction, then dispatches them through updateOptionMap in one pass. If any
model/option.go:323
↓ 5 callers
Function
UpdatePasskeyAssertionState
UpdatePasskeyAssertionState persists only fields produced by a successful assertion. Registration identity (credential ID, public key, AAGUID, transpo
model/passkey.go:165
↓ 5 callers
Function
UpdateSystemTaskState
(taskID string, lockedBy string, state any)
model/system_task.go:449
↓ 5 callers
Method
UsageForModels
UsageForModels returns the usage metadata of the first candidate that a profile declares. Runtime callers pass the final upstream model before the cli
pkg/jsplugin/registry.go:337
↓ 5 callers
Function
UsageFromGeminiMetadata
(metadata *dto.GeminiUsageMetadata, fallbackPromptTokens int)
relaykit/relayconvert/response_compat.go:136
↓ 5 callers
Function
UsedVarsByHash
UsedVarsByHash reuses the digest captured by the host's billing snapshot.
pkg/billingexpr/compile.go:301
↓ 5 callers
Function
UsesChatQuantities
UsesChatQuantities reports whether an expression reads a chat request quantity, including in branches the current request would not evaluate.
pkg/billingexpr/compile.go:332
↓ 5 callers
Function
UsesFixedPricing
UsesFixedPricing includes unselected branches, even when compilation later optimizes them away. Hosts use it to reject unsupported billing entrances.
pkg/billingexpr/fixed.go:12
↓ 5 callers
Function
ValidateConsoleSettings
(settingsStr string, settingType string)
setting/console_setting/validation.go:88
↓ 5 callers
Function
ValidateModelPricing
(name string, values PricingValues)
model/model_pricing_config.go:486
↓ 5 callers
Method
ValidateSettings
()
model/channel.go:1160
↓ 5 callers
Function
ValidateWalletQuota
ValidateWalletQuota enforces the upper bound shared by wallet mutations. Negative balances remain valid because billing can temporarily overdraw a wal
common/quota_math.go:22
↓ 5 callers
Method
WriteHeaders
(originModel string, httpHeader *http.Header)
setting/model_setting/claude.go:53
↓ 5 callers
Function
add
(tag: string)
web/src/lib/localized-text.ts:67
↓ 5 callers
Function
adminUserRequest
adminUserRequest drives an admin user-management handler with the operator context that AdminAuth would have populated for a dashboard session.
controller/admin_user_verification_test.go:34
↓ 5 callers
Method
apply
(tx *gorm.DB)
model/log.go:495
↓ 5 callers
Function
applyFetchModelsHeaderOverrides
(channel *model.Channel, key string, headers http.Header)
controller/channel.go:333
↓ 5 callers
Function
applyUsagePostProcessing
(info *relaycommon.RelayInfo, usage *dto.Usage, responseBody []byte)
relay/channel/openai/usage.go:10
↓ 5 callers
Function
attachmentInstance
(id, config string)
relay/requestplugin/attachments_test.go:60
↓ 5 callers
Function
auditRequest
(router http.Handler, method, path, token string)
controller/access_token_audit_test.go:63
↓ 5 callers
Function
authCacheMAC
authCacheMAC binds cache metadata to its purpose and Redis key. Only database snapshots or server-created session states may be signed.
model/auth_cache_integrity.go:12
↓ 5 callers
Function
buildAlphaSearchRequestBody
buildAlphaSearchRequestBody returns RawBody unchanged unless the model was mapped, in which case only the "model" field is rewritten so unknown fields
relay/alpha_search_handler.go:124
↓ 5 callers
Function
buildChannelAffinityTemplateContextForTest
(meta channelAffinityMeta)
service/channel_affinity_template_test.go:23
↓ 5 callers
Function
buildQueryParams
buildQueryParams builds query parameters for GET requests
pkg/ionet/client.go:161
↓ 5 callers
Function
cacheIncrUserQuota
Add atomic quota operations using hash fields. 通过守卫式 Lua 脚本执行:哈希不存在时直接跳过(下次读取会从数据库水合), 不会像裸 HINCRBY 那样创建只含 Quota 字段的残缺哈希。
model/user_cache.go:159
↓ 5 callers
Function
callback
(authorization: unknown)
web/src/features/auth/components/telegram-login-dialog.tsx:56
↓ 5 callers
Method
canRenew
canRenew reports whether a rejected request can be sent again with a renewed key: a credential the plugin refreshes, or a static key it exchanges.
relay/channel/providerplugin/adaptor.go:630
↓ 5 callers
Function
chatBody
(parts ...string)
relay/requestplugin/attachments_test.go:81
↓ 5 callers
Function
chatFile
(filename, url string)
relay/requestplugin/attachments_test.go:77
↓ 5 callers
Function
claudeCapabilitiesFor
(model string)
relaykit/relayconvert/reasoning/claude.go:45
↓ 5 callers
Function
clickHouseLogOrder
(prefix string)
model/log.go:105
↓ 5 callers
Method
code
(t *testing.T, receiver string)
controller/security_account_test.go:323
↓ 5 callers
Function
colorAt
(index: number, palette?: readonly string[])
web/src/features/dashboard/lib/flow.ts:283
↓ 5 callers
Method
commit
(info *relaycommon.RelayInfo)
relay/channel/gemini/relay-gemini.go:123
↓ 5 callers
Function
completeAssistantTiming
( message: Message, completedAt: number = Date.now() )
web/src/features/playground/lib/message/message-timing-utils.ts:22
↓ 5 callers
Function
configValue
(config json.RawMessage)
pkg/jsplugin/provider.go:283
↓ 5 callers
Function
configureTokenAutoGroupsTest
(t *testing.T, maxCount string, autoGroups string)
controller/token_auto_groups_test.go:19
↓ 5 callers
Function
countClaudeStreamBillableTools
(info *relaycommon.RelayInfo, claudeResponse *dto.ClaudeResponse)
relay/channel/claude/relay-claude.go:225
↓ 5 callers
Function
createReserveTestUser
(t *testing.T, quota int)
model/quota_reserve_test.go:14
↓ 5 callers
Function
decodeData
(data []byte, target *T)
pkg/ionet/jsonutil.go:28
↓ 5 callers
Function
decodeDoubaoImage
(t *testing.T, registry *jsplugin.Registry, plugin *jsplugin.LoadedPlugin, body map[string]any)
plugins/doubao_responses_test.go:69
↓ 5 callers
Function
decodePasskeyDomainBegin
(t *testing.T, response *httptest.ResponseRecorder)
controller/passkey_test.go:99
↓ 5 callers
Function
doRequest
(c *gin.Context, req *http.Request, info *common.RelayInfo)
relay/channel/api_request.go:538
↓ 5 callers
Function
documentLocale
(language: string)
web/src/features/task-plugins/lib/plugin-document.ts:32
↓ 5 callers
Function
drainClose
(t *testing.T, resp *http.Response)
service/http_client_transport_test.go:117
↓ 5 callers
Function
dryRunBuiltIn
dryRunBuiltIn runs one instance of a built-in plugin through the host's dry run, attachments included.
plugins/request_plugins_test.go:1120
↓ 5 callers
Method
encode
(out *bytes.Buffer)
pkg/requestpatch/patch.go:494
↓ 5 callers
Function
evaluateTaskVisualConfig
( config: TaskVisualConfig, sample: Record<string, number | string>, schema?: BillingUsageSchema )
web/src/features/pricing/lib/task-expr.ts:229
↓ 5 callers
Method
fetch
Synchronous request. Driver hooks address the channel Base URL host or allowedHosts, read-only outside login, refresh, revoke, exchangeKey and schedul
docs/plugin-api/v1.d.ts:27
↓ 5 callers
Function
formatLatency
(ms: number)
web/src/features/performance-metrics/lib/format.ts:25
↓ 5 callers
Function
formatLogOtherJSON
formatLogOtherJSON applies the role projection while keeping untouched JSON values as RawMessage. This preserves integers larger than JavaScript's saf
model/log_other.go:232
↓ 5 callers
Function
formatNotifyType
(channelId int, status int)
service/channel.go:16
↓ 5 callers
Function
formatThroughput
(tps: number)
web/src/features/performance-metrics/lib/format.ts:19
↓ 5 callers
Function
getAccessToken
(a *Adaptor, info *relaycommon.RelayInfo)
relay/channel/vertex/service_account.go:49
↓ 5 callers
Function
getChannelAffinityMeta
(c *gin.Context)
service/channel_affinity.go:377
↓ 5 callers
Function
getDynamicPriceEntries
( tier: DynamicPricingTier | null, options: DynamicPriceOptions )
web/src/features/pricing/lib/dynamic-price.ts:282
↓ 5 callers
Function
getDynamicPriceUnitLabelKey
( entry: DynamicPriceEntry )
web/src/features/pricing/lib/dynamic-price.ts:122
↓ 5 callers
Function
getMessageContent
(message: Message)
web/src/features/playground/lib/message/message-utils.ts:49
↓ 5 callers
Function
getPluginWebsite
(value: unknown)
web/src/features/task-plugins/lib/plugin-website.ts:20
↓ 5 callers
Function
getSavedChartPreferences
()
web/src/features/dashboard/lib/filters.ts:94
↓ 5 callers
Function
getTaskQuota
(t *testing.T, id int64)
service/task_billing_test.go:562
↓ 5 callers
Function
getTaskUsagePriceUnitLabelKey
( unit: BillingUsageUnit | undefined )
web/src/features/pricing/lib/dynamic-price.ts:113
↓ 5 callers
Function
getUserAvatarFallback
(name: string)
web/src/lib/avatar.ts:43
↓ 5 callers
Function
getUserAvatarStyle
(name: string)
web/src/lib/avatar.ts:31
↓ 5 callers
Function
hasDiagnosticCode
(diagnostics []types.ConversionDiagnostic, code string)
relaykit/relayconvert/internal/toolconv/policy_test.go:26
↓ 5 callers
Function
hasTaskUsageSchema
(model: PricingModel)
web/src/features/pricing/lib/dynamic-price.ts:154
↓ 5 callers
Function
hasValue
(value: unknown)
web/src/features/system-settings/models/model-pricing-core.ts:198
↓ 5 callers
Method
hookContext
hookContext is the ctx of the relay hooks of the request.
relay/channel/providerplugin/adaptor.go:594
↓ 5 callers
Function
idParam
(id int)
controller/provider_plugin_test.go:111
↓ 5 callers
Function
identityFilters
(key string, channelTypes []int)
model/task_plugin_channel_select_test.go:52
↓ 5 callers
Function
insertTask
(t *testing.T, task *Task)
model/task_cas_test.go:99
↓ 5 callers
Function
invalidRequestStatus
invalidRequestStatus is the status of a request whose body could not be read or parsed: 413 when the body exceeds MAX_REQUEST_BODY_MB, else 400.
middleware/utils.go:40
↓ 5 callers
Function
invalidateTokenCacheForMutation
invalidateTokenCacheForMutation is called before a token metadata mutation writes to the database: it raises the fence and drops the cached hash so no
model/token_cache.go:56
↓ 5 callers
Function
isAuthBundle
(value: unknown)
web/src/lib/auth-session.ts:131
↓ 5 callers
Function
isContentSizedColumn
(columnId: string)
web/src/components/data-table/core/content-sized-columns.ts:19
↓ 5 callers
Function
isH3
(model)
plugins/tasks/hailuo/plugin.js:278
↓ 5 callers
Function
isObject
(value)
plugins/tasks/request-filter/plugin.js:129
↓ 5 callers
Function
isPaymentComplianceConfirmed
()
controller/payment_webhook_availability.go:10
↓ 5 callers
Function
isRecord
(value: unknown)
web/src/lib/server-error-message.ts:89
↓ 5 callers
Function
isRecord
(value: unknown)
web/src/lib/auth-session.ts:90
↓ 5 callers
Method
item
item returns the media ref names.
relay/requestplugin/attachments.go:325
↓ 5 callers
Function
limitLogTimeRange
limitLogTimeRange returns the start of a log or dashboard search kept within the longest log time range. A missing start reaches back the whole range,
controller/log.go:42
↓ 5 callers
Function
listTaskPluginItem
(t *testing.T, key string)
controller/task_plugin_test.go:180
↓ 5 callers
Function
logTokenName
( log: Pick<UsageLog, 'token_id' | 'token_name'>, t: (key: string, opts?: Record<string, unknown>) => stri
web/src/features/usage-logs/lib/format.ts:589
← previous
next →
1,401–1,500 of 15,409, ranked by callers