feat: add support for gpt-5 models and adjust temperature settings

- Updated the model list to include various gpt-5 variants.
- Enhanced the ConvertOpenAIRequest function to handle gpt-5 model temperature settings based on specific model prefixes.
- Adjusted default cache and model ratios for new gpt-5 models.
This commit is contained in:
CaIon
2025-08-08 10:43:07 +08:00
parent 77975529fe
commit b843bb8286
4 changed files with 31 additions and 2 deletions

View File

@@ -206,12 +206,21 @@ func (a *Adaptor) ConvertOpenAIRequest(c *gin.Context, info *relaycommon.RelayIn
}
}
}
if strings.HasPrefix(request.Model, "o") {
if strings.HasPrefix(request.Model, "o") || strings.HasPrefix(request.Model, "gpt-5") {
if request.MaxCompletionTokens == 0 && request.MaxTokens != 0 {
request.MaxCompletionTokens = request.MaxTokens
request.MaxTokens = 0
}
request.Temperature = nil
if strings.HasPrefix(request.Model, "o") {
request.Temperature = nil
}
if strings.HasPrefix(request.Model, "gpt-5") {
if request.Model != "gpt-5-chat-latest" {
request.Temperature = nil
}
}
// 转换模型推理力度后缀
effort, originModel := parseReasoningEffortFromModelSuffix(request.Model)

View File

@@ -18,6 +18,9 @@ var ModelList = []string{
"o3-mini-high", "o3-mini-2025-01-31-high",
"o3-mini-low", "o3-mini-2025-01-31-low",
"o3-mini-medium", "o3-mini-2025-01-31-medium",
"gpt-5", "gpt-5-2025-08-07", "gpt-5-chat-latest",
"gpt-5-mini", "gpt-5-mini-2025-08-07",
"gpt-5-nano", "gpt-5-nano-2025-08-07",
"o1", "o1-2024-12-17",
"gpt-4o-audio-preview", "gpt-4o-audio-preview-2024-10-01",
"gpt-4o-realtime-preview", "gpt-4o-realtime-preview-2024-10-01", "gpt-4o-realtime-preview-2024-12-17",