Openrouter Plugin Cannot Add Openai O3 model #638

Closed
opened 2026-02-16 10:20:00 -05:00 by yindo · 8 comments
Owner

Originally created by @Egoistsoul on GitHub (Sep 11, 2025).

Self Checks

  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues Dify issues & Dify Official Plugins, including closed ones.
  • I confirm that I am using English to submit this report (我已阅读并同意 Language Policy).
  • [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:)
  • Please do not modify this template :) and fill in all the required fields.

Dify version

1.8.1

Plugin version

0.0.21

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Adding openai/o3 to Opentouter, and prompt:
Credentials validation failed with status code 400 and response body {"error":{"message":"Provider returned error","code":400,"metadata":{"raw":"{\n "error": {\n "message": "Invalid 'max_output_tokens': integer below minimum value. Expected a value >= 16, but got 5 instead.",\n "type": "invalid_request_error",\n "param": "max_output_tokens",\n "code": "integer_below_min_value"\n }\n}","provider_name":"OpenAI"}},"user_id":"user_2qHFUCzu98yat8kNon4VHRhiW5Z"}

Image

✔️ Error log

No response

Originally created by @Egoistsoul on GitHub (Sep 11, 2025). ### Self Checks - [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 [Dify issues](https://github.com/langgenius/dify/issues) & [Dify Official Plugins](https://github.com/langgenius/dify-official-plugins/issues), including closed ones. - [x] I confirm that I am using English to submit this report (我已阅读并同意 [Language Policy](https://github.com/langgenius/dify/issues/1542)). - [x] [FOR CHINESE USERS] 请务必使用英文提交 Issue,否则会被关闭。谢谢!:) - [x] Please do not modify this template :) and fill in all the required fields. ### Dify version 1.8.1 ### Plugin version 0.0.21 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce Adding openai/o3 to Opentouter, and prompt: Credentials validation failed with status code 400 and response body {"error":{"message":"Provider returned error","code":400,"metadata":{"raw":"{\n \"error\": {\n \"message\": \"Invalid 'max_output_tokens': integer below minimum value. Expected a value >= 16, but got 5 instead.\",\n \"type\": \"invalid_request_error\",\n \"param\": \"max_output_tokens\",\n \"code\": \"integer_below_min_value\"\n }\n}","provider_name":"OpenAI"}},"user_id":"user_2qHFUCzu98yat8kNon4VHRhiW5Z"} <img width="788" height="403" alt="Image" src="https://github.com/user-attachments/assets/a864536c-650d-43b7-ba32-9c4b8660b5ea" /> ### ✔️ Error log _No response_
yindo added the bug label 2026-02-16 10:20:00 -05:00
yindo closed this issue 2026-02-16 10:20:00 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Sep 11, 2025):

The error is caused by the value of max_output_tokens being set below the minimum required (16) for the OpenAI o3 model. Dify enforces this limit during credential validation, and the plugin passes parameters through without modifying them. To resolve this, make sure that when adding the model, you set max_output_tokens (or the equivalent field in the UI, sometimes labeled as "max tokens") to at least 16. If the UI or config defaults to a lower value, manually increase it before saving.

Recent updates added model-specific parameter validation and schema-driven extraction, so if you are using an older plugin or Dify version, consider updating to the latest release to benefit from improved validation and configuration options PR #1477. For o3 models, also check if the streaming mode toggle is required or affects validation PR #1549.

If you still encounter issues, double-check the parameter names and values in your model configuration, as using deprecated or incorrect names (like max_tokens instead of max_output_tokens or max_completion_tokens) can also cause validation errors example.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Join Discord Share on X

