Calling claude-3-5-sonnet-2 via the dedify api Exception #6253

Closed
opened 2026-02-21 18:14:45 -05:00 by yindo · 4 comments
Owner

Originally created by @xiaoshenl on GitHub (Oct 23, 2024).

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 search for existing issues, 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

Version 0.6.16

Cloud or Self Hosted

Self Hosted (Docker)

Steps to reproduce

WEB:
image
image
API:
image
{
"code": "completion_request_error",
"message": "[openai_api_compatible] Error: 'model'",
"status": 400
}

✔️ Expected Behavior

No response

Actual Behavior

No response

Originally created by @xiaoshenl on GitHub (Oct 23, 2024). ### 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 [search for existing issues](https://github.com/langgenius/dify/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 Version 0.6.16 ### Cloud or Self Hosted Self Hosted (Docker) ### Steps to reproduce WEB: ![image](https://github.com/user-attachments/assets/2a5b4df8-c724-46d2-9947-e28ac6b54574) ![image](https://github.com/user-attachments/assets/4bc8c2c7-822a-4f57-bccc-bc258fa8ede2) API: ![image](https://github.com/user-attachments/assets/6a011fea-f899-4e4b-9a19-13a21d70ad13) { "code": "completion_request_error", "message": "[openai_api_compatible] Error: 'model'", "status": 400 } ### ✔️ Expected Behavior _No response_ ### ❌ Actual Behavior _No response_
yindo added the 🐞 bug label 2026-02-21 18:14:45 -05:00
yindo closed this issue 2026-02-21 18:14:45 -05:00
Author
Owner

@dosubot[bot] commented on GitHub (Oct 23, 2024):

@xiaoshenl Hello! I'm here to help you with bug reports, questions, and becoming a contributor. Let me know how I can assist you while you wait for a human maintainer.

I found a similar issue that might help you resolve the error you're encountering. The issue "The request for the arrangement page is normal, but when the API is called, the error is reported" was closed and involved a similar error message: "[openai_api_compatible] Error: 'model'" with a status code of 400. Here are the suggested steps to resolve it:

  1. Check the Model Name: Ensure that the model name you are using is correctly specified and supported, such as gpt-3.5-turbo or gpt-4.

  2. Set the Model in the Application: Make sure you have selected the correct model in the application settings by navigating to the appropriate section and selecting the correct model.

  3. Verify API Key and Quota: Ensure that your OpenAI API key is valid and that you have not exceeded your quota.

  4. Update Model Settings: If using a custom API domain or a different model provider, ensure settings are correctly configured in the model provider settings.

Ensure that the model field is correctly specified in the API request, for example:

{
  "model": "gpt-3.5-turbo",
  "prompt": "Your prompt here",
  "max_tokens": 100
}

These steps should help you address the error you're facing [1].

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Oct 23, 2024): <!-- Greeting --> @xiaoshenl Hello! I'm here to help you with bug reports, questions, and becoming a contributor. Let me know how I can assist you while you wait for a human maintainer. <!-- Answer --> I found a similar issue that might help you resolve the error you're encountering. The issue "[The request for the arrangement page is normal, but when the API is called, the error is reported](https://github.com/langgenius/dify/issues/7361)" was closed and involved a similar error message: "[openai_api_compatible] Error: 'model'" with a status code of 400. Here are the suggested steps to resolve it: 1. **Check the Model Name**: Ensure that the model name you are using is correctly specified and supported, such as `gpt-3.5-turbo` or `gpt-4`. 2. **Set the Model in the Application**: Make sure you have selected the correct model in the application settings by navigating to the appropriate section and selecting the correct model. 3. **Verify API Key and Quota**: Ensure that your OpenAI API key is valid and that you have not exceeded your quota. 4. **Update Model Settings**: If using a custom API domain or a different model provider, ensure settings are correctly configured in the model provider settings. Ensure that the `model` field is correctly specified in the API request, for example: ```json { "model": "gpt-3.5-turbo", "prompt": "Your prompt here", "max_tokens": 100 } ``` These steps should help you address the error you're facing <sup>[[1]](https://github.com/langgenius/dify/issues/7361)</sup>. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@xiaoshenl commented on GitHub (Oct 23, 2024):

@dosu
Now, I am using the text-generated application API. because I added a new text-generated application, where I specified the model as claude-3-5-sonnet-2, and the request was successful in the web. But when requesting the api for this app, it returns an exception. api request could not specify the model.

@xiaoshenl commented on GitHub (Oct 23, 2024): @dosu Now, I am using the text-generated application API. because I added a new text-generated application, where I specified the model as claude-3-5-sonnet-2, and the request was successful in the web. But when requesting the api for this app, it returns an exception. api request could not specify the model.
Author
Owner

@dosubot[bot] commented on GitHub (Oct 23, 2024):

When using the Dify API, ensure that the model name is correctly specified in your API request. The error you're encountering might be due to a mismatch between the model name used in the web interface and the one specified in the API request. Double-check that the model name claude-3-5-sonnet-2 is correctly included in your API request payload. Here's an example of how the request should look:

{
  "model": "claude-3-5-sonnet-2",
  "prompt": "Your prompt here",
  "max_tokens": 100
}

If the model name is correct and you're still facing issues, verify that the model is properly configured in the Dify platform, including any necessary credentials or settings. Additionally, ensure that the API endpoint you're using is correct and that your API key is valid. If the problem persists, it might be related to how the model is integrated or configured in the backend.

To continue talking to Dosu, mention @dosu.

@dosubot[bot] commented on GitHub (Oct 23, 2024): <!-- Answer --> When using the Dify API, ensure that the model name is correctly specified in your API request. The error you're encountering might be due to a mismatch between the model name used in the web interface and the one specified in the API request. Double-check that the model name `claude-3-5-sonnet-2` is correctly included in your API request payload. Here's an example of how the request should look: ```json { "model": "claude-3-5-sonnet-2", "prompt": "Your prompt here", "max_tokens": 100 } ``` If the model name is correct and you're still facing issues, verify that the model is properly configured in the Dify platform, including any necessary credentials or settings. Additionally, ensure that the API endpoint you're using is correct and that your API key is valid. If the problem persists, it might be related to how the model is integrated or configured in the backend. <!-- Dosu Comment Footer --> *To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
Author
Owner

@crazywoola commented on GitHub (Oct 23, 2024):

Either upgrade to latest version or use our latest official provider.

@crazywoola commented on GitHub (Oct 23, 2024): Either upgrade to latest version or use our latest official provider.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langgenius/dify#6253