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
f8c2c78e
authored
Aug 10, 2025
by
creamlike1024
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: update openai websearch price
parent
54f470bc
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
2 deletions
+3
-2
setting/operation_setting/tools.go
+3
-2
No files found.
setting/operation_setting/tools.go
View file @
f8c2c78e
...
@@ -32,11 +32,12 @@ func GetWebSearchPricePerThousand(modelName string, contextSize string) float64
...
@@ -32,11 +32,12 @@ func GetWebSearchPricePerThousand(modelName string, contextSize string) float64
// 确定模型类型
// 确定模型类型
// https://platform.openai.com/docs/pricing Web search 价格按模型类型收费
// https://platform.openai.com/docs/pricing Web search 价格按模型类型收费
// 新版计费规则不再关联 search context size,故在const区域将各size的价格设为一致。
// 新版计费规则不再关联 search context size,故在const区域将各size的价格设为一致。
// gpt-4o and gpt-4.1 models (including mini models) 等模型更贵,o3, o4-mini, o3-pro, and deep research models 等模型更便宜
// gpt-5, gpt-5-mini, gpt-5-nano 和 o 系列模型价格为 10.00 美元/千次调用,产生额外 token 计入 input_tokens
// gpt-4o, gpt-4.1, gpt-4o-mini 和 gpt-4.1-mini 价格为 25.00 美元/千次调用,不产生额外 token
isNormalPriceModel
:=
isNormalPriceModel
:=
strings
.
HasPrefix
(
modelName
,
"o3"
)
||
strings
.
HasPrefix
(
modelName
,
"o3"
)
||
strings
.
HasPrefix
(
modelName
,
"o4"
)
||
strings
.
HasPrefix
(
modelName
,
"o4"
)
||
strings
.
Contains
(
modelName
,
"deep-research
"
)
strings
.
HasPrefix
(
modelName
,
"gpt-5
"
)
var
priceWebSearchPerThousandCalls
float64
var
priceWebSearchPerThousandCalls
float64
if
isNormalPriceModel
{
if
isNormalPriceModel
{
priceWebSearchPerThousandCalls
=
WebSearchPrice
priceWebSearchPerThousandCalls
=
WebSearchPrice
...
...
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