@dosubot[bot] commented on GitHub (Sep 11, 2025): <!-- Answer --> The error is caused by the value of `max_output_tokens` being set below the minimum required (16) for the OpenAI o3 model. Dify enforces this limit during credential validation, and the plugin passes parameters through without modifying them. To resolve this, make sure that when adding the model, you set `max_output_tokens` (or the equivalent field in the UI, sometimes labeled as "max tokens") to at least 16. If the UI or config defaults to a lower value, manually increase it before saving. Recent updates added model-specific parameter validation and schema-driven extraction, so if you are using an older plugin or Dify version, consider updating to the latest release to benefit from improved validation and configuration options [PR #1477](https://github.com/langgenius/dify-official-plugins/pull/1477). For o3 models, also check if the streaming mode toggle is required or affects validation [PR #1549](https://github.com/langgenius/dify-official-plugins/pull/1549). If you still encounter issues, double-check the parameter names and values in your model configuration, as using deprecated or incorrect names (like `max_tokens` instead of `max_output_tokens` or `max_completion_tokens`) can also cause validation errors [example](https://github.com/langgenius/dify/issues/12767). <!-- 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/265f9a92-4ce1-43de-9dc8-998f20a933f5?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/265f9a92-4ce1-43de-9dc8-998f20a933f5?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/265f9a92-4ce1-43de-9dc8-998f20a933f5?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/265f9a92-4ce1-43de-9dc8-998f20a933f5?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/265f9a92-4ce1-43de-9dc8-998f20a933f5?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/265f9a92-4ce1-43de-9dc8-998f20a933f5?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/265f9a92-4ce1-43de-9dc8-998f20a933f5?feedback_type=other)</sup>&nbsp;&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-official-plugins/issues/1694)
Author
Owner

@Egoistsoul commented on GitHub (Oct 22, 2025):

The error is caused by the value of max_output_tokens being set below the minimum required (16) for the OpenAI o3 model. Dify enforces this limit during credential validation, and the plugin passes parameters through without modifying them. To resolve this, make sure that when adding the model, you set max_output_tokens (or the equivalent field in the UI, sometimes labeled as "max tokens") to at least 16. If the UI or config defaults to a lower value, manually increase it before saving.错误是由 max_output_tokens 的值设置低于 OpenAI o3 模型所需的最低值(16)引起的。Dify 在凭证验证期间强制执行此限制,插件通过参数而不修改它们。要解决此问题,请确保在添加模型时,将 max_output_tokens (或 UI 中的等效字段,有时标记为"最大令牌数")设置为至少 16。如果 UI 或配置默认为较低值,请在保存前手动增加它。

Recent updates added model-specific parameter validation and schema-driven extraction, so if you are using an older plugin or Dify version, consider updating to the latest release to benefit from improved validation and configuration options PR #1477. For o3 models, also check if the streaming mode toggle is required or affects validation PR #1549.最近的更新添加了模型特定参数验证和基于架构的提取,因此如果您使用的是旧插件或 Dify 版本,请考虑更新到最新版本以受益于改进的验证和配置选项。对于 o3 模型,还请检查流式传输模式开关是否需要或影响验证。

If you still encounter issues, double-check the parameter names and values in your model configuration, as using deprecated or incorrect names (like max_tokens instead of max_output_tokens or max_completion_tokens) can also cause validation errors example.如果您仍然遇到问题,请再次检查模型配置中的参数名称和值,因为使用已弃用或不正确的名称(如 max_tokens 而不是 max_output_tokensmax_completion_tokens )也可能导致验证错误示例。

To reply, just mention @dosu.回复时只需提及@dosu。

How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other  Join Discord Share on X

This issue still exist in the latest version of dify and openrouter plugin

@Egoistsoul commented on GitHub (Oct 22, 2025): > The error is caused by the value of `max_output_tokens` being set below the minimum required (16) for the OpenAI o3 model. Dify enforces this limit during credential validation, and the plugin passes parameters through without modifying them. To resolve this, make sure that when adding the model, you set `max_output_tokens` (or the equivalent field in the UI, sometimes labeled as "max tokens") to at least 16. If the UI or config defaults to a lower value, manually increase it before saving.错误是由 `max_output_tokens` 的值设置低于 OpenAI o3 模型所需的最低值(16)引起的。Dify 在凭证验证期间强制执行此限制,插件通过参数而不修改它们。要解决此问题,请确保在添加模型时,将 `max_output_tokens` (或 UI 中的等效字段,有时标记为"最大令牌数")设置为至少 16。如果 UI 或配置默认为较低值,请在保存前手动增加它。 > > Recent updates added model-specific parameter validation and schema-driven extraction, so if you are using an older plugin or Dify version, consider updating to the latest release to benefit from improved validation and configuration options [PR #1477](https://github.com/langgenius/dify-official-plugins/pull/1477). For o3 models, also check if the streaming mode toggle is required or affects validation [PR #1549](https://github.com/langgenius/dify-official-plugins/pull/1549).最近的更新添加了模型特定参数验证和基于架构的提取,因此如果您使用的是旧插件或 Dify 版本,请考虑更新到最新版本以受益于改进的验证和配置选项。对于 o3 模型,还请检查流式传输模式开关是否需要或影响验证。 > > If you still encounter issues, double-check the parameter names and values in your model configuration, as using deprecated or incorrect names (like `max_tokens` instead of `max_output_tokens` or `max_completion_tokens`) can also cause validation errors [example](https://github.com/langgenius/dify/issues/12767).如果您仍然遇到问题,请再次检查模型配置中的参数名称和值,因为使用已弃用或不正确的名称(如 `max_tokens` 而不是 `max_output_tokens` 或 `max_completion_tokens` )也可能导致验证错误示例。 > > _To reply, just mention [@dosu](https://go.dosu.dev/dosubot).回复时只需提及@dosu。_ > > How did I do? [Good](https://app.dosu.dev/response-feedback/265f9a92-4ce1-43de-9dc8-998f20a933f5?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/265f9a92-4ce1-43de-9dc8-998f20a933f5?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/265f9a92-4ce1-43de-9dc8-998f20a933f5?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/265f9a92-4ce1-43de-9dc8-998f20a933f5?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/265f9a92-4ce1-43de-9dc8-998f20a933f5?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/265f9a92-4ce1-43de-9dc8-998f20a933f5?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/265f9a92-4ce1-43de-9dc8-998f20a933f5?feedback_type=other)  [<img alt="Join Discord" width="49" height="20" src="https://camo.githubusercontent.com/d562c2df5e4567ea41d37f1d91a4da0839d8341037045b103b2da268998de17f/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f6a6f696e2d3538363546323f6c6f676f3d646973636f7264266c6f676f436f6c6f723d7768697465266c6162656c3d">](https://go.dosu.dev/discord-bot) [<img alt="Share on X" width="58" height="20" src="https://camo.githubusercontent.com/4649f705e2396d6f328dbc8e800a0509c9c17b3b20253b36706c393df124b93d/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f582d73686172652d626c61636b">](https://twitter.com/intent/tweet?text=%40dosu_ai%20helped%20me%20solve%20this%20issue!&url=https%3A//github.com/langgenius/dify-official-plugins/issues/1694) This issue still exist in the latest version of dify and openrouter plugin
Author
Owner

@dosubot[bot] commented on GitHub (Oct 22, 2025):

@crazywoola The user reports that the issue with max_output_tokens validation still exists in the latest versions of Dify and the OpenRouter plugin and requests further assistance. Could you please help look into this?

@dosubot[bot] commented on GitHub (Oct 22, 2025): @crazywoola The user reports that the issue with `max_output_tokens` validation still exists in the latest versions of Dify and the OpenRouter plugin and requests further assistance. Could you please help look into this?
Author
Owner

@Egoistsoul commented on GitHub (Nov 12, 2025):

This issue still exist in the plugin latest version 0.0.26 and dify 1.9.2

@Egoistsoul commented on GitHub (Nov 12, 2025): This issue still exist in the plugin latest version 0.0.26 and dify 1.9.2
Author
Owner

@dosubot[bot] commented on GitHub (Nov 12, 2025):

@crazywoola The user reports that the issue still exists in plugin version 0.0.26 and dify 1.9.2 despite being closed as stale. Could you please take a look and assist?

@dosubot[bot] commented on GitHub (Nov 12, 2025): @crazywoola The user reports that the issue still exists in plugin version 0.0.26 and dify 1.9.2 despite being closed as stale. Could you please take a look and assist?
Author
Owner

@hiiamboris commented on GitHub (Jan 11, 2026):

Still there in OpenRouter 0.0.31. Hopelessly pathetic.

@hiiamboris commented on GitHub (Jan 11, 2026): Still there in OpenRouter 0.0.31. Hopelessly pathetic.
Author
Owner

@hiiamboris commented on GitHub (Jan 11, 2026):

But the bug is not in the plugin, it's in the core.

@hiiamboris commented on GitHub (Jan 11, 2026): But the bug is not in the plugin, it's in the core.
Author
Owner

@gzh-lee commented on GitHub (Jan 18, 2026):

dify/docker/volumes/plugin_daemon/cwd/langgenius/openai_api_compatible-0.0.30@XXXXXXX/.venv/lib/python3.12/site-packages/dify_plugin/interfaces/model/openai_compatible/llm.py

open folder:dify/docker/volumes/plugin_daemon/cwd/langgenius/ ,
find folder: openai_api_compatible-0.0.**@**********************
goto .venv/lib/python3.12/site-packages/dify_plugin/interfaces/model/openai_compatible

open llm.py, find:
validate_credentials_max_tokens = credentials.get("validate_credentials_max_tokens", 5) or 5
change 5 to 16

@gzh-lee commented on GitHub (Jan 18, 2026): dify/docker/volumes/plugin_daemon/cwd/langgenius/openai_api_compatible-0.0.30@XXXXXXX/.venv/lib/python3.12/site-packages/dify_plugin/interfaces/model/openai_compatible/llm.py open folder:dify/docker/volumes/plugin_daemon/cwd/langgenius/ , find folder: openai_api_compatible-0.0.**@********************** goto .venv/lib/python3.12/site-packages/dify_plugin/interfaces/model/openai_compatible open llm.py, find: validate_credentials_max_tokens = credentials.get("validate_credentials_max_tokens", 5) or 5 change 5 to 16
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-official-plugins#638