Issue: Adding nvidia/nv-embedqa-e5-v5 via the OpenAI-API-compatible plugin results in a 400 error; changing the model name to nv-embedqa-e5-v5 results in a 404 error.
Kimi’s core issue confirmation: The OpenAI-API-compatible plugin in Dify hardcodes the /retrieval path, whereas the correct endpoint for NVIDIA NIM Embedding is /embeddings. This is a 底层 compatibility issue that cannot be resolved via configuration.
Reviewing the historical merge: fix: nvidia special embedding model payload close #11193 by yihong0618 · Pull Request #11239 · langgenius/dify · GitHub
Discovered that the input_type parameter was not being passed. Traced the source code using Claude Code and found the answer:
Problem Analysis
Architecture Layer:
Dify main codebase (api/) ↓ passes input_type
dify-plugin-sdks (OAICompatEmbeddingModel) ← Problem here!
↓ input_type not passed into payload
OpenAI-API-compatible plugin
↓
NVIDIA NIM API (requires input_type parameter)
Root Cause: Although the OAICompatEmbeddingModel._invoke() method in dify-plugin-sdks accepts the input_type parameter, it does not include it when constructing the HTTP payload.
Solution
You need to modify the dify-plugin-sdks repository (not the main Dify repository or dify-official-plugins).
Modify file: python/dify_plugin/interfaces/model/openai_compatible/text_embedding.py
Change the payload construction logic from:
payload = {
"input": inputs[i : i + max_chunks],
"model": credentials.get("endpoint_model_name", model),
**extra_model_kwargs,
}
to something like:
payload = {
"input": inputs[i : i + max_chunks],
"model": credentials.get("endpoint_model_name", model),
**extra_model_kwargs,
}
# For models requiring input_type (e.g., NVIDIA NIM)
if input_type:
# Convert to format expected by API
payload["input_type"] = "query" if input_type == EmbeddingInputType.QUERY else "passage"
Final Note: The issue has been confirmed to stem from incorrect parameter passing in the plugin, preventing the addition of NVIDIA’s embedding models.