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
9009a572
authored
Nov 15, 2025
by
Seefs
Committed by
GitHub
Nov 15, 2025
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: support gpt-5.1 prompt_cache_retention (#2228)
parent
72402f0d
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
17 deletions
+20
-17
.gitignore
+1
-0
dto/openai_request.go
+19
-17
No files found.
.gitignore
View file @
9009a572
...
...
@@ -16,6 +16,7 @@ new-api
tiktoken_cache
.eslintcache
.gocache
.cache
electron/node_modules
electron/dist
dto/openai_request.go
View file @
9009a572
...
...
@@ -66,10 +66,11 @@ type GeneralOpenAIRequest struct {
// 注意:默认过滤此字段以保护用户隐私,但过滤后可能导致 Codex 无法正常使用
Store
json
.
RawMessage
`json:"store,omitempty"`
// Used by OpenAI to cache responses for similar requests to optimize your cache hit rates. Replaces the user field
PromptCacheKey
string
`json:"prompt_cache_key,omitempty"`
LogitBias
json
.
RawMessage
`json:"logit_bias,omitempty"`
Metadata
json
.
RawMessage
`json:"metadata,omitempty"`
Prediction
json
.
RawMessage
`json:"prediction,omitempty"`
PromptCacheKey
string
`json:"prompt_cache_key,omitempty"`
PromptCacheRetention
json
.
RawMessage
`json:"prompt_cache_retention,omitempty"`
LogitBias
json
.
RawMessage
`json:"logit_bias,omitempty"`
Metadata
json
.
RawMessage
`json:"metadata,omitempty"`
Prediction
json
.
RawMessage
`json:"prediction,omitempty"`
// gemini
ExtraBody
json
.
RawMessage
`json:"extra_body,omitempty"`
//xai
...
...
@@ -798,19 +799,20 @@ type OpenAIResponsesRequest struct {
PreviousResponseID
string
`json:"previous_response_id,omitempty"`
Reasoning
*
Reasoning
`json:"reasoning,omitempty"`
// 服务层级字段,用于指定 API 服务等级。允许透传可能导致实际计费高于预期,默认应过滤
ServiceTier
string
`json:"service_tier,omitempty"`
Store
json
.
RawMessage
`json:"store,omitempty"`
PromptCacheKey
json
.
RawMessage
`json:"prompt_cache_key,omitempty"`
Stream
bool
`json:"stream,omitempty"`
Temperature
float64
`json:"temperature,omitempty"`
Text
json
.
RawMessage
`json:"text,omitempty"`
ToolChoice
json
.
RawMessage
`json:"tool_choice,omitempty"`
Tools
json
.
RawMessage
`json:"tools,omitempty"`
// 需要处理的参数很少,MCP 参数太多不确定,所以用 map
TopP
float64
`json:"top_p,omitempty"`
Truncation
string
`json:"truncation,omitempty"`
User
string
`json:"user,omitempty"`
MaxToolCalls
uint
`json:"max_tool_calls,omitempty"`
Prompt
json
.
RawMessage
`json:"prompt,omitempty"`
ServiceTier
string
`json:"service_tier,omitempty"`
Store
json
.
RawMessage
`json:"store,omitempty"`
PromptCacheKey
json
.
RawMessage
`json:"prompt_cache_key,omitempty"`
PromptCacheRetention
json
.
RawMessage
`json:"prompt_cache_retention,omitempty"`
Stream
bool
`json:"stream,omitempty"`
Temperature
float64
`json:"temperature,omitempty"`
Text
json
.
RawMessage
`json:"text,omitempty"`
ToolChoice
json
.
RawMessage
`json:"tool_choice,omitempty"`
Tools
json
.
RawMessage
`json:"tools,omitempty"`
// 需要处理的参数很少,MCP 参数太多不确定,所以用 map
TopP
float64
`json:"top_p,omitempty"`
Truncation
string
`json:"truncation,omitempty"`
User
string
`json:"user,omitempty"`
MaxToolCalls
uint
`json:"max_tool_calls,omitempty"`
Prompt
json
.
RawMessage
`json:"prompt,omitempty"`
}
func
(
r
*
OpenAIResponsesRequest
)
GetTokenCountMeta
()
*
types
.
TokenCountMeta
{
...
...
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