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
Commit
2d226a81
authored
Aug 05, 2025
by
creamlike1024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: responses cache token 未计费
parent
2286ec06
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
3 deletions
+9
-3
relay/channel/openai/relay_responses.go
+1
-0
web/src/helpers/render.js
+7
-3
web/src/hooks/usage-logs/useUsageLogsData.js
+1
-0
No files found.
relay/channel/openai/relay_responses.go
View file @
2d226a81
...
@@ -40,6 +40,7 @@ func OaiResponsesHandler(c *gin.Context, info *relaycommon.RelayInfo, resp *http
...
@@ -40,6 +40,7 @@ func OaiResponsesHandler(c *gin.Context, info *relaycommon.RelayInfo, resp *http
usage
.
PromptTokens
=
responsesResponse
.
Usage
.
InputTokens
usage
.
PromptTokens
=
responsesResponse
.
Usage
.
InputTokens
usage
.
CompletionTokens
=
responsesResponse
.
Usage
.
OutputTokens
usage
.
CompletionTokens
=
responsesResponse
.
Usage
.
OutputTokens
usage
.
TotalTokens
=
responsesResponse
.
Usage
.
TotalTokens
usage
.
TotalTokens
=
responsesResponse
.
Usage
.
TotalTokens
usage
.
PromptTokensDetails
.
CachedTokens
=
responsesResponse
.
Usage
.
InputTokensDetails
.
CachedTokens
// 解析 Tools 用量
// 解析 Tools 用量
for
_
,
tool
:=
range
responsesResponse
.
Tools
{
for
_
,
tool
:=
range
responsesResponse
.
Tools
{
info
.
ResponsesUsageInfo
.
BuiltInTools
[
common
.
Interface2String
(
tool
[
"type"
])]
.
CallCount
++
info
.
ResponsesUsageInfo
.
BuiltInTools
[
common
.
Interface2String
(
tool
[
"type"
])]
.
CallCount
++
...
...
web/src/helpers/render.js
View file @
2d226a81
...
@@ -1156,6 +1156,7 @@ export function renderLogContent(
...
@@ -1156,6 +1156,7 @@ export function renderLogContent(
modelPrice
=
-
1
,
modelPrice
=
-
1
,
groupRatio
,
groupRatio
,
user_group_ratio
,
user_group_ratio
,
cacheRatio
=
1.0
,
image
=
false
,
image
=
false
,
imageRatio
=
1.0
,
imageRatio
=
1.0
,
webSearch
=
false
,
webSearch
=
false
,
...
@@ -1174,9 +1175,10 @@ export function renderLogContent(
...
@@ -1174,9 +1175,10 @@ export function renderLogContent(
}
else
{
}
else
{
if
(
image
)
{
if
(
image
)
{
return
i18next
.
t
(
return
i18next
.
t
(
'模型倍率 {{modelRatio}},输出倍率 {{completionRatio}},图片输入倍率 {{imageRatio}},{{ratioType}} {{ratio}}'
,
'模型倍率 {{modelRatio}},
缓存倍率 {{cacheRatio}},
输出倍率 {{completionRatio}},图片输入倍率 {{imageRatio}},{{ratioType}} {{ratio}}'
,
{
{
modelRatio
:
modelRatio
,
modelRatio
:
modelRatio
,
cacheRatio
:
cacheRatio
,
completionRatio
:
completionRatio
,
completionRatio
:
completionRatio
,
imageRatio
:
imageRatio
,
imageRatio
:
imageRatio
,
ratioType
:
ratioLabel
,
ratioType
:
ratioLabel
,
...
@@ -1185,9 +1187,10 @@ export function renderLogContent(
...
@@ -1185,9 +1187,10 @@ export function renderLogContent(
);
);
}
else
if
(
webSearch
)
{
}
else
if
(
webSearch
)
{
return
i18next
.
t
(
return
i18next
.
t
(
'模型倍率 {{modelRatio}},输出倍率 {{completionRatio}},{{ratioType}} {{ratio}},Web 搜索调用 {{webSearchCallCount}} 次'
,
'模型倍率 {{modelRatio}},
缓存倍率 {{cacheRatio}},
输出倍率 {{completionRatio}},{{ratioType}} {{ratio}},Web 搜索调用 {{webSearchCallCount}} 次'
,
{
{
modelRatio
:
modelRatio
,
modelRatio
:
modelRatio
,
cacheRatio
:
cacheRatio
,
completionRatio
:
completionRatio
,
completionRatio
:
completionRatio
,
ratioType
:
ratioLabel
,
ratioType
:
ratioLabel
,
ratio
,
ratio
,
...
@@ -1196,9 +1199,10 @@ export function renderLogContent(
...
@@ -1196,9 +1199,10 @@ export function renderLogContent(
);
);
}
else
{
}
else
{
return
i18next
.
t
(
return
i18next
.
t
(
'模型倍率 {{modelRatio}},输出倍率 {{completionRatio}},{{ratioType}} {{ratio}}'
,
'模型倍率 {{modelRatio}},
缓存倍率 {{cacheRatio}},
输出倍率 {{completionRatio}},{{ratioType}} {{ratio}}'
,
{
{
modelRatio
:
modelRatio
,
modelRatio
:
modelRatio
,
cacheRatio
:
cacheRatio
,
completionRatio
:
completionRatio
,
completionRatio
:
completionRatio
,
ratioType
:
ratioLabel
,
ratioType
:
ratioLabel
,
ratio
,
ratio
,
...
...
web/src/hooks/usage-logs/useUsageLogsData.js
View file @
2d226a81
...
@@ -366,6 +366,7 @@ export const useLogsData = () => {
...
@@ -366,6 +366,7 @@ export const useLogsData = () => {
other
.
model_price
,
other
.
model_price
,
other
.
group_ratio
,
other
.
group_ratio
,
other
?.
user_group_ratio
,
other
?.
user_group_ratio
,
other
.
cache_ratio
||
1.0
,
false
,
false
,
1.0
,
1.0
,
other
.
web_search
||
false
,
other
.
web_search
||
false
,
...
...
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