[Feature Request] Support 'max_completion_tokens' param in OpenAI-Compatible provider for O1-like models #935

Open
opened 2026-02-16 10:21:03 -05:00 by yindo · 6 comments
Owner

Originally created by @sunlongyu on GitHub (Jan 14, 2026).

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • 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.
  • Please do not modify this template :) and fill in all the required fields.

1. Is this request related to a challenge you're experiencing? Tell me about your story.

I am trying to integrate a custom model via the "OpenAI-API-Compatible" model provider in Dify.

My internal API endpoint wraps an OpenAI o1-series (reasoning) model, which enforces strict parameter validation. When Dify sends a request, it includes the max_tokens parameter by default. However, the API rejects this request because newer reasoning models (like o1) require max_completion_tokens and explicitly forbid the usage of max_tokens.

As a result, I receive a 400 Bad Request error and cannot use the model in Dify without setting up an external middleware proxy to manually swap the parameter names.

2. Additional context or comments

Error Log received from the API:

{
  "error": {
    "message": "Unsupported parameter: 'max_tokens' is not supported by this model. Please use 'max_completion_tokens' instead.",
    "type": "invalid_request_error",
    "param": "max_tokens",
    "code": "unsupported_parameter"
  }
}

### 3. Can you help us with this feature?

- [x] I am interested in contributing to this feature.
Originally created by @sunlongyu on GitHub (Jan 14, 2026). ### 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] 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] Please do not modify this template :) and fill in all the required fields. ### 1. Is this request related to a challenge you're experiencing? Tell me about your story. I am trying to integrate a custom model via the **"OpenAI-API-Compatible"** model provider in Dify. My internal API endpoint wraps an **OpenAI o1-series (reasoning) model**, which enforces strict parameter validation. When Dify sends a request, it includes the `max_tokens` parameter by default. However, the API rejects this request because newer reasoning models (like o1) require `max_completion_tokens` and explicitly forbid the usage of `max_tokens`. As a result, I receive a `400 Bad Request` error and cannot use the model in Dify without setting up an external middleware proxy to manually swap the parameter names. ### 2. Additional context or comments **Error Log received from the API:** ```json { "error": { "message": "Unsupported parameter: 'max_tokens' is not supported by this model. Please use 'max_completion_tokens' instead.", "type": "invalid_request_error", "param": "max_tokens", "code": "unsupported_parameter" } } ### 3. Can you help us with this feature? - [x] I am interested in contributing to this feature.
yindo added the enhancement label 2026-02-16 10:21:03 -05:00
Author
Owner

@crazywoola commented on GitHub (Jan 14, 2026):

This should go into this repo.

@crazywoola commented on GitHub (Jan 14, 2026): This should go into this repo.
Author
Owner

@sunlongyu commented on GitHub (Jan 14, 2026):

您好,已经收到您的来信。

@sunlongyu commented on GitHub (Jan 14, 2026): 您好,已经收到您的来信。
Author
Owner

@dosubot[bot] commented on GitHub (Jan 30, 2026):

Hi, @sunlongyu. I'm Dosu, and I'm helping the dify-official-plugins team manage their backlog and am marking this issue as stale.

Issue Summary:

  • You requested adding support for the 'max_completion_tokens' parameter in the OpenAI-Compatible provider for o1-series models to prevent 400 errors caused by the default 'max_tokens' parameter.
  • A contributor suggested that this request might belong in a different repository.
  • You acknowledged the suggestion but no further updates or development have occurred since then.

Next Steps:

  • Please let me know if this issue is still relevant to the latest version of the dify-official-plugins repository by commenting here to keep the discussion open.
  • If I do not hear back from you within 5 days, I will automatically close this issue.

Thank you for your understanding and contribution!

@dosubot[bot] commented on GitHub (Jan 30, 2026): Hi, @sunlongyu. I'm [Dosu](https://dosu.dev), and I'm helping the dify-official-plugins team manage their backlog and am marking this issue as stale. **Issue Summary:** - You requested adding support for the 'max_completion_tokens' parameter in the OpenAI-Compatible provider for o1-series models to prevent 400 errors caused by the default 'max_tokens' parameter. - A contributor suggested that this request might belong in a different repository. - You acknowledged the suggestion but no further updates or development have occurred since then. **Next Steps:** - Please let me know if this issue is still relevant to the latest version of the dify-official-plugins repository by commenting here to keep the discussion open. - If I do not hear back from you within 5 days, I will automatically close this issue. Thank you for your understanding and contribution!
Author
Owner

@sunlongyu commented on GitHub (Jan 30, 2026):

您好,已经收到您的来信。

@sunlongyu commented on GitHub (Jan 30, 2026): 您好,已经收到您的来信。
Author
Owner

@dosubot[bot] commented on GitHub (Jan 30, 2026):

@crazywoola The user has confirmed that this issue regarding the 'max_completion_tokens' parameter in the OpenAI-Compatible provider for o1-series models is still relevant and needs attention. Could you please assist?

@dosubot[bot] commented on GitHub (Jan 30, 2026): @crazywoola The user has confirmed that this issue regarding the 'max_completion_tokens' parameter in the OpenAI-Compatible provider for o1-series models is still relevant and needs attention. Could you please assist?
Author
Owner

@sunlongyu commented on GitHub (Feb 2, 2026):

Yes, this issue is still highly relevant in the latest version.

Currently, the OpenAI-Compatible provider in Dify cannot support these models natively without setting up an external proxy to swap parameters, which is a significant friction point for users.

Please keep this open. We need native support for max_completion_tokens or a "Reasoning Model" mode switch in the generic OpenAI provider settings.

@sunlongyu commented on GitHub (Feb 2, 2026): Yes, this issue is still highly relevant in the latest version. Currently, the OpenAI-Compatible provider in Dify cannot support these models natively without setting up an external proxy to swap parameters, which is a significant friction point for users. Please keep this open. We need native support for `max_completion_tokens` or a "Reasoning Model" mode switch in the generic OpenAI provider settings.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-official-plugins#935