Skip to content

OpenAI-API-compatible multimodal embedding ignores endpoint_model_name override #3191

@yobo2u

Description

@yobo2u

Self Checks

  • I have read the Contributing Guide and Language Policy.
  • This is only for bug report, if you would like to ask a question, please head to Discussions.
  • I have searched for existing issues, including closed ones.
  • I confirm that I am using English to submit this report, otherwise it will be closed.
  • Please do not modify this template :) and fill in all the required fields.

Dify version

Self-hosted Docker. I reproduced this with the langgenius/openai_api_compatible plugin version 0.0.51.

Plugin version

openai_api_compatible 0.0.51

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

  1. Install and configure the OpenAI-API-compatible model provider.
  2. Add a text embedding model with vision support enabled.
  3. Use different values for the Dify model registration name and the actual upstream API model name:
{
  "model_name": "Qwen3-VL-Embedding",
  "endpoint_url": "http://host.docker.internal:18080/v1",
  "endpoint_model_name": "qwen3-vl-embedding-8b-awq",
  "vision_support": "support",
  "encoding_format": "float",
  "document_prefix": "document:",
  "query_prefix": "query:"
}
  1. Create or use a multimodal dataset (is_multimodal=true) so Dify calls dispatch/multimodal_embedding/invoke.
  2. Index a document that triggers multimodal embedding.

Expected Behavior

Both text-only embedding and multimodal embedding should send the configured upstream model name from endpoint_model_name to the OpenAI-compatible API.

In the example above, the request body should contain:

{
  "model": "qwen3-vl-embedding-8b-awq"
}

This is also how the text-only embedding path currently behaves.

Actual Behavior

The text-only embedding path works correctly and sends endpoint_model_name:

endpoint_model_name = credentials.get("endpoint_model_name", "") or model
payload = {
    "model": endpoint_model_name,
    "input": batch,
}

However, the multimodal embedding path calls _embed_multimodal_via_chat(...) with model, and then create_chat_embeddings(...) also receives model=model instead of endpoint_model_name.

As a result, the upstream OpenAI-compatible server receives:

{
  "model": "Qwen3-VL-Embedding"
}

instead of:

{
  "model": "qwen3-vl-embedding-8b-awq"
}

The upstream server then returns 404 because Qwen3-VL-Embedding is the Dify display/registration name, not the real upstream model id.

Error log

From Dify API logs:

HTTP Request: POST http://plugin_daemon:5002/plugin/.../dispatch/multimodal_embedding/invoke "HTTP/1.1 200 OK"
Error in stream response for plugin {'code': -500, 'message': '{"message":"{\"args\":{\"description\":\"[models] Error: Error code: 404 - {\'error\': {\'message\': \'The model `Qwen3-VL-Embedding` does not exist.\', \'type\': \'NotFoundError\', \'param\': None, \'code\': 404}}\"},\"error_type\":\"InvokeError\",\"message\":\"[models] Error: Error code: 404 - {\'error\': {\'message\': \'The model `Qwen3-VL-Embedding` does not exist.\', \'type\': \'NotFoundError\', \'param\': None, \'code\': 404}}\"}","error_type":"PluginInvokeError","args":null}'

The same provider configuration works for text-only embedding, and the proxy logs show many successful POST /v1/embeddings requests. The failure only appears when the multimodal embedding path is used.

Suggested fix

Use the resolved endpoint model name in the multimodal path as well. For example:

endpoint_model_name = credentials.get("endpoint_model_name", "") or model
...
self._embed_multimodal_via_chat(
    endpoint_model_name,
    credentials,
    multimodal_inputs,
    endpoint_url,
    api_key,
    max_chunks,
)

or pass both the Dify display model name and the upstream endpoint model name separately, but the OpenAI-compatible request body should use endpoint_model_name consistently for text-only and multimodal embedding.

Additional context

A previous issue requested multimodal embedding support (#2330), but this report is about the current multimodal implementation ignoring endpoint_model_name while the text-only implementation already honors it.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions