Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/QuantumNous/new-api
/ functions
Functions
11,918 in github.com/QuantumNous/new-api
⨍
Functions
11,918
◇
Types & classes
1,792
↓ 12 callers
Function
OptionsOf
OptionsOf returns m's conversion options, or empty defaults when m is nil.
relaykit/relayconvert/convmeta/meta.go:236
↓ 12 callers
Function
RecordAuditLog
RecordAuditLog captures safe request metadata only; raw URLs, query strings, credentials and response/request bodies must never enter this table.
model/audit_log.go:74
↓ 12 callers
Function
RevokeAllUserSessions
(userID int, reason string)
model/user_session.go:716
↓ 12 callers
Method
SetContentString
(s string)
relaykit/dto/openai_response.go:101
↓ 12 callers
Method
SetOtherSettings
(setting dto.ChannelOtherSettings)
model/channel.go:1048
↓ 12 callers
Method
SetToolCalls
(toolCalls any)
relaykit/dto/openai_request.go:564
↓ 12 callers
Function
UpdateUserAccessToken
UpdateUserAccessToken rotates a dashboard personal access token without writing a stale user snapshot back over concurrently updated fields.
model/user.go:146
↓ 12 callers
Method
UpdateWithStatus
UpdateWithStatus performs a conditional UPDATE guarded by fromStatus (CAS). Returns (true, nil) if this caller won the update, (false, nil) if another
model/task.go:533
↓ 12 callers
Method
ValidateRequestAndSetAction
(c *gin.Context, info *relaycommon.RelayInfo)
relay/channel/adapter.go:39
↓ 12 callers
Function
buildSSEBody
(n int)
relay/helper/stream_scanner_test.go:49
↓ 12 callers
Function
genBaseRelayInfo
(c *gin.Context, request dto.Request)
relay/common/relay_info.go:509
↓ 12 callers
Function
getServerErrorMessageKey
(value: unknown)
web/src/lib/server-error-message.ts:93
↓ 12 callers
Function
makeRelayInfo
(expr string, groupRatio float64, estPrompt, estCompletion int)
service/tiered_settle_test.go:45
↓ 12 callers
Function
settleTaskBillingOnComplete
settleTaskBillingOnComplete 任务完成时的统一计费调整。 返回 true 表示用量结算路径已接管最终计费;失败任务仅在返回 false 时补做全额退款。 优先级:1. tiered snapshot → 2. adaptor 调整 → 3. token 重算。 表达式求值
service/task_polling.go:666
↓ 12 callers
Function
setupGenericTaskTest
(t *testing.T)
controller/task_generic_test.go:27
↓ 12 callers
Function
trimmed
(value)
plugins/tasks/doubao/plugin.js:65
↓ 12 callers
Function
useTestSessionSecret
(t *testing.T)
service/auth_token_test.go:14
↓ 11 callers
Function
AsClientError
(err error)
relaykit/relayconvert/reasoning/intent.go:38
↓ 11 callers
Function
BindVerificationOperation
(operation VerificationOperation)
service/security_verification.go:76
↓ 11 callers
Function
Compile
Compile performs upload-time syntax checks and compiles an ESM plugin once. All Sobek-specific module and runtime handling is intentionally kept here.
pkg/jsplugin/engine.go:135
↓ 11 callers
Method
ConversionDiagnostics
()
relay/common/conversion_diagnostics.go:62
↓ 11 callers
Function
ConvertResponse
(c context.Context, info convmeta.Meta, target types.RelayFormat, response any)
relaykit/relayconvert/response_registry.go:231
↓ 11 callers
Method
CountBillableToolCall
CountBillableToolCall is the single entry point for per-call tool billing counts. Built-in call types always count; custom function/tool_use names onl
relay/common/tool_usage.go:24
↓ 11 callers
Function
CreateAuthFlow
(input AuthFlowCreate)
model/auth_flow.go:143
↓ 11 callers
Function
CreateUserSession
(session *UserSession)
model/user_session.go:133
↓ 11 callers
Function
DeleteToolPriceForTest
DeleteToolPriceForTest removes an injected tool price and rebuilds the index. Tests only.
setting/operation_setting/tools.go:231
↓ 11 callers
Method
Error
()
pkg/jsplugin/engine.go:35
↓ 11 callers
Function
GetChannelBaseURL
(channelType int)
constant/channel.go:131
↓ 11 callers
Function
GetDBTimestamp
GetDBTimestamp returns a UNIX timestamp from database time. Falls back to application time on error.
model/db_time.go:7
↓ 11 callers
Function
GetFetchSetting
()
setting/system_setting/fetch_setting.go:32
↓ 11 callers
Function
GetHttpClientWithProxySettings
GetHttpClientWithProxySettings returns a cached HTTP client for the proxy URL and channel transport settings. Default auto + 1 shard shares the same c
service/http_client.go:389
↓ 11 callers
Function
GetMaxTokenAutoGroups
()
setting/auto_group.go:51
↓ 11 callers
Method
GetReasoningContent
()
relaykit/dto/openai_request.go:532
↓ 11 callers
Method
GetText
()
relaykit/dto/claude.go:56
↓ 11 callers
Function
GetTwoFAByUserId
GetTwoFAByUserId 根据用户ID获取2FA设置
model/twofa.go:39
↓ 11 callers
Function
GetUUID
()
relaykit/relayconvert/kitutil/value.go:44
↓ 11 callers
Function
GetUserGroup
GetUserGroup gets group from Redis first, falls back to DB if needed
model/user.go:1276
↓ 11 callers
Method
HasErrors
()
relay/common/stream_status.go:70
↓ 11 callers
Function
IncreaseUserQuota
(id int, quota int, db bool)
model/user.go:1341
↓ 11 callers
Method
IsStringContent
()
relaykit/dto/claude.go:140
↓ 11 callers
Function
NewGeminiChatBillingUsage
(metadata *GeminiUsageMetadata)
relaykit/dto/billing_usage.go:116
↓ 11 callers
Function
ObjectData
(c *gin.Context, object interface{})
relay/helper/common.go:125
↓ 11 callers
Method
RecordConversionDiagnostics
RecordConversionDiagnostics retains conversion losses for the consume log and emits one request-correlated warning per distinct diagnostic. The cap pr
relay/common/conversion_diagnostics.go:25
↓ 11 callers
Method
Render
(w http.ResponseWriter)
common/custom-event.go:72
↓ 11 callers
Method
SetDisabledFactoryKeys
(keys []string)
pkg/jsplugin/registry.go:496
↓ 11 callers
Method
SetEndReason
(reason StreamEndReason, err error)
relay/common/stream_status.go:45
↓ 11 callers
Method
TotalErrorCount
()
relay/common/stream_status.go:79
↓ 11 callers
Method
UpdateBalance
(balance float64)
model/channel.go:615
↓ 11 callers
Function
UpdateChannelUsedQuota
(id int, quota int)
model/channel.go:886
↓ 11 callers
Function
VerifySecurityInput
(identity AuthIdentity, input VerificationInput)
service/security_verification.go:414
↓ 11 callers
Method
WriteString
(s string)
middleware/audit.go:37
↓ 11 callers
Function
cleanupTaskPluginControllerRuntime
(t *testing.T, key string)
controller/task_plugin_test.go:63
↓ 11 callers
Method
close
()
common/email_test.go:97
↓ 11 callers
Method
close
()
web/src/features/playground/hooks/use-stream-request.test.ts:50
↓ 11 callers
Function
decodeAPIResponse
(t *testing.T, recorder *httptest.ResponseRecorder)
controller/token_test.go:214
↓ 11 callers
Method
event
(eventType string, payload dto.ResponsesStreamResponse)
relaykit/relayconvert/internal/oai_chat/to_oai_responses_stream_resp.go:855
↓ 11 callers
Function
formatCurrencyFromUSD
( amountUSD: number | null | undefined, options?: CurrencyFormatOptions )
web/src/lib/currency.ts:408
↓ 11 callers
Function
getUserCacheKey
getUserCacheKey returns the key for user cache
model/user_cache.go:50
↓ 11 callers
Function
newAPIErrorFromParamOverride
(err error)
relay/param_override_error.go:8
↓ 11 callers
Function
normalizeIntent
(intent Intent)
relaykit/relayconvert/reasoning/intent.go:136
↓ 11 callers
Function
registerTestPlugin
(registry *Registry, version string, factory bool)
pkg/jsplugin/registry_test.go:492
↓ 11 callers
Function
requirePaymentCompliance
(c *gin.Context)
controller/payment_compliance.go:22
↓ 11 callers
Function
responseSemanticLoss
(path string, code string, message string)
relaykit/relayconvert/internal/toolconv/response.go:509
↓ 11 callers
Function
setupOriginTaskDB
(t *testing.T)
middleware/task_plugin_origin_task_test.go:28
↓ 11 callers
Function
sideDrawerFooterClassName
(className?: string)
web/src/components/drawer-layout.ts:42
↓ 11 callers
Function
taskProtocolPluginSource
(key, version, models, endpoint, parseRequestBody string)
middleware/task_plugin_test.go:1630
↓ 11 callers
Function
useSidebar
()
web/src/components/ui/sidebar.tsx:67
↓ 11 callers
Function
useTheme
()
web/src/context/theme-provider.tsx:141
↓ 11 callers
Function
withHeaderNavModules
(t *testing.T, raw string)
middleware/header_nav_test.go:17
↓ 11 callers
Function
withSMTPSettings
(t *testing.T)
common/email_test.go:243
↓ 10 callers
Function
AccessTokenAudit
AccessTokenAudit also captures public reads and rejections before route-level authentication (for example, rate limiting). It does not grant authentic
middleware/audit.go:264
↓ 10 callers
Function
AccessTokenFingerprint
(token string)
model/audit_log.go:61
↓ 10 callers
Method
AddPin
(p ChannelPin)
dto/channel_constraints.go:55
↓ 10 callers
Function
ApplyParamOverrideWithRelayInfo
(jsonData []byte, info *RelayInfo)
relay/common/override.go:184
↓ 10 callers
Function
BuildTieredTokenParams
BuildTieredTokenParams constructs billingexpr.TokenParams from a dto.Usage, normalizing P and C so they mean "tokens not separately priced by the expr
service/tiered_settle.go:25
↓ 10 callers
Function
Done
(c *gin.Context)
relay/helper/common.go:136
↓ 10 callers
Function
FlushWriter
(c *gin.Context)
relay/helper/common.go:17
↓ 10 callers
Function
GetAuthHeader
GetAuthHeader get auth header
controller/channel-billing.go:138
↓ 10 callers
Function
GetBillingMode
--------------------------------------------------------------------------- Read accessors (hot path, must be fast) ----------------------------------
setting/billing_setting/tiered_billing.go:46
↓ 10 callers
Method
GetFinalRequestRelayFormat
()
relay/common/relay_info.go:708
↓ 10 callers
Method
GetOriginModelName
()
relaykit/relayconvert/convmeta/meta.go:19
↓ 10 callers
Method
GetRequestURL
(info *relaycommon.RelayInfo)
relay/channel/advancedcustom/adaptor.go:189
↓ 10 callers
Function
GetResponseBody
(method, url string, channel *model.Channel, headers http.Header)
controller/channel-billing.go:152
↓ 10 callers
Function
GetTaskAdaptor
(platform constant.TaskPlatform)
relay/relay_adaptor.go:188
↓ 10 callers
Function
GetTaskPluginVersion
(key, version string)
model/task_plugin.go:95
↓ 10 callers
Method
Keys
Keys returns keys with valid values. In Redis, it returns all matching keys.
pkg/cachex/hybrid_cache.go:132
↓ 10 callers
Method
LoadFromDB
LoadFromDB 从数据库加载配置
setting/config/config.go:42
↓ 10 callers
Function
LockOrder
LockOrder 尝试对给定订单号加锁
controller/topup.go:363
↓ 10 callers
Method
MarshalJSONString
()
types/rw_map.go:94
↓ 10 callers
Function
MergeUsageNonZero
MergeUsageNonZero overlays usage snapshots: a later non-zero field overwrites the current value, while a later zero value never erases an earlier posi
relaykit/dto/usage_merge.go:12
↓ 10 callers
Function
NewOAuthError
NewOAuthError creates a new OAuth error with the given message key
oauth/types.go:46
↓ 10 callers
Function
NewOAuthErrorWithRaw
NewOAuthErrorWithRaw creates a new OAuth error with raw error message for logging
oauth/types.go:54
↓ 10 callers
Function
NewStreamScanner
(reader io.Reader)
relay/helper/stream_scanner.go:43
↓ 10 callers
Function
NewStreamStatus
()
relay/common/stream_status.go:41
↓ 10 callers
Function
PostTextConsumeQuota
(ctx *gin.Context, relayInfo *relaycommon.RelayInfo, usage *dto.Usage, extraContent []string)
service/text_quota.go:397
↓ 10 callers
Method
Read
(p []byte)
common/body_storage.go:196
↓ 10 callers
Function
RebuildToolPriceIndex
RebuildToolPriceIndex rebuilds the lookup index from the current config. Called on init and after config updates. Not on the billing hot path.
setting/operation_setting/tools.go:149
↓ 10 callers
Function
RefundTaskQuota
RefundTaskQuota 统一的任务失败退款逻辑。 当异步任务失败时,退还资金与令牌额度,并回减用户和渠道用量。 返回资金来源是否已成功退还;失败时保留 quota,供显式重试或人工对账。
service/task_billing.go:213
↓ 10 callers
Function
ResponsesRequestToChatCompletionsRequest
(req *dto.OpenAIResponsesRequest)
relaykit/relayconvert/internal/oai_responses/to_oai_chat_req.go:28
↓ 10 callers
Method
SetAdmin
(key string, value any)
model/log_other.go:77
← previous
next →
301–400 of 11,918, ranked by callers