Support for Azure OpenAI Plugin's Responses API #861

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

Originally created by @tomy-kyu on GitHub (Dec 9, 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.10.1-fix.1

Plugin version

0.0.31

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

Regarding the Azure OpenAI plugin, the current version appears to prevent the gpt-5.x Codex model from being used. While this functionality was available until last Friday (December 5th), Microsoft appears to have recently completely restricted access to the ChatCompletion API for Codex.

Currently, only the gpt-5-codex model supports processing using the Responses API.
However, the inclusion of gpt-5.1-codex and gpt-5.1-codex-mini in base_model_name suggests that this support will need to be added.

models/llm/llm.py

line:73-

            # Use the Responses API for the gpt-5-codex model
            if base_model_name in ["gpt-5-codex"]:
                return self._chat_generate_with_responses(
                    model=model,
                    credentials=credentials,
                    prompt_messages=prompt_messages,
                    model_parameters=model_parameters,
                    tools=tools,
                    stop=stop,
                    stream=stream,
                    user=user,
                )

Furthermore, the Credential Validation process is also configured to assume ChatCompletion, so even if Responses API processing were to be integrated, it would likely result in validation failure...

models/llm/llm.py

line 152-182:

        try:
            client = AzureOpenAI(**self._to_credential_kwargs(credentials))
            if base_model_name.startswith(THINKING_SERIES_COMPATIBILITY):
                client.chat.completions.create(
                    messages=[{"role": "user", "content": "ping"}],
                    model=model,
                    temperature=1,
                    max_completion_tokens=20,
                    stream=False,
                )
            elif (
                ai_model_entity.entity.model_properties.get(ModelPropertyKey.MODE)
                == LLMMode.CHAT.value
            ):
                client.chat.completions.create(
                    messages=[{"role": "user", "content": "ping"}],
                    model=model,
                    temperature=0,
                    max_tokens=20,
                    stream=False,
                )
            else:
                client.completions.create(
                    prompt="ping",
                    model=model,
                    temperature=0,
                    max_tokens=20,
                    stream=False,
                )
        except Exception as ex:
            raise CredentialsValidateFailedError(str(ex))

Therefore, validation processing tailored to the Responses API appears to be necessary.
Similar to other Completion API processing, the max_tokens setting must be set to 16 or higher - ensuring that this parameter is properly configured should suffice.

We would appreciate it if you could reconsider the processing configuration to accommodate the Responses API.
Thank you for your consideration.

✔️ Error log

We have captured the error message displayed during issue occurrence as an image for your reference.

Image

Originally created by @tomy-kyu on GitHub (Dec 9, 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.10.1-fix.1 ### Plugin version 0.0.31 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce Regarding the Azure OpenAI plugin, the current version appears to prevent the gpt-5.x Codex model from being used. While this functionality was available until last Friday (December 5th), Microsoft appears to have recently completely restricted access to the ChatCompletion API for Codex. Currently, only the gpt-5-codex model supports processing using the Responses API. However, the inclusion of gpt-5.1-codex and gpt-5.1-codex-mini in base_model_name suggests that this support will need to be added. models/llm/llm.py line:73- ```python # Use the Responses API for the gpt-5-codex model if base_model_name in ["gpt-5-codex"]: return self._chat_generate_with_responses( model=model, credentials=credentials, prompt_messages=prompt_messages, model_parameters=model_parameters, tools=tools, stop=stop, stream=stream, user=user, ) ``` Furthermore, the Credential Validation process is also configured to assume ChatCompletion, so even if Responses API processing were to be integrated, it would likely result in validation failure... models/llm/llm.py line 152-182: ```python try: client = AzureOpenAI(**self._to_credential_kwargs(credentials)) if base_model_name.startswith(THINKING_SERIES_COMPATIBILITY): client.chat.completions.create( messages=[{"role": "user", "content": "ping"}], model=model, temperature=1, max_completion_tokens=20, stream=False, ) elif ( ai_model_entity.entity.model_properties.get(ModelPropertyKey.MODE) == LLMMode.CHAT.value ): client.chat.completions.create( messages=[{"role": "user", "content": "ping"}], model=model, temperature=0, max_tokens=20, stream=False, ) else: client.completions.create( prompt="ping", model=model, temperature=0, max_tokens=20, stream=False, ) except Exception as ex: raise CredentialsValidateFailedError(str(ex)) ``` Therefore, validation processing tailored to the Responses API appears to be necessary. Similar to other Completion API processing, the max_tokens setting must be set to 16 or higher - ensuring that this parameter is properly configured should suffice. We would appreciate it if you could reconsider the processing configuration to accommodate the Responses API. Thank you for your consideration. ### ✔️ Error log We have captured the error message displayed during issue occurrence as an image for your reference. ![Image](https://github.com/user-attachments/assets/08072135-2d3a-4a4a-a756-ccafdda95c81)
yindo added the bug label 2026-02-16 10:20:45 -05:00
yindo closed this issue 2026-02-16 10:20:45 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Dec 9, 2025):

To support the Responses API for gpt-5.1-codex and gpt-5.1-codex-mini, you’ll need to update the AzureOpenAILargeLanguageModel implementation so these models are routed to the _chat_generate_with_responses method, not just gpt-5-codex. This means changing the check in _invoke to include all three models: gpt-5-codex, gpt-5.1-codex, and gpt-5.1-codex-mini. The _chat_generate_with_responses method already handles prompt conversion, parameter mapping (including max_tokens → max_output_tokens), and other necessary logic for the Responses API, so no further changes are needed there for basic support source.

You’ll also need to update credential validation: currently, validate_credentials only checks ChatCompletion or Completion endpoints, which will fail for these models. Add a path for these Codex models to perform a credential check using the Responses API (client.responses.create) and ensure max_output_tokens is set to at least 16 source.

Finally, check for any other places in the codebase that reference model routing or validation for these models to ensure comprehensive support. Testing with all affected models and confirming error-free credential validation and API calls will help verify the fix.

To reply, just mention @dosu.


How did I do? Good | Irrelevant | Incorrect | Verbose | Hallucination | Report 🐛 | Other

Open in Cursor Join Discord Share on X

@dosubot[bot] commented on GitHub (Dec 9, 2025): <!-- Answer --> To support the Responses API for gpt-5.1-codex and gpt-5.1-codex-mini, you’ll need to update the AzureOpenAILargeLanguageModel implementation so these models are routed to the _chat_generate_with_responses method, not just gpt-5-codex. This means changing the check in _invoke to include all three models: gpt-5-codex, gpt-5.1-codex, and gpt-5.1-codex-mini. The _chat_generate_with_responses method already handles prompt conversion, parameter mapping (including max_tokens → max_output_tokens), and other necessary logic for the Responses API, so no further changes are needed there for basic support [source](https://github.com/langgenius/dify-official-plugins/blob/2b4c75bef6a59e038c742ff193cd25aec6ea290d/models/azure_openai/models/llm/llm.py#L52-L566). You’ll also need to update credential validation: currently, validate_credentials only checks ChatCompletion or Completion endpoints, which will fail for these models. Add a path for these Codex models to perform a credential check using the Responses API (client.responses.create) and ensure max_output_tokens is set to at least 16 [source](https://github.com/langgenius/dify-official-plugins/blob/2b4c75bef6a59e038c742ff193cd25aec6ea290d/models/azure_openai/models/llm/llm.py#L52-L566). Finally, check for any other places in the codebase that reference model routing or validation for these models to ensure comprehensive support. Testing with all affected models and confirming error-free credential validation and API calls will help verify the fix. <!-- 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/01daa04c-122a-4287-ae27-fc1464e016ef?feedback_type=great_response) | [Irrelevant](https://app.dosu.dev/response-feedback/01daa04c-122a-4287-ae27-fc1464e016ef?feedback_type=irrelevant_answer) | [Incorrect](https://app.dosu.dev/response-feedback/01daa04c-122a-4287-ae27-fc1464e016ef?feedback_type=incorrect_sources) | [Verbose](https://app.dosu.dev/response-feedback/01daa04c-122a-4287-ae27-fc1464e016ef?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/01daa04c-122a-4287-ae27-fc1464e016ef?feedback_type=hallucination) | [Report 🐛](https://app.dosu.dev/response-feedback/01daa04c-122a-4287-ae27-fc1464e016ef?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/01daa04c-122a-4287-ae27-fc1464e016ef?feedback_type=other)</sup> [![Open in Cursor](https://dosu.dev/dosu-in-cursor.svg)](https://cursor.com/link/prompt?text=To%20support%20the%20Responses%20API%20for%20gpt-5.1-codex%20and%20gpt-5.1-codex-mini%2C%20you%E2%80%99ll%20need%20to%20update%20the%20AzureOpenAILargeLanguageModel%20implementation%20so%20these%20models%20are%20routed%20to%20the%20_chat_generate_with_responses%20method%2C%20not%20just%20gpt-5-codex.%20This%20means%20changing%20the%20check%20in%20_invoke%20to%20include%20all%20three%20models%3A%20gpt-5-codex%2C%20gpt-5.1-codex%2C%20and%20gpt-5.1-codex-mini.%20The%20_chat_generate_with_responses%20method%20already%20handles%20prompt%20conversion%2C%20parameter%20mapping%20%28including%20max_tokens%20%E2%86%92%20max_output_tokens%29%2C%20and%20other%20necessary%20logic%20for%20the%20Responses%20API%2C%20so%20no%20further%20changes%20are%20needed%20there%20for%20basic%20support%20%5Bsource%5D%28https%3A//github.com/langgenius/dify-official-plugins/blob/2b4c75bef6a59e038c742ff193cd25aec6ea290d/models/azure_openai/models/llm/llm.py%23L52-L566%29.%0A%0AYou%E2%80%99ll%20also%20need%20to%20update%20credential%20validation%3A%20currently%2C%20validate_credentials%20only%20checks%20ChatCompletion%20or%20Completion%20endpoints%2C%20which%20will%20fail%20for%20these%20models.%20Add%20a%20path%20for%20these%20Codex%20models%20to%20perform%20a%20credential%20check%20using%20the%20Responses%20API%20%28client.responses.create%29%20and%20ensure%20max_output_tokens%20is%20set%20to%20at%20least%2016%20%5Bsource%5D%28https%3A//github.com/langgenius/dify-official-plugins/blob/2b4c75bef6a59e038c742ff193cd25aec6ea290d/models/azure_openai/models/llm/llm.py%23L52-L566%29.%0A%0AFinally%2C%20check%20for%20any%20other%20places%20in%20the%20codebase%20that%20reference%20model%20routing%20or%20validation%20for%20these%20models%20to%20ensure%20comprehensive%20support.%20Testing%20with%20all%20affected%20models%20and%20confirming%20error-free%20credential%20validation%20and%20API%20calls%20will%20help%20verify%20the%20fix.)&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/2216)
Author
Owner

@nadazero commented on GitHub (Dec 10, 2025):

same issue, and I raise issue on https://github.com/langgenius/dify-plugin-sdks/issues/264

@nadazero commented on GitHub (Dec 10, 2025): same issue, and I raise issue on https://github.com/langgenius/dify-plugin-sdks/issues/264
Author
Owner

@nadazero commented on GitHub (Dec 10, 2025):

looking at the source code of the dify_plugin, in the validate_credentials method of https://github.com/langgenius/dify-plugin-sdks/blob/main/python/dify_plugin/interfaces/model/openai_compatible/llm.py, it seems that only the chat/completions calls are not yet adapted for the /responses handling.

Therefore, I hope someone can do the adaptation in this regard.

@nadazero commented on GitHub (Dec 10, 2025): looking at the source code of the dify_plugin, in the validate_credentials method of https://github.com/langgenius/dify-plugin-sdks/blob/main/python/dify_plugin/interfaces/model/openai_compatible/llm.py, it seems that only the chat/completions calls are not yet adapted for the /responses handling. Therefore, I hope someone can do the adaptation in this regard.
Author
Owner

@nadazero commented on GitHub (Dec 10, 2025):

Image

@nadazero commented on GitHub (Dec 10, 2025): ![Image](https://github.com/user-attachments/assets/a9a280f6-b7dd-4a25-a692-4f4ba3fdc2fe)
Author
Owner

@tomy-kyu commented on GitHub (Dec 10, 2025):

While I can't guarantee whether this will be helpful, I've generated sample code using the Responses API to enable chat functionality with gpt-5.1-codex-max and Gemini3. Since our primary goal was to test GPT-5.1 and GPT-5.1-codex series functionality, we've confirmed that both models can operate reasonably well. However, image processing response times are extremely slow, which remains a significant challenge.

https://gist.github.com/tomy-kyu/43057dd58302ab95c0f99d4b3dca9d51

There are likely various other issues lurking beneath the surface as well, so this should primarily serve as reference material.

Thank you for your consideration.

@tomy-kyu commented on GitHub (Dec 10, 2025): While I can't guarantee whether this will be helpful, I've generated sample code using the Responses API to enable chat functionality with gpt-5.1-codex-max and Gemini3. Since our primary goal was to test GPT-5.1 and GPT-5.1-codex series functionality, we've confirmed that both models can operate reasonably well. However, image processing response times are extremely slow, which remains a significant challenge. https://gist.github.com/tomy-kyu/43057dd58302ab95c0f99d4b3dca9d51 There are likely various other issues lurking beneath the surface as well, so this should primarily serve as reference material. Thank you for your consideration.
Author
Owner

@dosubot[bot] commented on GitHub (Dec 26, 2025):

Hi, @tomy-kyu. I'm Dosu, and I'm helping the dify-official-plugins team manage their backlog and am marking this issue as stale.

Issue Summary:

  • You reported that the Azure OpenAI plugin blocked use of gpt-5.x Codex models due to Microsoft restricting the ChatCompletion API for Codex.
  • I provided guidance to update model routing in AzureOpenAILargeLanguageModel for gpt-5.1-codex variants and to adjust credential validation to use the Responses API.
  • Another user confirmed the need to adapt validate_credentials in the dify_plugin SDK for /responses handling.
  • You shared sample code demonstrating chat functionality with gpt-5.1-codex-max and Gemini3, noting slow image processing as a remaining challenge.
  • The issue was resolved by updating routing and credential validation to support Codex models properly.

Next Steps:

  • Please confirm if this issue is still relevant with the latest version of the dify-official-plugins repository by commenting here.
  • If no further updates are provided, I will automatically close this issue in 5 days.

Thank you for your understanding and contribution!

@dosubot[bot] commented on GitHub (Dec 26, 2025): Hi, @tomy-kyu. I'm [Dosu](https://dosu.dev), and I'm helping the dify-official-plugins team manage their backlog and am marking this issue as stale. **Issue Summary:** - You reported that the Azure OpenAI plugin blocked use of gpt-5.x Codex models due to Microsoft restricting the ChatCompletion API for Codex. - I provided guidance to update model routing in AzureOpenAILargeLanguageModel for gpt-5.1-codex variants and to adjust credential validation to use the Responses API. - Another user confirmed the need to adapt validate_credentials in the dify_plugin SDK for /responses handling. - You shared sample code demonstrating chat functionality with gpt-5.1-codex-max and Gemini3, noting slow image processing as a remaining challenge. - The issue was resolved by updating routing and credential validation to support Codex models properly. **Next Steps:** - Please confirm if this issue is still relevant with the latest version of the dify-official-plugins repository by commenting here. - If no further updates are provided, I will automatically close this issue in 5 days. Thank you for your understanding and contribution!
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify-official-plugins#861