MCPcopy Create free account

hub / github.com/QuantumNous/new-api / functions

Functions15,409 in github.com/QuantumNous/new-api

↓ 3 callersFunctionQuotaFromDecimalChecked
QuotaFromDecimalChecked is QuotaFromDecimal but also returns a non-nil *QuotaClamp when the value was clamped, so billing callers can audit it.
common/quota_math.go:159
↓ 3 callersFunctionQuotaFromFloatChecked
QuotaFromFloatChecked is QuotaFromFloat but also returns a non-nil *QuotaClamp when the value was clamped, so billing callers can audit it.
common/quota_math.go:119
↓ 3 callersFunctionReadBodyJSONFields
ReadBodyJSONFields returns owned copies of the requested values. For valid JSON, simple member and array-index paths read disk storage through a bound
common/body_storage.go:46
↓ 3 callersFunctionRecord
(sample Sample)
pkg/perf_metrics/metrics.go:125
↓ 3 callersFunctionRecordExist
(err error)
model/utils.go:127
↓ 3 callersFunctionRecordMidjourneyPolicyResponse
RecordMidjourneyPolicyResponse distinguishes accepted tasks from errors inside HTTP 200 responses. Submissions are single-attempt: an ambiguous transp
service/midjourney.go:277
↓ 3 callersMethodRecordRequestInferredToolCall
RecordRequestInferredToolCall bills one call of key that the request itself proves: a forced hosted search on an upstream whose response reports no se
relay/common/tool_usage.go:98
↓ 3 callersFunctionRecordTaskBillingLog
(params RecordTaskBillingLogParams)
model/log.go:430
↓ 3 callersFunctionRedactCredentialLines
RedactCredentialLines replaces every credential line of a channel key with its summary, so the key can be shown to an administrator.
pkg/jsplugin/provider.go:141
↓ 3 callersFunctionRefreshCodexChannelCredential
(ctx context.Context, channelID int, opts CodexCredentialRefreshOptions)
service/codex_credential_refresh.go:42
↓ 3 callersFunctionRefreshCodexOAuthTokenWithProxy
(ctx context.Context, refreshToken string, proxyURL string)
service/codex_oauth.go:33
↓ 3 callersFunctionRegisterPasskeyForSession
(identity AuthSessionIdentity, credential *PasskeyCredential)
model/passkey.go:228
↓ 3 callersFunctionRegisterResource
RegisterResource adds a resource definition to the permission registry.
service/authz/registry.go:24
↓ 3 callersFunctionRenderGemini
RenderGemini maps a portable intent onto the target model's thinkingConfig. The capability table only maps and clamps: budgets become levels on Gemini
relaykit/relayconvert/reasoning/gemini.go:72
↓ 3 callersFunctionReplayFixture
ReplayFixture compiles a plugin and runs every fixture case in declaration order. unixNow is fixed by the fixture to keep signing and timestamp hooks
pkg/jsplugin/fixture.go:39
↓ 3 callersMethodRequestedImageCount
()
relay/common/relay_info.go:268
↓ 3 callersFunctionRequireLoginVerification
(token, method string)
service/login_verification.go:91
↓ 3 callersFunctionResolveImageBillingRequestInput
ResolveImageBillingRequestInput freezes only the validated scalar image parameters needed by pricing. Image files, prompts and base64 payloads are del
relay/helper/billing_expr_request.go:55
↓ 3 callersFunctionResolveLegacyBillingDetails
(name string, effective, configured PricingValues)
model/model_pricing_conversion.go:64
↓ 3 callersFunctionResolveOriginTask
ResolveOriginTask 处理基于已有任务的提交(remix / continuation): 查找原始任务、从中提取模型名称、将渠道锁定到原始任务的渠道 (通过 info.LockedChannel,重试时复用同一渠道并轮换 key), 以及提取 OtherRatios(时长、分辨率)。
relay/relay_task.go:50
↓ 3 callersFunctionResolveTaskPluginForPlatform
(generation *pluginruntime.RoutingGeneration, platform constant.TaskPlatform)
relay/relay_adaptor.go:159
↓ 3 callersFunctionResolveTaskPluginModel
ResolveTaskPluginModel matches a client model name against a plugin's declared models as the host protocols do: a case variant is served under the dec
model/task_model_alias.go:54
↓ 3 callersFunctionResponseOpenAI2Claude
(openAIResponse *dto.OpenAITextResponse, info convmeta.Meta)
relaykit/relayconvert/response_compat.go:38
↓ 3 callersFunctionResponseOpenAI2Claude
(openAIResponse *dto.OpenAITextResponse, info convmeta.Meta)
relaykit/relayconvert/internal/oai_chat/to_claude_messages_resp.go:450
↓ 3 callersFunctionResponsesCustomToolNames
ResponsesCustomToolNames returns the Responses custom tools that AttachRequest sends upstream as functions. The response side restores function calls
relaykit/relayconvert/internal/toolconv/encode.go:293
↓ 3 callersFunctionResponsesSocket
ResponsesSocket starts the reply check and the report capture of one Responses WebSocket response, once its upstream request is sent. send writes one
relay/requestplugin/socket.go:63
↓ 3 callersFunctionResponsesToolStateOf
ResponsesToolStateOf is a nil-safe reader for Meta.ResponsesToolState.
relaykit/relayconvert/convmeta/meta.go:323
↓ 3 callersFunctionRevokeByRefreshToken
(rawRefreshToken, expectedSID, reason string)
service/auth_session.go:296
↓ 3 callersFunctionRevokeOtherUserSessions
(userID int, currentSID, reason string)
model/user_session.go:726
↓ 3 callersFunctionRevokeRemovedChannelCredentials
RevokeRemovedChannelCredentials revokes the credential lines of a task plugin channel's key before an edit that its key after it no longer holds. stor
service/provider_plugin.go:718
↓ 3 callersFunctionRevokeUserSessionByRefreshHash
RevokeUserSessionByRefreshHash is used when logout is authenticated only by the HttpOnly refresh cookie. Possession of a SID alone is insufficient. Th
model/user_session.go:622
↓ 3 callersFunctionRootUserExists
()
model/user.go:1531
↓ 3 callersFunctionRotateUserSessionRefresh
RotateUserSessionRefresh atomically rotates HMAC digests. The UPDATE itself is a compare-and-swap so SQLite, where lockForUpdate is intentionally a no
model/user_session.go:473
↓ 3 callersFunctionRouteParams
RouteParams names the inner router's positional wildcards after the parameters route declares.
pkg/jsplugin/routing.go:666
↓ 3 callersMethodRun
Run runs call.Stage on the instances in scope. It stops at the first rejection or failure of an instance whose plugin is not optional.
relay/requestplugin/plan.go:302
↓ 3 callersFunctionRunCLI
RunCLI implements the `new-api plugin` subcommand: linting a plugin source and replaying a golden fixture against it. It returns a process exit code.
pkg/jsplugin/cli.go:13
↓ 3 callersMethodRuntimeHandler
RuntimeHandler is the inner router built for this exact generation. It is published in the same atomic pointer as the routing indexes.
pkg/jsplugin/routing.go:715
↓ 3 callersFunctionSaveQuotaDataCache
()
model/usedata.go:108
↓ 3 callersFunctionSearchVendors
SearchVendors filters persisted vendor records and counts actual model assignments.
model/vendor_meta.go:103
↓ 3 callersMethodSelectUpdate
()
model/token.go:324
↓ 3 callersMethodSemanticLoss
SemanticLoss builds an error-severity diagnostic for this definition.
relaykit/relayconvert/convmeta/websearch.go:88
↓ 3 callersMethodServesResponsesWebSocket
ServesResponsesWebSocket reports whether a Responses WebSocket session for model may run on the relay routes: the /v1/responses route serving it has n
pkg/jsplugin/registry.go:248
↓ 3 callersMethodSetBackground
(background bool)
relay/plugin_protocol.go:397
↓ 3 callersFunctionSetCodec
SetCodec installs the JSON engine behind every kitutil JSON helper, which also covers the custom (Un)MarshalJSON methods on relaykit DTOs. Like SetLog
relaykit/relayconvert/kitutil/json.go:51
↓ 3 callersFunctionSetDashboardRouter
(router *gin.Engine)
router/dashboard.go:10
↓ 3 callersFunctionSetParamOverrideFunc
SetParamOverrideFunc sets the function utils.paramOverride calls; nil removes it.
pkg/jsplugin/transform.go:603
↓ 3 callersMethodSetReasoningContent
(s string)
relaykit/dto/openai_response.go:122
↓ 3 callersFunctionSetScheduledChannelKeyStatus
SetScheduledChannelKeyStatus applies an automatic status transition to the stored key. Call it only inside UpdateScheduledChannelLocked, after locatin
model/channel_plugin_credential.go:350
↓ 3 callersMethodSetStringContent
(content string)
relaykit/dto/claude.go:178
↓ 3 callersMethodSetStringContent
(content string)
relaykit/dto/openai_request.go:724
↓ 3 callersFunctionSetTaskPluginEnabled
(key string, enabled bool)
model/task_plugin.go:270
↓ 3 callersMethodSetText
(s string)
relaykit/dto/claude.go:53
↓ 3 callersMethodSetTools
(tools []GeminiChatTool)
relaykit/dto/gemini.go:203
↓ 3 callersFunctionSetUnloadedPlugins
SetUnloadedPlugins publishes what the plugin sync found: the enabled, active plugins it could not load, with their load errors.
relay/requestplugin/plan.go:112
↓ 3 callersFunctionSetUserAuthVersionFence
SetUserAuthVersionFence publishes a fail-closed version before a restrictive database update. Pending fences expire only after every pre-existing user
model/user_auth_cache.go:136
↓ 3 callersMethodSettle
Settle 根据差额调整资金来源(正数补扣,负数退还)
service/funding_source.go:21
↓ 3 callersFunctionSetupLogger
()
logger/logger.go:42
↓ 3 callersMethodSetupRequestHeader
(c *gin.Context, header *http.Header, info *relaycommon.RelayInfo)
relay/channel/advancedcustom/adaptor.go:257
↓ 3 callersFunctionShouldDisableChannel
(err *types.NewAPIError)
service/channel.go:65
↓ 3 callersFunctionShouldRetryByStatusCode
(code int)
setting/operation_setting/status_code_ranges.go:80
↓ 3 callersFunctionSmokeTestExpr
--------------------------------------------------------------------------- Smoke test (called externally for validation before save) ----------------
setting/billing_setting/tiered_billing.go:204
↓ 3 callersFunctionSocketIngress
SocketIngress takes the execution plan of one Responses WebSocket response.create and runs the ingress stage on its stored body, as Ingress does for a
relay/requestplugin/socket.go:40
↓ 3 callersFunctionStartTwoFASetup
(identity AuthIdentity, authorization *model.AuthFlowAuthorization)
service/twofa.go:19
↓ 3 callersFunctionStateFromIntent
StateFromIntent copies the portable fields of an intent into conversion state. Empty intents produce nil so callers can omit the field.
relaykit/relayconvert/reasoning/intent.go:112
↓ 3 callersFunctionStreamResponseOpenAI2Claude
(openAIResponse *dto.ChatCompletionsStreamResponse, info convmeta.Meta)
relaykit/relayconvert/response_compat.go:42
↓ 3 callersFunctionStringsContains
(strs []string, str string)
common/str.go:85
↓ 3 callersMethodSupplementResponseOutput
(resp *dto.OpenAIResponsesResponse)
relaykit/relayconvert/internal/oai_responses/to_oai_chat_stream_resp.go:758
↓ 3 callersFunctionSupportedLanguages
SupportedLanguages returns a list of supported language codes
i18n/i18n.go:209
↓ 3 callersMethodSupportsUpstream
SupportsUpstream reports whether the driver handles channels of the given upstream kind. The vendor kind is implied for every plugin.
pkg/jsplugin/registry.go:296
↓ 3 callersMethodSuppressesRetry
()
dto/channel_constraints.go:118
↓ 3 callersFunctionSyncTaskPluginsOnce
()
controller/task_plugin.go:1188
↓ 3 callersFunctionSyncTaskTopic
SyncTaskTopic returns the topic of a sync task type.
model/system_sync_task.go:34
↓ 3 callersFunctionTaskAttempt
TaskAttempt runs the late ingress hooks of a task or Midjourney submission attempt on the client body, before the attempt validates and prices it: tho
relay/requestplugin/relay.go:127
↓ 3 callersFunctionTaskBulkUpdateByID
TaskBulkUpdateByID performs an unconditional bulk UPDATE by primary key IDs. WARNING: This function has NO CAS (Compare-And-Swap) guard — it will over
model/task.go:603
↓ 3 callersFunctionTaskExprCompatible
TaskExprCompatible checks the schema contract even for usage references in branches that the current request would not evaluate. Chat request quantiti
setting/billing_setting/tiered_billing.go:136
↓ 3 callersFunctionTaskGetAllUserTask
(userId int, startIdx int, num int, queryParams SyncTaskQueryParams)
model/task.go:316
↓ 3 callersMethodTaskIDInQuery
TaskIDInQuery reports whether a query route reads its task id from the query string, as the MiniMax v1 query does (?task_id=): the route's path has no
pkg/jsplugin/routing.go:980
↓ 3 callersFunctionTaskModel2Dto
(task *model.Task)
relay/relay_task.go:695
↓ 3 callersMethodTaskPluginBindings
TaskPluginBindings returns the sorted, de-duplicated set of task plugins the channel binds through either field, so callers can compare bindings as a
relaykit/dto/channel_settings.go:55
↓ 3 callersFunctionTaskPluginEndpointOnly
TaskPluginEndpointOnly applies middleware only after a shared endpoint has been claimed. This preserves the original middleware chain for unclaimed vi
middleware/task_plugin.go:745
↓ 3 callersMethodTerminal
Terminal checks the event that ends the response and returns it as the client gets it, for the session to send; the events released before it go out f
relay/requestplugin/socket.go:108
↓ 3 callersMethodToString
()
relay/common/relay_info.go:378
↓ 3 callersFunctionTokenAuthReadOnly
TokenAuthReadOnly 宽松版本的令牌认证中间件,用于只读查询接口。 只验证令牌 key 是否存在,不检查过期时间和额度。 即使令牌已过期或已耗尽,也允许访问;已禁用的令牌会被拒绝。 仍然检查令牌 IP 白名单和用户是否被封禁。
middleware/auth.go:459
↓ 3 callersFunctionTokenOrTaskArtifactAccessAuth
TokenOrTaskArtifactAccessAuth accepts the normal relay API Bearer token or a route-bound capability. Capabilities are verified before any database rea
middleware/task_artifact_access.go:174
↓ 3 callersFunctionTopupGroupRatio2JSONString
()
common/topup-ratio.go:15
↓ 3 callersMethodTryLock
()
controller/user.go:1258
↓ 3 callersMethodUpdate
()
model/model_meta.go:261
↓ 3 callersFunctionUpdateAuthFlowPayload
UpdateAuthFlowPayload replaces the payload of an unconsumed, unexpired flow only while it still holds expected, so of two concurrent submits of one st
model/auth_flow.go:293
↓ 3 callersFunctionUpdateChannel
(c *gin.Context)
controller/channel.go:1214
↓ 3 callersFunctionUpdateChannelBalanceDetail
UpdateChannelBalanceDetail stores a balance query of a channel. update gets the stored detail, nil before the first query, and returns the detail to s
model/channel_balance.go:45
↓ 3 callersFunctionUpdateChannelOtherInfo
UpdateChannelOtherInfo runs update on the stored channel and writes the other_info it leaves, with the columns update returns, only while the stored o
model/channel.go:381
↓ 3 callersFunctionUpdateCompletionRatioByJSONString
(jsonStr string)
setting/ratio_setting/model_ratio.go:432
↓ 3 callersFunctionUpdatePendingTopUpStatus
(tradeNo string, expectedPaymentProvider string, targetStatus string)
model/topup.go:146
↓ 3 callersFunctionUpdateRequestPolicyOptions
UpdateRequestPolicyOptions validates the entire resulting policy before any write. Unknown JSON rule fields stay in the original option string.
model/request_policy.go:211
↓ 3 callersFunctionUpdateToken
(c *gin.Context)
controller/token.go:402
↓ 3 callersFunctionUpdateTopupGroupRatioByJSONString
(jsonStr string)
common/topup-ratio.go:25
↓ 3 callersFunctionUpdateUserBindColumn
UpdateUserBindColumn 第三方账号绑定字段的专用更新。 绑定操作必须只写绑定列:若改为“读取完整用户 → 改一个字段 → 整体更新”, 读快照期间并发发生的封禁、降权或分组变更会被旧快照覆盖恢复。 角色、状态、分组只允许通过各自带锁/CAS 的专用方法修改。
model/user.go:214
↓ 3 callersMethodUpdateWithTx
(tx *gorm.DB, updatePassword bool)
model/user.go:809
↓ 3 callersFunctionUpsertSystemInstance
(nodeName string, info any, startedAt int64, lastSeenAt int64)
model/system_instance.go:46
↓ 3 callersFunctionUsageFromResponsesUsage
(src *dto.Usage)
relaykit/relayconvert/response_compat.go:180
← previousnext →2,301–2,400 of 15,409, ranked by callers