Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
phsl
/
new-api
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Unverified
Commit
48b7f491
authored
Jul 07, 2026
by
CaIon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix(billing): adjust quota calculation to prevent exceeding int32 limits
parent
9b93d61b
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
2 deletions
+7
-2
service/text_quota.go
+7
-2
No files found.
service/text_quota.go
View file @
48b7f491
...
...
@@ -165,9 +165,14 @@ func composeTieredTextQuota(relayInfo *relaycommon.RelayInfo, summary textQuotaS
}
}
surcharge
,
clamp
:=
common
.
QuotaFromDecimalChecked
(
summary
.
ToolCallSurchargeQuota
)
// Saturate the final sum, not just the surcharge: tieredQuota can be near
// MaxQuota and adding the surcharge could push the total past the int32
// quota policy bound (persisted quota columns are 32-bit).
total
,
clamp
:=
common
.
QuotaFromDecimalChecked
(
decimal
.
NewFromInt
(
int64
(
tieredQuota
))
.
Add
(
summary
.
ToolCallSurchargeQuota
),
)
noteQuotaClamp
(
relayInfo
,
clamp
)
return
t
ieredQuota
+
surcharge
return
t
otal
}
func
calculateTextQuotaSummary
(
ctx
*
gin
.
Context
,
relayInfo
*
relaycommon
.
RelayInfo
,
usage
*
dto
.
Usage
)
textQuotaSummary
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment