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
↓ 5 callers
Function
OpenAIChatRequestToClaudeMessages
(c context.Context, info convmeta.Meta, textRequest dto.GeneralOpenAIRequest)
relaykit/relayconvert/request_compat.go:20
↓ 5 callers
Function
ParseMultipartFormReusable
(c *gin.Context)
common/gin.go:367
↓ 5 callers
Method
ParseSystem
()
relaykit/dto/claude.go:604
↓ 5 callers
Function
PluginCredentialHookContext
PluginCredentialHookContext is the context of a login, refresh or revoke call on a channel: utils.fetch may POST, through the channel proxy, and alway
service/provider_plugin.go:143
↓ 5 callers
Function
PluginKeyToken
PluginKeyToken returns the exchangeKey token of the static key line of a channel: the cached one, or a new exchange when there is none or it expires w
service/provider_plugin.go:325
↓ 5 callers
Function
PreflightRoutingConflict
PreflightRoutingConflict reports whether admitting candidate into the current generation would collide on a case-folded model name or a protocol-model
pkg/jsplugin/routing.go:602
↓ 5 callers
Method
ProtocolSupports
ProtocolSupports reports whether the named protocol claim includes mode.
pluginkit/meta.go:441
↓ 5 callers
Function
QuotaRoundStrict
QuotaRoundStrict rejects an unrepresentable pre-consume estimate.
pkg/billingexpr/round.go:17
↓ 5 callers
Function
RecordPolicyFailure
RecordPolicyFailure appends the failed attempt and the retry decision made for it. The health entry mirrors the check in ProcessChannelError, which pe
service/request_policy.go:129
↓ 5 callers
Function
RecordRequestPolicyTermination
RecordRequestPolicyTermination appends the final decision after routing has stopped. It never writes a log row itself: the per-channel error log writt
service/request_policy.go:190
↓ 5 callers
Function
RecordTopupLog
(userId int, content *common.Message, callerIp string, paymentMethod string, callbackPaymentMethod string)
model/log.go:253
↓ 5 callers
Function
RefreshUserGroupCache
RefreshUserGroupCache publishes current user metadata after a group change.
model/user_cache.go:217
↓ 5 callers
Function
RelayErrorSource
RelayErrorSource tells where a failed attempt went wrong: "channel" for the channel's own key or config (channel:* codes), "transport" when the upstre
service/request_policy.go:105
↓ 5 callers
Function
RequestPluginFetcher
RequestPluginFetcher returns the utils.fetch of a request processing instance's ingress, egress and report hooks: the plugin's allowedHosts and the ho
service/provider_plugin.go:79
↓ 5 callers
Function
RequirePermission
(permission authz.Permission)
middleware/auth.go:410
↓ 5 callers
Method
Reserve
Reserve 将预扣额度补到目标值;若目标值不高于当前预扣额度则不做任何事。
relay/common/billing.go:23
↓ 5 callers
Method
ResponseFailed
()
relay/common/stream_status.go:169
↓ 5 callers
Function
ResponsesResponseToChatCompletionsResponse
(resp *dto.OpenAIResponsesResponse, id string)
relaykit/relayconvert/internal/oai_responses/to_oai_chat_resp.go:59
↓ 5 callers
Function
RevokeUserAccessToken
RevokeUserAccessToken returns the generation actually revoked under the row lock. Deprecated: 旧版面板访问令牌,仅在升级后的过渡期内使用;删除 users.access_token 列时一并移除。
model/user.go:149
↓ 5 callers
Function
RoleSubject
RoleSubject is the casbin subject string for a role.
service/authz/permission.go:25
↓ 5 callers
Function
RoutePathShape
RoutePathShape is a route path with every parameter name left out (":" for a parameter, "*" for a catch-all): two routes of one method and shape match
pluginkit/routing.go:412
↓ 5 callers
Method
ServerEvent
ServerEvent passes one upstream event to the client: the text of each response through its reply check, and the events of each response to its report,
relay/requestplugin/socket.go:461
↓ 5 callers
Method
SetAutoGroups
(groups []string)
model/token.go:50
↓ 5 callers
Method
SetFirstResponseTime
()
relay/common/relay_info.go:1020
↓ 5 callers
Function
SetTaskRouter
SetTaskRouter registers the generic task-plugin API surface. Gin requires every route sharing a path position to use the same wildcard name, so the f
router/task-router.go:14
↓ 5 callers
Function
SetUserPermissions
(userID int, permissions PermissionsMap)
service/authz/override.go:20
↓ 5 callers
Function
SetUserPermissionsInTx
(tx *gorm.DB, userID int, permissions PermissionsMap)
service/authz/override.go:42
↓ 5 callers
Function
SetupContextForToken
(c *gin.Context, token *model.Token, parts ...string)
middleware/auth.go:684
↓ 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:329
↓ 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
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:1051
↓ 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:326
↓ 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
pluginkit/meta.go:426
↓ 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
Valid
Valid reports whether data is a syntactically valid JSON document.
relaykit/relayconvert/kitutil/json.go:85
↓ 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:334
↓ 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:136
↓ 5 callers
Function
compileToggles
(t *testing.T)
pluginkit/route_toggle_test.go:19
↓ 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)
pluginkit/provider.go:281
↓ 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
Function
encode
(writer io.Writer, event CustomEvent)
common/custom-event.go:59
↓ 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
Sends a synchronous request and returns redirects to the caller. * Driver hooks can read from the channel Base URL host and allowedHosts. login, re
pluginkit/v1.d.ts:32
↓ 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:289
↓ 5 callers
Function
getDynamicPriceUnitLabelKey
( entry: DynamicPriceEntry )
web/src/features/pricing/lib/dynamic-price.ts:129
↓ 5 callers
Function
getMessageContent
(message: Message)
web/src/features/playground/lib/message/message-utils.ts:49
← previous
next →
1,401–1,500 of 15,592, ranked by callers