Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/QuantumNous/new-api
/ functions
Functions
10,602 in github.com/QuantumNous/new-api
⨍
Functions
10,602
◇
Types & classes
1,425
↓ 20 callers
Function
lockForUpdate
lockForUpdate makes the next query emit SELECT ... FOR UPDATE so the matched rows stay locked until the surrounding transaction ends. GORM v2 silentl
model/locking.go:20
↓ 20 callers
Function
recordManageAudit
recordManageAudit 记录一条由操作者本人归属的管理/高危审计日志(资源类操作: 渠道 / 系统设置 / 兑换码等)。content 由 action+params 自动渲染。
controller/audit.go:93
↓ 19 callers
Function
CreateSystemTask
(taskType string, payload any, state any)
model/system_task.go:92
↓ 19 callers
Method
Error
Error lets the same typed value serve both as the settlement audit marker and as the fail-fast error returned by strict pre-consume conversions.
common/quota_math.go:42
↓ 19 callers
Method
Exists
(prefix string, path string)
common/embed-file-system.go:18
↓ 19 callers
Function
advancedCustomRelayInfo
(config *dto.AdvancedCustomConfig)
relay/channel/advancedcustom/adaptor_test.go:651
↓ 19 callers
Function
compareObjects
(oldObject, newObject)
web/classic/src/helpers/utils.jsx:314
↓ 19 callers
Function
getCurrencyConfig
()
web/classic/src/helpers/render.jsx:1087
↓ 18 callers
Method
AddOtherRatio
(key string, ratio float64)
types/price_data.go:35
↓ 18 callers
Function
GetEnvOrDefault
(env string, defaultValue int)
common/env.go:9
↓ 18 callers
Method
SetItems
(items any)
common/page_info.go:37
↓ 18 callers
Method
SetTotal
(total int)
common/page_info.go:33
↓ 18 callers
Function
TaskErrorWrapper
(err error, code string, statusCode int)
service/error.go:193
↓ 18 callers
Function
UnmarshalBodyReusable
(c *gin.Context, v any)
common/gin.go:108
↓ 18 callers
Function
safeJsonParseWithValidation
( value: string | undefined | null, options: SafeJsonParseWithValidationOptions<T> )
web/default/src/features/system-settings/utils/json-parser.ts:141
↓ 18 callers
Function
useChannels
()
web/default/src/features/channels/components/channels-provider.tsx:145
↓ 17 callers
Method
Copy
()
dto/openai_response.go:186
↓ 17 callers
Method
Done
Done signals that the handler has finished processing normally (e.g., Dify "message_end"). The stream stops after this chunk.
relay/helper/stream_result.go:39
↓ 17 callers
Method
Write
(b []byte)
middleware/audit.go:24
↓ 17 callers
Function
makeTask
(userId, channelId, quota, tokenId int, billingSource string, subscriptionId int)
service/task_billing_test.go:118
↓ 17 callers
Function
stringToColor
(str)
web/classic/src/helpers/render.jsx:729
↓ 16 callers
Function
NewOpenAIVideo
()
dto/openai_video.go:43
↓ 16 callers
Method
ParseContent
()
dto/claude.go:169
↓ 16 callers
Method
ParseToolCalls
()
dto/openai_request.go:465
↓ 16 callers
Method
Stop
Stop records a fatal error and marks the stream to stop after this chunk.
relay/helper/stream_result.go:29
↓ 16 callers
Function
calculateTextQuotaSummary
calculateTextQuotaSummary expects a usage already remapped by effectiveBillingUsage; PostTextConsumeQuota performs that remap once and shares the resu
service/text_quota.go:181
↓ 16 callers
Function
getCurrencyDisplay
()
web/default/src/lib/currency.ts:345
↓ 16 callers
Function
seedUser
(t *testing.T, id int, quota int)
service/task_billing_test.go:78
↓ 16 callers
Function
setupStreamTest
(t *testing.T, body io.Reader)
relay/helper/stream_scanner_test.go:31
↓ 16 callers
Function
sideDrawerContentClassName
(className?: string)
web/default/src/components/drawer-layout.ts:24
↓ 16 callers
Function
updateOptions
(options)
web/classic/src/components/settings/SystemSetting.jsx:245
↓ 16 callers
Function
useCopyToClipboard
(options?: UseCopyToClipboardOptions)
web/default/src/hooks/use-copy-to-clipboard.ts:36
↓ 15 callers
Method
DoResponse
(c *gin.Context, resp *http.Response, info *relaycommon.RelayInfo)
relay/channel/adapter.go:27
↓ 15 callers
Method
Error
Error records a soft error. The stream continues processing. Can be called multiple times per chunk.
relay/helper/stream_result.go:21
↓ 15 callers
Function
FinishSystemTask
(taskID string, lockedBy string, status SystemTaskStatus, resultPayload any, errorMessage string)
model/system_task.go:383
↓ 15 callers
Function
GetHttpClient
GetHttpClient returns the general outbound client used by relay/provider integrations. Do not attach the SSRF-protected dialer here: provider base URL
service/http_client.go:90
↓ 15 callers
Function
NormalizeEmail
(email string)
model/user.go:204
↓ 15 callers
Method
OtherRatios
()
types/price_data.go:58
↓ 15 callers
Function
RelayErrorHandler
(ctx context.Context, resp *http.Response, showBodyWhenFail bool)
service/error.go:86
↓ 15 callers
Method
Seek
(offset int64, whence int)
common/body_storage.go:178
↓ 15 callers
Method
Update
(updatePassword bool)
model/user.go:647
↓ 15 callers
Method
Validate
()
dto/channel_settings.go:301
↓ 15 callers
Method
WriteString
(s string)
relay/channel/openai/image_stream_test.go:196
↓ 15 callers
Method
resolve
(c *gin.Context, info *relaycommon.RelayInfo)
relay/channel/advancedcustom/adaptor.go:305
↓ 14 callers
Function
ClaimSystemTask
(id int64, taskType string, runnerID string, lockUntil int64)
model/system_task.go:225
↓ 14 callers
Function
ConvertRequest
(c *gin.Context, info *relaycommon.RelayInfo, target types.RelayFormat, request any)
service/relayconvert/request_registry.go:151
↓ 14 callers
Method
GetOtherSettings
()
model/channel.go:990
↓ 14 callers
Function
GetQuotaDisplayType
GetQuotaDisplayType 返回额度展示类型
setting/operation_setting/general_setting.go:55
↓ 14 callers
Method
InitChannelMeta
(c *gin.Context)
relay/common/relay_info.go:196
↓ 14 callers
Function
SetEventStreamHeaders
(c *gin.Context)
relay/helper/common.go:45
↓ 14 callers
Function
UnmarshalJsonStr
(data string, v any)
common/json.go:13
↓ 14 callers
Function
getIoEnterpriseClient
(c *gin.Context)
controller/deployment.go:50
↓ 14 callers
Function
getUserQuota
--------------------------------------------------------------------------- Read-back helpers --------------------------------------------------------
service/task_billing_test.go:245
↓ 14 callers
Function
setOperationLoading
(operation, deploymentId, isLoading)
web/classic/src/hooks/model-deployments/useEnhancedDeploymentActions.jsx:27
↓ 14 callers
Function
sideDrawerFormClassName
(className?: string)
web/default/src/components/drawer-layout.ts:36
↓ 14 callers
Function
sideDrawerHeaderClassName
(className?: string)
web/default/src/components/drawer-layout.ts:30
↓ 14 callers
Function
useDataTable
(options: UseDataTableOptions<TData>)
web/default/src/components/data-table/hooks/use-data-table.ts:277
↓ 13 callers
Function
ComputeTieredQuota
ComputeTieredQuota runs the Expr from a frozen BillingSnapshot against actual token counts and returns the settlement result.
pkg/billingexpr/settle.go:17
↓ 13 callers
Function
ConvertResponse
(c *gin.Context, info *relaycommon.RelayInfo, target types.RelayFormat, response any)
service/relayconvert/response_registry.go:204
↓ 13 callers
Method
DoRequest
(c *gin.Context, info *relaycommon.RelayInfo, requestBody io.Reader)
relay/channel/adapter.go:26
↓ 13 callers
Method
Encode
(v V)
pkg/cachex/codec.go:11
↓ 13 callers
Function
GetAdaptor
(apiType int)
relay/relay_adaptor.go:54
↓ 13 callers
Function
GetHttpClientWithProxy
GetHttpClientWithProxy returns the default client or a proxy-enabled one when proxyURL is provided.
service/http_client.go:104
↓ 13 callers
Function
GetJsonType
(data json.RawMessage)
common/json.go:25
↓ 13 callers
Method
GetUpstreamTaskID
GetUpstreamTaskID 获取上游真实 task ID(用于与 provider 通信) 旧数据没有 UpstreamTaskID 时,TaskID 本身就是上游 ID
model/task.go:123
↓ 13 callers
Function
GetUserCache
GetUserCache gets complete user cache from hash
model/user_cache.go:101
↓ 13 callers
Function
ResetStatusCode
(newApiErr *types.NewAPIError, statusCodeMappingStr string)
service/error.go:133
↓ 13 callers
Function
close
()
web/default/src/features/channels/components/dialogs/ollama-models-dialog.tsx:364
↓ 13 callers
Function
normalizeAdvancedCustomConfig
( config: AdvancedCustomConfig )
web/default/src/features/channels/lib/advanced-custom.ts:486
↓ 13 callers
Function
normalizeModelNames
(models []string)
controller/channel_upstream_update.go:93
↓ 13 callers
Function
seedChannel
(t *testing.T, id int)
service/task_billing_test.go:112
↓ 13 callers
Function
toBoolean
(value)
web/classic/src/helpers/boolean.js:20
↓ 12 callers
Function
CacheGetChannel
(id int)
model/channel_cache.go:239
↓ 12 callers
Function
CloneBillingUsage
(usage *BillingUsage)
dto/billing_usage.go:138
↓ 12 callers
Function
DecodeJson
(reader io.Reader, v any)
common/json.go:17
↓ 12 callers
Function
FormatMatchingModelName
转换模型名,减少渠道必须配置各种带参数模型
setting/ratio_setting/model_ratio.go:719
↓ 12 callers
Function
FormatQuota
(quota int)
logger/logger.go:149
↓ 12 callers
Function
GetGlobalSettings
()
setting/model_setting/global.go:62
↓ 12 callers
Function
GetTwoFAByUserId
GetTwoFAByUserId 根据用户ID获取2FA设置
model/twofa.go:39
↓ 12 callers
Function
IncreaseUserQuota
(id int, quota int, db bool)
model/user.go:1053
↓ 12 callers
Function
RecordLog
(userId int, logType int, content string)
model/log.go:144
↓ 12 callers
Method
SetContentString
(s string)
dto/openai_response.go:96
↓ 12 callers
Function
SetContextKey
(c *gin.Context, key constant.ContextKey, value any)
common/gin.go:157
↓ 12 callers
Method
SetToolCalls
(toolCalls any)
dto/openai_request.go:476
↓ 12 callers
Function
buildSSEBody
(n int)
relay/helper/stream_scanner_test.go:49
↓ 12 callers
Function
getLobeIcon
( iconName: string | undefined | null, size: number = 20 )
web/default/src/lib/lobe-icon.tsx:75
↓ 12 callers
Function
hasValue
(value)
web/classic/src/pages/Setting/Ratio/hooks/useModelPricingEditorState.js:59
↓ 12 callers
Function
makeRelayInfo
(expr string, groupRatio float64, estPrompt, estCompletion int)
service/tiered_settle_test.go:40
↓ 11 callers
Function
Can
Can reports whether the subject may perform the permission. A superuser role short-circuits to allow. Otherwise a per-user override wins, then the uni
service/authz/resolver.go:8
↓ 11 callers
Method
GetContentString
()
dto/openai_response.go:100
↓ 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
GetGeminiSettings
GetGeminiSettings 获取Gemini配置
setting/model_setting/gemini.go:49
↓ 11 callers
Method
GetMaxTokens
()
dto/openai_request.go:260
↓ 11 callers
Function
GetPointer
(v T)
common/utils.go:302
↓ 11 callers
Function
GetPricing
()
model/pricing.go:66
↓ 11 callers
Function
GetRandomString
(length int)
common/str.go:41
↓ 11 callers
Function
GetResponseBody
(method, url string, channel *model.Channel, headers http.Header)
controller/channel-billing.go:139
↓ 11 callers
Function
ModelMappedHelper
(c *gin.Context, info *common.RelayInfo, request dto.Request)
relay/helper/model_mapped.go:16
↓ 11 callers
Function
NewClaudeMessagesBillingUsage
(usage *ClaudeUsage)
dto/billing_usage.go:23
↓ 11 callers
Function
ObjectData
(c *gin.Context, object interface{})
relay/helper/common.go:125
← previous
next →
101–200 of 10,602, ranked by callers