mirror of
https://github.com/langgenius/dify-official-plugins.git
synced 2026-07-22 01:55:27 -04:00
openai_api_compatible used fail in rag #658
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 @SquirrelJimmy on GitHub (Sep 20, 2025).
Self Checks
Dify version
1.8.1
Plugin version
0.0.22
Cloud or Self Hosted
Self Hosted (Docker)
Steps to reproduce
add a openai_api_compatible embedding model, can not use in rag
✔️ Error log
core.model_runtime.errors.invoke.InvokeError: [openai_api_compatible] Error: req_id: bee503fce8 PluginInvokeError: {"args":{"description":"[models] Error: 'usage'"},"error_type":"InvokeError","message":"[models] Error: 'usage'"}
@dosubot[bot] commented on GitHub (Sep 20, 2025):
The error
[models] Error: 'usage'means your embedding model's response is missing the requiredusagefield. Dify expects OpenAI-compatible embedding responses to include ausageobject withprompt_tokensandtotal_tokens. For example:If your model response doesn't have this exact structure, Dify will fail to use it in RAG workflows and throw the error you saw. Make sure your embedding API returns the
usagefield as shown above, even if you have to hardcode reasonable values for testing. This requirement is enforced in recent Dify and plugin versions, and similar issues have been reported by other users here.If you update your model or proxy to return the correct format, the error should resolve. If you use a third-party provider, check their docs or wrapper for OpenAI compatibility and response structure.
To reply, just mention @dosu.
How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other
