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
fd3fe7fe
authored
Jul 17, 2025
by
Calcium-Ion
Committed by
GitHub
Jul 17, 2025
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1383 from feitianbubu/pr/fix-gemini-and-claude-completions
fix: usage cost(any) to support claude and gemini
parents
db159451
b1cf5d77
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
2 additions
and
2 deletions
+2
-2
dto/openai_response.go
+1
-1
service/quota.go
+1
-1
No files found.
dto/openai_response.go
View file @
fd3fe7fe
...
...
@@ -182,7 +182,7 @@ type Usage struct {
OutputTokens
int
`json:"output_tokens"`
InputTokensDetails
*
InputTokenDetails
`json:"input_tokens_details"`
// OpenRouter Params
Cost
float64
`json:"cost,omitempty"`
Cost
any
`json:"cost,omitempty"`
}
type
InputTokenDetails
struct
{
...
...
service/quota.go
View file @
fd3fe7fe
...
...
@@ -326,7 +326,7 @@ func CalcOpenRouterCacheCreateTokens(usage dto.Usage, priceData helper.PriceData
promptCacheReadPrice
:=
quotaPrice
*
priceData
.
CacheRatio
completionPrice
:=
quotaPrice
*
priceData
.
CompletionRatio
cost
:=
usage
.
Cost
cost
,
_
:=
usage
.
Cost
.
(
float64
)
totalPromptTokens
:=
float64
(
usage
.
PromptTokens
)
completionTokens
:=
float64
(
usage
.
CompletionTokens
)
promptCacheReadTokens
:=
float64
(
usage
.
PromptTokensDetails
.
CachedTokens
)
...
...
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