fix: also use max_completion_tokens for gpt5 era models (#445)

This commit is contained in:
fipso 2026-02-19 01:29:34 +01:00 committed by GitHub
parent 59fd391248
commit bb0424e1e2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -71,7 +71,7 @@ func (p *Provider) Chat(ctx context.Context, messages []Message, tools []ToolDef
if maxTokens, ok := asInt(options["max_tokens"]); ok {
lowerModel := strings.ToLower(model)
if strings.Contains(lowerModel, "glm") || strings.Contains(lowerModel, "o1") {
if strings.Contains(lowerModel, "glm") || strings.Contains(lowerModel, "o1") || strings.Contains(lowerModel, "gpt-5") {
requestBody["max_completion_tokens"] = maxTokens
} else {
requestBody["max_tokens"] = maxTokens