mirror of
https://github.com/langgenius/dify-official-plugins.git
synced 2026-07-21 17:45:23 -04:00
Structured output error using openai_api_compatible #584
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 @BBYNAI on GitHub (Aug 24, 2025).
Self Checks
Dify version
1.7.2
Plugin version
openai_api_compatible 0.0.20
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
Setup the model:
Test Structured Output:
Chatflow reference: structured output test.yml
✔️ Error log
The errors below are shown in the Dify conversation after sending "hello world".
When using OpenAI as the backend with OpenAI-API-Compatible plugin:
When using LiteLLM as the backend with OpenAI-API-Compatible plugin:
@dosubot[bot] commented on GitHub (Aug 24, 2025):
Hi @BBYNAI! I'm Dosu and I’m helping the dify-official-plugins team.
The error happens because the backend (OpenAI or LiteLLM) doesn't recognize the
json_schemaorresponse_format.json_schemaparameters sent by the openai_api_compatible plugin. This is a known compatibility issue: not all OpenAI-compatible endpoints support these structured output features, especially with models like gpt-4.1-mini. The plugin v0.0.20 includes a workaround that should interceptresponse_format=json_schemaand instead inject the schema as a system prompt, but this only works if the plugin and backend are correctly configured and the model actually supports structured output natively. If the backend still rejects the parameter, structured output will fail with a 400 error source.To resolve this, make sure you are using the latest plugin version and a model that explicitly supports JSON Schema (for example, gpt-4o-mini-2024-07-18 or later). If your backend does not support these parameters, Dify will fall back to prompt-based formatting, which is less reliable. If strict structured output is required, you may need to upgrade your backend/model or use a provider that supports native JSON Schema source.
If you continue to see this error even with the latest plugin and a supported model, double-check your plugin configuration and model selection. For most cases, upgrading and reconfiguring should resolve the issue source.
To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other
