-
Notifications
You must be signed in to change notification settings - Fork 117
Description
When adding the gpt-5.1-codex model to Azure, it failed, the following error occurred:
Error code: 400 - {'error': {'code': 'OperationNotSupported', 'message': 'The chatCompletion operation does not work with the specified model, gpt-5.1-codex. Please choose a different model and try again. You can learn more about which models can be used with each operation here: https://go.microsoft.com/fwlink/?linkid=2197993 .'}}
After researching, I found the following information:
This error occurs because you are attempting to use an incompatible API to call the gpt-5.1-codex model.
According to the latest Azure OpenAI documentation and community feedback (as of the end of 2025), the gpt-5.1-codex model does not support the standard Chat Completions API.
Error Reason:
Interface Mismatch: Your current code or tool is calling the /chat/completions interface (typically used for general models like GPT-4o and GPT-5.1).
Specific Interface Requirements: gpt-5.1-codex is a model specifically optimized for code generation and complex programming tasks, which mandates the use of the new Responses API (/responses), not the old Chat API.
Solution:
Change the API Interface (if you are writing code to call it):
If you are writing code to call the API, you need to change the request endpoint from chat/completions to responses.
Old API (Error): POST /deployments/gpt-5.1-codex/chat/completions
New API (Correct): POST /deployments/gpt-5.1-codex/responses
Note: The request body format (Schema) of the Responses API differs slightly from the Chat API. It typically uses input fields instead of a list of messages, and parameter handling (such as temperature) has also changed. Please refer to the latest Azure API documentation for adaptation.
Then, 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.