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
+ }
}
When no model is set, the AI Answer pipeline stage and the OpenAI plugin default to
gpt-3.5-turbowith 300 max tokens (plugins/pipelines/ai_answer.go:109-122,plugins/openai/util.go:30-32). OpenAI shuts downgpt-3.5-turboon 23 October 2026 and namesgpt-5.6-terra.BuildChatGPTBodyalways sends the limit asmax_tokens(plugins/openai/util.go:1267), and terra replies:The same applies to anyone who sets a
gpt-5*model in their config today, sincemax_tokensis always sent.Fix — either one (both tested live with your default prompt):
gpt-4.1-mini(not retiring; acceptsmax_tokens) inai_answer.go:109andutil.go:30.max_completion_tokensforgpt-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 + } }