Skip to content

AI Answer stops working on 23 October: the gpt-3.5-turbo default shuts down, and its replacement rejects max_tokens #402

Description

@Lakshya-0910

When no model is set, the AI Answer pipeline stage and the OpenAI plugin default to gpt-3.5-turbo with 300 max tokens (plugins/pipelines/ai_answer.go:109-122, plugins/openai/util.go:30-32). OpenAI shuts down gpt-3.5-turbo on 23 October 2026 and names gpt-5.6-terra. BuildChatGPTBody always sends the limit as max_tokens (plugins/openai/util.go:1267), and terra replies:

Unsupported parameter: 'max_tokens' is not supported with this model. Use 'max_completion_tokens' instead.

The same applies to anyone who sets a gpt-5* model in their config today, since max_tokens is always sent.

Fix — either one (both tested live with your default prompt):

  • One line each: default to gpt-4.1-mini (not retiring; accepts max_tokens) in ai_answer.go:109 and util.go:30.
  • Support the replacement: send the limit as max_completion_tokens for gpt-5* models. With 300, terra answered normally.
 	// If maxTokens is passed, inject it in the request body
 	if maxTokens != nil {
-		requestBodyAsMap["max_tokens"] = *maxTokens
+		if strings.HasPrefix(model, "gpt-5") {
+			requestBodyAsMap["max_completion_tokens"] = *maxTokens
+		} else {
+			requestBodyAsMap["max_tokens"] = *maxTokens
+		}
 	}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions