When configuring a gpt-5.1 model using the OpenAI-API-compatible plugin, the following error message appears: "Unsupported parameter: 'max_tokens' is not supported with this model. Use 'max_completion_tokens' instead." #20956

Closed
opened 2026-02-21 20:09:59 -05:00 by yindo · 2 comments
Owner

Originally created by @jiangdailun on GitHub (Dec 10, 2025).

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues search for existing issues, including closed ones.
  • I confirm that I am using English to submit this report, otherwise it will be closed.
  • 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

v1.10.0

Cloud or Self Hosted

Self Hosted (Source)

Steps to reproduce

1.Click OpenAI-API-compatible Add Model

Image 2.After completing the configuration, clicking Add resulted in this error. Image

✔️ Expected Behavior

Add the company's AI platform GPT-5 model

Actual Behavior

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

Originally created by @jiangdailun on GitHub (Dec 10, 2025). ### Self Checks - [x] I have read the [Contributing Guide](https://github.com/langgenius/dify/blob/main/CONTRIBUTING.md) and [Language Policy](https://github.com/langgenius/dify/issues/1542). - [x] This is only for bug report, if you would like to ask a question, please head to [Discussions](https://github.com/langgenius/dify/discussions/categories/general). - [x] I have searched for existing issues [search for existing issues](https://github.com/langgenius/dify/issues), including closed ones. - [x] I confirm that I am using English to submit this report, otherwise it will be closed. - [x] 【中文用户 & Non English User】请使用英语提交,否则会被关闭 :) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version v1.10.0 ### Cloud or Self Hosted Self Hosted (Source) ### Steps to reproduce 1.Click OpenAI-API-compatible Add Model <img width="858" height="144" alt="Image" src="https://github.com/user-attachments/assets/9fdd8a71-6bb1-4916-975d-385eb25ad386" /> 2.After completing the configuration, clicking Add resulted in this error. <img width="1443" height="960" alt="Image" src="https://github.com/user-attachments/assets/a3197062-8d66-4a02-9599-5e75dfee2172" /> ### ✔️ Expected Behavior Add the company's AI platform GPT-5 model ### ❌ Actual Behavior Unsupported parameter: 'max_tokens' is not supported with this model. Use 'max_completion_tokens' instead.
yindo added the 🐞 bug label 2026-02-21 20:09:59 -05:00
yindo closed this issue 2026-02-21 20:09:59 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Dec 10, 2025):

Hi @jiangdailun! I'm Dosu and I’m helping the dify team.

The error happens because newer models like GPT-5.1 require the parameter max_completion_tokens instead of the older max_tokens—OpenAI has deprecated max_tokens for these models, and Dify's OpenAI-API-compatible plugin defaults to the old parameter, causing validation to fail (source, source, source).

To resolve this in Dify v1.10.0:

  • Update your model configuration to use max_completion_tokens instead of max_tokens. If you’re editing YAML or config files for the plugin, replace every instance of max_tokens with max_completion_tokens and restart the service (source).
  • If the UI supports "advanced mode," use it to manually set max_completion_tokens for your model (source).
  • If you still see errors, try using the "OpenAI" provider directly instead of the "OpenAI-API-compatible" provider, which sometimes avoids this parameter issue (source, source).
  • Double-check your API key, model name formatting (no leading /), and model availability—these can also trigger 400 errors (source, source).

Recent Dify updates have improved support for custom parameters, but in v1.10.0, manual config changes are usually required for GPT-5.1 compatibility (source).

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Chat with Dosu Open in Cursor Join Discord Share on X

@dosubot[bot] commented on GitHub (Dec 10, 2025): <!-- Greeting --> Hi @jiangdailun! I'm [Dosu](https://go.dosu.dev/dosubot) and I’m helping the dify team. <!-- Answer --> The error happens because newer models like GPT-5.1 require the parameter `max_completion_tokens` instead of the older `max_tokens`—OpenAI has deprecated `max_tokens` for these models, and Dify's OpenAI-API-compatible plugin defaults to the old parameter, causing validation to fail ([source](https://github.com/langgenius/dify-official-plugins/issues/239), [source](https://github.com/langgenius/dify-official-plugins/issues/1845), [source](https://github.com/langgenius/dify-official-plugins/issues/2118)). To resolve this in Dify v1.10.0: - Update your model configuration to use `max_completion_tokens` instead of `max_tokens`. If you’re editing YAML or config files for the plugin, replace every instance of `max_tokens` with `max_completion_tokens` and restart the service ([source](https://github.com/langgenius/dify-official-plugins/issues/2118)). - If the UI supports "advanced mode," use it to manually set `max_completion_tokens` for your model ([source](https://github.com/langgenius/dify-official-plugins/issues/1845)). - If you still see errors, try using the "OpenAI" provider directly instead of the "OpenAI-API-compatible" provider, which sometimes avoids this parameter issue ([source](https://github.com/langgenius/dify-official-plugins/issues/986), [source](https://github.com/langgenius/dify-official-plugins/issues/2118)). - Double-check your API key, model name formatting (no leading `/`), and model availability—these can also trigger 400 errors ([source](https://github.com/langgenius/dify-official-plugins/issues/986), [source](https://github.com/langgenius/dify-official-plugins/issues/2118)). Recent Dify updates have improved support for custom parameters, but in v1.10.0, manual config changes are usually required for GPT-5.1 compatibility ([source](https://github.com/langgenius/dify/pull/22924)). <!-- Dosu Comment Footer --> *To reply, just mention [@dosu](https://go.dosu.dev/dosubot).* --- <sup>How did I do? [Good](https://app.dosu.dev/response-feedback/ada5e313-924f-499d-a6fd-41612503629a?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/ada5e313-924f-499d-a6fd-41612503629a?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/ada5e313-924f-499d-a6fd-41612503629a?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/ada5e313-924f-499d-a6fd-41612503629a?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/ada5e313-924f-499d-a6fd-41612503629a?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/ada5e313-924f-499d-a6fd-41612503629a?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/ada5e313-924f-499d-a6fd-41612503629a?feedback_type=other)</sup> [![Chat with Dosu](https://dosu.dev/dosu-chat-badge.svg)](https://app.dosu.dev/6088a4f4-073a-43f3-b3d4-4f06fb0c05a0/ask?utm_source=github)&nbsp;[![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=The%20error%20happens%20because%20newer%20models%20like%20GPT-5.1%20require%20the%20parameter%20%60max_completion_tokens%60%20instead%20of%20the%20older%20%60max_tokens%60%E2%80%94OpenAI%20has%20deprecated%20%60max_tokens%60%20for%20these%20models%2C%20and%20Dify%27s%20OpenAI-API-compatible%20plugin%20defaults%20to%20the%20old%20parameter%2C%20causing%20validation%20to%20fail%20%28%5Bsource%5D%28https%3A//github.com/langgenius/dify-official-plugins/issues/239%29%2C%20%5Bsource%5D%28https%3A//github.com/langgenius/dify-official-plugins/issues/1845%29%2C%20%5Bsource%5D%28https%3A//github.com/langgenius/dify-official-plugins/issues/2118%29%29.%0A%0ATo%20resolve%20this%20in%20Dify%20v1.10.0%3A%0A-%20Update%20your%20model%20configuration%20to%20use%20%60max_completion_tokens%60%20instead%20of%20%60max_tokens%60.%20If%20you%E2%80%99re%20editing%20YAML%20or%20config%20files%20for%20the%20plugin%2C%20replace%20every%20instance%20of%20%60max_tokens%60%20with%20%60max_completion_tokens%60%20and%20restart%20the%20service%20%28%5Bsource%5D%28https%3A//github.com/langgenius/dify-official-plugins/issues/2118%29%29.%0A-%20If%20the%20UI%20supports%20%22advanced%20mode%2C%22%20use%20it%20to%20manually%20set%20%60max_completion_tokens%60%20for%20your%20model%20%28%5Bsource%5D%28https%3A//github.com/langgenius/dify-official-plugins/issues/1845%29%29.%0A-%20If%20you%20still%20see%20errors%2C%20try%20using%20the%20%22OpenAI%22%20provider%20directly%20instead%20of%20the%20%22OpenAI-API-compatible%22%20provider%2C%20which%20sometimes%20avoids%20this%20parameter%20issue%20%28%5Bsource%5D%28https%3A//github.com/langgenius/dify-official-plugins/issues/986%29%2C%20%5Bsource%5D%28https%3A//github.com/langgenius/dify-official-plugins/issues/2118%29%29.%0A-%20Double-check%20your%20API%20key%2C%20model%20name%20formatting%20%28no%20leading%20%60/%60%29%2C%20and%20model%20availability%E2%80%94these%20can%20also%20trigger%20400%20errors%20%28%5Bsource%5D%28https%3A//github.com/langgenius/dify-official-plugins/issues/986%29%2C%20%5Bsource%5D%28https%3A//github.com/langgenius/dify-official-plugins/issues/2118%29%29.%0A%0ARecent%20Dify%20updates%20have%20improved%20support%20for%20custom%20parameters%2C%20but%20in%20v1.10.0%2C%20manual%20config%20changes%20are%20usually%20required%20for%20GPT-5.1%20compatibility%20%28%5Bsource%5D%28https%3A//github.com/langgenius/dify/pull/22924%29%29.)&nbsp;[![Join Discord](https://img.shields.io/badge/join-5865F2?logo=discord&logoColor=white&label=)](https://go.dosu.dev/discord-bot)&nbsp;[![Share on X](https://img.shields.io/badge/X-share-black)](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify/issues/29464)
Author
Owner

@crazywoola commented on GitHub (Dec 10, 2025):

If you’re experiencing an issue with a plugin, please report it using this template: https://github.com/langgenius/dify-official-plugins/issues/new?template=bug_report.yml. This will help the team review and resolve your issue more efficiently.

@crazywoola commented on GitHub (Dec 10, 2025): If you’re experiencing an issue with a plugin, please report it using this template: [https://github.com/langgenius/dify-official-plugins/issues/new?template=bug_report.yml](https://github.com/langgenius/dify-official-plugins/issues/new?template=bug_report.yml). This will help the team review and resolve your issue more efficiently.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#20956