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
↓ 3 callers
Function
NewGeminiToChatStreamState
(id string, created int64)
relaykit/relayconvert/internal/gemini_chat/to_oai_chat_resp.go:342
↓ 3 callers
Function
NewNotify
(t string, title string, content string, values []any)
relaykit/dto/notify.go:18
↓ 3 callers
Function
NewResponsesBufferedAccumulator
()
relaykit/relayconvert/internal/oai_responses/to_oai_chat_stream_resp.go:672
↓ 3 callers
Function
NewSSRFProtectionFromFetchSetting
NewSSRFProtectionFromFetchSetting builds an SSRFProtection from persisted fetch_setting values.
common/ssrf_protection.go:34
↓ 3 callers
Function
NewTelegramProvider
NewTelegramProvider shares the HTTP client with a long-lived, cached JWKS verifier. Tests can exercise the real protocol using a local HTTP transport.
oauth/telegram.go:93
↓ 3 callers
Method
NormalizeDefaults
()
model/subscription.go:216
↓ 3 callers
Function
NormalizeGeminiThinkingConfig
NormalizeGeminiThinkingConfig rewrites a provider-native thinkingConfig in place into the dialect the target model accepts: budgets become levels on G
relaykit/relayconvert/reasoning/gemini.go:251
↓ 3 callers
Function
NormalizeHTTPTransportPolicy
NormalizeHTTPTransportPolicy converts channel settings into a safe runtime policy. Invalid stored values never panic; they clamp to defaults and warn
service/http_transport_policy.go:33
↓ 3 callers
Function
NormalizeOrigin
NormalizeOrigin validates and canonicalizes a browser origin. Only an exact scheme/host/effective-port match is meaningful; paths and wildcards are no
common/session_cookie.go:14
↓ 3 callers
Function
NormalizeViolationFeeError
NormalizeViolationFeeError ensures: - if the CSAM marker is present, error.code is set to a stable violation-fee code and skip-retry is enabled. - if
service/violation_fee.go:56
↓ 3 callers
Function
NotifyUser
(userId int, userEmail string, userSetting dto.UserSetting, data dto.Notify)
service/user_notify.go:68
↓ 3 callers
Function
OaiChatToResponsesStreamHandler
(c *gin.Context, info *relaycommon.RelayInfo, resp *http.Response)
relay/channel/openai/responses_via_chat.go:66
↓ 3 callers
Function
OaiResponsesCompactionHandler
(c *gin.Context, resp *http.Response)
relay/channel/openai/relay_responses_compact.go:15
↓ 3 callers
Function
OaiResponsesToChatBufferedStreamHandler
(c *gin.Context, info *relaycommon.RelayInfo, resp *http.Response)
relay/channel/openai/chat_via_responses.go:58
↓ 3 callers
Function
OaiResponsesToChatStreamHandler
(c *gin.Context, info *relaycommon.RelayInfo, resp *http.Response)
relay/channel/openai/chat_via_responses.go:172
↓ 3 callers
Method
Observe
Observe records one completed final image output when billable. outputIndex may be nil; when set and nonnegative it participates in dedup.
relay/common/tool_usage.go:145
↓ 3 callers
Function
ObserveResponsesOutcome
ObserveResponsesOutcome records the protocol outcome of one Responses event on the stream status for health classification. Only codes and types are k
service/responses_usage.go:121
↓ 3 callers
Function
OpenAIChatRequestToClaudeMessages
(c context.Context, info convmeta.Meta, textRequest dto.GeneralOpenAIRequest)
relaykit/relayconvert/internal/oai_chat/to_claude_messages_req.go:19
↓ 3 callers
Method
OutcomeSnapshot
()
relay/common/stream_status.go:173
↓ 3 callers
Function
OverBodyLimit
OverBodyLimit reports whether a body is larger than MAX_REQUEST_BODY_MB, the limit a client body is read with.
relay/requestplugin/relay.go:282
↓ 3 callers
Function
ParseAcceptLanguage
ParseAcceptLanguage returns the first language of an Accept-Language header, or "" when the header is absent or states no preference ("*").
i18n/i18n.go:179
↓ 3 callers
Method
ParseContent
()
relaykit/dto/openai_request.go:745
↓ 3 callers
Function
ParseCredential
ParseCredential reads one channel key line as a plugin credential. Any other line is a static key.
pluginkit/provider.go:72
↓ 3 callers
Function
ParseModelModifiers
ParseModelModifiers removes only a contiguous trailing chain of @key:value segments. Other @ characters remain part of the opaque model name.
relaykit/relayconvert/reasoning/suffix.go:41
↓ 3 callers
Function
ParseProxyURLRuntime
ParseProxyURLRuntime validates and normalizes a proxy URL for runtime use. The boolean result reports whether a legacy path, query, or fragment was re
common/proxy_url.go:19
↓ 3 callers
Function
PasswordEncryptionPublicKey
PasswordEncryptionPublicKey returns the active key identifier and SPKI PEM public key exposed to browser clients.
common/password_crypto.go:92
↓ 3 callers
Method
PendingResponse
PendingResponse is the host-synthesized non-terminal Responses snapshot. Callers must pass a non-terminal task status; completed/failed/incomplete inp
relay/plugin_protocol.go:404
↓ 3 callers
Function
PingData
(c *gin.Context)
relay/helper/common.go:269
↓ 3 callers
Function
PluginLoginNeededStatus
PluginLoginNeededStatus marks a new task plugin channel that has no credential yet as disabled until a login stores one.
service/provider_plugin_login.go:743
↓ 3 callers
Function
PostConsumeQuota
(relayInfo *relaycommon.RelayInfo, quota int, preConsumedQuota int, sendEmail bool)
service/quota.go:435
↓ 3 callers
Function
PrepareImageBillingForRequest
PrepareImageBillingForRequest reserves the effective outbound image quantity before each attempt, including channel retries and parameter overrides. T
service/image_billing.go:19
↓ 3 callers
Function
PreviewModelPricing
PreviewModelPricing resolves a complete editable draft using the same defaults as the saved-price display and conversion. It has no write side effects
model/model_pricing_config.go:227
↓ 3 callers
Function
ProcessChannelError
(c *gin.Context, channelError types.ChannelError, err *types.NewAPIError, relayInfo *relaycommon.RelayInfo)
service/relay_error.go:63
↓ 3 callers
Function
PublishCloseChannels
(ctx context.Context, channelIDs []int, reason string)
pkg/wsmanager/wsmanager.go:130
↓ 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
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
RegisterVerificationCodeWithKey
(key string, code string, purpose string)
common/verification.go:36
↓ 3 callers
Method
RelayConfig
RelayConfig returns the relay routes as the Advanced Custom configuration of one request. A plugin-converter route reaches the Advanced Custom code as
pluginkit/meta.go:178
↓ 3 callers
Method
RelayRouteDefault
RelayRouteDefault reports whether a channel that has not switched route index serves it: false only for a route declared default_enabled: false.
pluginkit/meta.go:208
↓ 3 callers
Function
RelayRouteKey
RelayRouteKey names a relay route in a channel's plugin_routes: its incoming_path, followed by "|" and its models joined with "," when it lists models
pluginkit/meta.go:198
↓ 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
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:1547
↓ 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:300
↓ 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:350
↓ 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
Function
RunTaskPollingOnce
RunTaskPollingOnce performs one async-task (Suno/video) polling pass synchronously. It honors ctx cancellation (the system-task runner cancels it when
service/task_polling.go:164
↓ 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:349
↓ 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
SetBackground
(background bool)
relay/plugin_protocol.go:397
↓ 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:354
↓ 3 callers
Method
SetStringContent
(content string)
relaykit/dto/claude.go:178
↓ 3 callers
Method
SetStringContent
(content string)
relaykit/dto/openai_request.go:727
↓ 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:116
↓ 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
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
SplitProviderConverter
SplitProviderConverter returns the converter the host runs for a route converter and whether the plugin's convert hooks run too: "plugin" is "none" wi
pluginkit/meta.go:152
↓ 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
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.
pluginkit/meta.go:385
← previous
next →
2,301–2,400 of 15,592, ranked by callers