mirror of
https://github.com/langgenius/dify-official-plugins.git
synced 2026-07-21 17:45:23 -04:00
OpenAI-API-compatible plugin doesn't work for reasoning models (e.g. GPT-5) #703
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @opeco17 on GitHub (Oct 12, 2025).
Self Checks
Dify version
1.9.1
Cloud or Self Hosted
Self Hosted (Source), Self Hosted (Docker)
Steps to reproduce
✔️ Expected Behavior
GPT-5 can be saved and used without any issues.
❌ Actual Behavior
Error happens
@dosubot[bot] commented on GitHub (Oct 12, 2025):
Hi @opeco17! I'm Dosu and I’m helping the dify team.
This issue happens because Dify’s OpenAI-API-compatible integration expects the standard
max_tokensparameter, but newer models like GPT-5 requiremax_completion_tokensinstead. The parameter mapping logic in Dify is currently static for OpenAI-compatible providers, so it doesn’t automatically translate or support non-standard parameters out of the box.Several users have reported similar problems with other models, and the recommended workaround is to use the "OpenAI" provider directly instead of the "OpenAI-API-compatible" provider, which sometimes resolves parameter validation issues for custom models. If you need to use the compatible provider, you may need to manually adjust the backend model configuration (such as the YAML files in the dify-official-plugins repo) to expose and set
max_completion_tokensinstead ofmax_tokens, then restart the relevant services for changes to take effect. This approach has helped others with similar errors for models like Qwen3 and custom LLMs [discussion] [issue].If you’re running into this with GPT-5, check if switching providers or updating the backend config resolves it. Otherwise, a code update to make parameter mapping more flexible for OpenAI-compatible plugins may be needed.
To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

@opeco17 commented on GitHub (Oct 12, 2025):
This is because deprecated parameter
max_tokensis used for the validation (ref).https://github.com/langgenius/dify-plugin-sdks/blob/main/python/dify_plugin/interfaces/model/openai_compatible/llm.py#L183
The easiest way is to remove this parameter for the validation and restrict the length of the output using prompt like "Reply with single word".
If this direction is fine, I can work on the fix.
@dosubot[bot] commented on GitHub (Oct 12, 2025):
The error happens because Dify's OpenAI-API-compatible plugin expects the 'max_tokens' parameter, but reasoning models like GPT-5 require 'max_completion_tokens' instead. Dify's parameter mapping doesn't currently account for this model-specific difference, so validation fails and the model can't be added without changes.
Recent updates have improved parameter handling and made it more flexible, especially with the introduction of "advanced mode" in the UI. This mode allows you to configure parameters that aren't part of the default set, as long as the provider's schema supports them. However, automatic mapping between 'max_tokens' and 'max_completion_tokens' is not built-in—you need to ensure the provider/plugin schema lists the correct parameters for your model (like 'max_completion_tokens' for GPT-5) and use advanced mode to set them. This design future-proofs Dify for evolving LLM APIs, but for now, supporting GPT-5 or similar models may require updating the provider schema or parameter mapping logic to recognize and accept 'max_completion_tokens' instead of 'max_tokens' see details.
If you need to support GPT-5 immediately, check your provider's schema and update it to include 'max_completion_tokens', then use advanced mode to set it in the UI. This should resolve the validation error and allow you to add and use the model.
To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

@Haddyshu commented on GitHub (Oct 24, 2025):
Hello, I have encountered the same problem in the process of use. Is there any way to solve it at present?
@chupark commented on GitHub (Oct 29, 2025):
I've created two PRs to address this issue. I hope these PRs will be merged.
@dosubot[bot] commented on GitHub (Nov 14, 2025):
Hi, @opeco17. I'm Dosu, and I'm helping the dify-official-plugins team manage their backlog and am marking this issue as stale.
Issue Summary:
Next Steps:
Thank you for your understanding and contribution!