
azure-openai
#10058
url_access_error
The provided image URL is not accessible. Please check the URL and try again.
This error has been identified and solved.
Reason
The 400 status error in the Azure OpenAI API when trying to access an image URL could be due to several reasons:
Image URL Accessibility
The image URL provided may be inaccessible due to network restrictions, such as being behind a VPN or firewall, preventing the API from reaching the image.
URL Encoding Issues
The image URL might contain encoded characters that are not properly handled, leading to an invalid URL.
Model Compatibility
The GPT-4 model you are using may not support image URLs as input. Only certain models, like those integrated with vision capabilities, can handle image inputs.
Authorization and Permissions
The API may not have the necessary permissions or service account access to the image URL, resulting in a 403 Forbidden error which can be wrapped in a 400 Bad Request error.
Solution
To resolve the 400 status error in the Azure OpenAI API when trying to access an image URL, consider the following steps:
Ensure the image URL is complete and correctly formatted, including any necessary query parameters such as expiration dates and signatures.
Verify that the image URL is accessible and not restricted by network policies.
Check if the model you are using supports image URLs; for example, use a model like GPT-4-turbo which accepts image URLs.
Ensure the API has the necessary permissions and service account access to the image URL.
Confirm that the image is in a supported format (PNG, JPEG, WEBP, or non-animated GIF) and does not exceed the 20 MB size limit.
If the issue persists, consider encoding the image in base64 and sending it as part of the text content as an alternative solution.
Suggested Links
https://cheatsheet.md/chatgpt-cheatsheet/openai-api-error-axioserror-request-failed-status-code-400
https://github.com/Azure/azure-sdk-for-net/issues/42591
https://community.openai.com/t/gpt-4-vision-error-badrequesterror-400-invalid-image/516486
https://learn.microsoft.com/en-us/answers/questions/2139738/openai-badrequesterror-error-code-400-((error-((me
https://learn.microsoft.com/en-us/answers/questions/1456527/issue-with-azure-openai-gpt-4-model-invalid-conten
https://community.openai.com/t/gpt-4o-sometime-not-able-to-access-image-from-url/903528
https://learn.microsoft.com/en-us/answers/questions/2107120/accessing-generated-images-from-azure-openai-servi
https://github.com/FlowiseAI/Flowise/issues/195
https://portkey.ai/error-library/unsupported-image-error-10015
https://learn.microsoft.com/en-us/answers/questions/2057435/azure-openai-api-with-gpt-4o-deployment-fails-to-c