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
↓ 3 callers
Function
QuotaFromDecimalChecked
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 callers
Function
QuotaFromFloatChecked
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 callers
Function
ReadBodyJSONFields
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 callers
Function
Record
(sample Sample)
pkg/perf_metrics/metrics.go:125
↓ 3 callers
Function
RecordExist
(err error)
model/utils.go:127
↓ 3 callers
Function
RecordMidjourneyPolicyResponse
RecordMidjourneyPolicyResponse distinguishes accepted tasks from errors inside HTTP 200 responses. Submissions are single-attempt: an ambiguous transp
service/midjourney.go:277
↓ 3 callers
Method
RecordRequestInferredToolCall
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 callers
Function
RecordTaskBillingLog
(params RecordTaskBillingLogParams)
model/log.go:430
↓ 3 callers
Function
RedactCredentialLines
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 callers
Function
RefreshCodexChannelCredential
(ctx context.Context, channelID int, opts CodexCredentialRefreshOptions)
service/codex_credential_refresh.go:42
↓ 3 callers
Function
RefreshCodexOAuthTokenWithProxy
(ctx context.Context, refreshToken string, proxyURL string)
service/codex_oauth.go:33
↓ 3 callers
Function
RegisterPasskeyForSession
(identity AuthSessionIdentity, credential *PasskeyCredential)
model/passkey.go:228
↓ 3 callers
Function
RegisterResource
RegisterResource adds a resource definition to the permission registry.
service/authz/registry.go:24
↓ 3 callers
Function
RenderGemini
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 callers
Function
ReplayFixture
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 callers
Method
RequestedImageCount
()
relay/common/relay_info.go:268
↓ 3 callers
Function
RequireLoginVerification
(token, method string)
service/login_verification.go:91
↓ 3 callers
Function
ResolveImageBillingRequestInput
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 callers
Function
ResolveLegacyBillingDetails
(name string, effective, configured PricingValues)
model/model_pricing_conversion.go:64
↓ 3 callers
Function
ResolveOriginTask
ResolveOriginTask 处理基于已有任务的提交(remix / continuation): 查找原始任务、从中提取模型名称、将渠道锁定到原始任务的渠道 (通过 info.LockedChannel,重试时复用同一渠道并轮换 key), 以及提取 OtherRatios(时长、分辨率)。
relay/relay_task.go:50
↓ 3 callers
Function
ResolveTaskPluginForPlatform
(generation *pluginruntime.RoutingGeneration, platform constant.TaskPlatform)
relay/relay_adaptor.go:159
↓ 3 callers
Function
ResolveTaskPluginModel
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 callers
Function
ResponseOpenAI2Claude
(openAIResponse *dto.OpenAITextResponse, info convmeta.Meta)
relaykit/relayconvert/response_compat.go:38
↓ 3 callers
Function
ResponseOpenAI2Claude
(openAIResponse *dto.OpenAITextResponse, info convmeta.Meta)
relaykit/relayconvert/internal/oai_chat/to_claude_messages_resp.go:450
↓ 3 callers
Function
ResponsesCustomToolNames
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 callers
Function
ResponsesSocket
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 callers
Function
ResponsesToolStateOf
ResponsesToolStateOf is a nil-safe reader for Meta.ResponsesToolState.
relaykit/relayconvert/convmeta/meta.go:323
↓ 3 callers
Function
RevokeByRefreshToken
(rawRefreshToken, expectedSID, reason string)
service/auth_session.go:296
↓ 3 callers
Function
RevokeOtherUserSessions
(userID int, currentSID, reason string)
model/user_session.go:726
↓ 3 callers
Function
RevokeRemovedChannelCredentials
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 callers
Function
RevokeUserSessionByRefreshHash
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 callers
Function
RootUserExists
()
model/user.go:1531
↓ 3 callers
Function
RotateUserSessionRefresh
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 callers
Function
RouteParams
RouteParams names the inner router's positional wildcards after the parameters route declares.
pkg/jsplugin/routing.go:666
↓ 3 callers
Method
Run
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 callers
Function
RunCLI
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 callers
Method
RuntimeHandler
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 callers
Function
SaveQuotaDataCache
()
model/usedata.go:108
↓ 3 callers
Function
SearchVendors
SearchVendors filters persisted vendor records and counts actual model assignments.
model/vendor_meta.go:103
↓ 3 callers
Method
SelectUpdate
()
model/token.go:324
↓ 3 callers
Method
SemanticLoss
SemanticLoss builds an error-severity diagnostic for this definition.
relaykit/relayconvert/convmeta/websearch.go:88
↓ 3 callers
Method
ServesResponsesWebSocket
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 callers
Method
SetBackground
(background bool)
relay/plugin_protocol.go:397
↓ 3 callers
Function
SetCodec
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 callers
Function
SetDashboardRouter
(router *gin.Engine)
router/dashboard.go:10
↓ 3 callers
Function
SetParamOverrideFunc
SetParamOverrideFunc sets the function utils.paramOverride calls; nil removes it.
pkg/jsplugin/transform.go:603
↓ 3 callers
Method
SetReasoningContent
(s string)
relaykit/dto/openai_response.go:122
↓ 3 callers
Function
SetScheduledChannelKeyStatus
SetScheduledChannelKeyStatus applies an automatic status transition to the stored key. Call it only inside UpdateScheduledChannelLocked, after locatin
model/channel_plugin_credential.go:350
↓ 3 callers
Method
SetStringContent
(content string)
relaykit/dto/claude.go:178
↓ 3 callers
Method
SetStringContent
(content string)
relaykit/dto/openai_request.go:724
↓ 3 callers
Function
SetTaskPluginEnabled
(key string, enabled bool)
model/task_plugin.go:270
↓ 3 callers
Method
SetText
(s string)
relaykit/dto/claude.go:53
↓ 3 callers
Method
SetTools
(tools []GeminiChatTool)
relaykit/dto/gemini.go:203
↓ 3 callers
Function
SetUnloadedPlugins
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 callers
Function
SetUserAuthVersionFence
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 callers
Method
Settle
Settle 根据差额调整资金来源(正数补扣,负数退还)
service/funding_source.go:21
↓ 3 callers
Function
SetupLogger
()
logger/logger.go:42
↓ 3 callers
Method
SetupRequestHeader
(c *gin.Context, header *http.Header, info *relaycommon.RelayInfo)
relay/channel/advancedcustom/adaptor.go:257
↓ 3 callers
Function
ShouldDisableChannel
(err *types.NewAPIError)
service/channel.go:65
↓ 3 callers
Function
ShouldRetryByStatusCode
(code int)
setting/operation_setting/status_code_ranges.go:80
↓ 3 callers
Function
SmokeTestExpr
--------------------------------------------------------------------------- Smoke test (called externally for validation before save) ----------------
setting/billing_setting/tiered_billing.go:204
↓ 3 callers
Function
SocketIngress
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 callers
Function
StartTwoFASetup
(identity AuthIdentity, authorization *model.AuthFlowAuthorization)
service/twofa.go:19
↓ 3 callers
Function
StateFromIntent
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 callers
Function
StreamResponseOpenAI2Claude
(openAIResponse *dto.ChatCompletionsStreamResponse, info convmeta.Meta)
relaykit/relayconvert/response_compat.go:42
↓ 3 callers
Function
StringsContains
(strs []string, str string)
common/str.go:85
↓ 3 callers
Method
SupplementResponseOutput
(resp *dto.OpenAIResponsesResponse)
relaykit/relayconvert/internal/oai_responses/to_oai_chat_stream_resp.go:758
↓ 3 callers
Function
SupportedLanguages
SupportedLanguages returns a list of supported language codes
i18n/i18n.go:209
↓ 3 callers
Method
SupportsUpstream
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 callers
Method
SuppressesRetry
()
dto/channel_constraints.go:118
↓ 3 callers
Function
SyncTaskPluginsOnce
()
controller/task_plugin.go:1188
↓ 3 callers
Function
SyncTaskTopic
SyncTaskTopic returns the topic of a sync task type.
model/system_sync_task.go:34
↓ 3 callers
Function
TaskAttempt
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 callers
Function
TaskBulkUpdateByID
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 callers
Function
TaskExprCompatible
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 callers
Function
TaskGetAllUserTask
(userId int, startIdx int, num int, queryParams SyncTaskQueryParams)
model/task.go:316
↓ 3 callers
Method
TaskIDInQuery
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 callers
Function
TaskModel2Dto
(task *model.Task)
relay/relay_task.go:695
↓ 3 callers
Method
TaskPluginBindings
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 callers
Function
TaskPluginEndpointOnly
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 callers
Method
Terminal
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 callers
Method
ToString
()
relay/common/relay_info.go:378
↓ 3 callers
Function
TokenAuthReadOnly
TokenAuthReadOnly 宽松版本的令牌认证中间件,用于只读查询接口。 只验证令牌 key 是否存在,不检查过期时间和额度。 即使令牌已过期或已耗尽,也允许访问;已禁用的令牌会被拒绝。 仍然检查令牌 IP 白名单和用户是否被封禁。
middleware/auth.go:459
↓ 3 callers
Function
TokenOrTaskArtifactAccessAuth
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 callers
Function
TopupGroupRatio2JSONString
()
common/topup-ratio.go:15
↓ 3 callers
Method
TryLock
()
controller/user.go:1258
↓ 3 callers
Method
Update
()
model/model_meta.go:261
↓ 3 callers
Function
UpdateAuthFlowPayload
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 callers
Function
UpdateChannel
(c *gin.Context)
controller/channel.go:1214
↓ 3 callers
Function
UpdateChannelBalanceDetail
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 callers
Function
UpdateChannelOtherInfo
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 callers
Function
UpdateCompletionRatioByJSONString
(jsonStr string)
setting/ratio_setting/model_ratio.go:432
↓ 3 callers
Function
UpdatePendingTopUpStatus
(tradeNo string, expectedPaymentProvider string, targetStatus string)
model/topup.go:146
↓ 3 callers
Function
UpdateRequestPolicyOptions
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 callers
Function
UpdateToken
(c *gin.Context)
controller/token.go:402
↓ 3 callers
Function
UpdateTopupGroupRatioByJSONString
(jsonStr string)
common/topup-ratio.go:25
↓ 3 callers
Function
UpdateUserBindColumn
UpdateUserBindColumn 第三方账号绑定字段的专用更新。 绑定操作必须只写绑定列:若改为“读取完整用户 → 改一个字段 → 整体更新”, 读快照期间并发发生的封禁、降权或分组变更会被旧快照覆盖恢复。 角色、状态、分组只允许通过各自带锁/CAS 的专用方法修改。
model/user.go:214
↓ 3 callers
Method
UpdateWithTx
(tx *gorm.DB, updatePassword bool)
model/user.go:809
↓ 3 callers
Function
UpsertSystemInstance
(nodeName string, info any, startedAt int64, lastSeenAt int64)
model/system_instance.go:46
↓ 3 callers
Function
UsageFromResponsesUsage
(src *dto.Usage)
relaykit/relayconvert/response_compat.go:180
← previous
next →
2,301–2,400 of 15,409, ranked by callers