Bug Report: Azure OpenAI API Key Fails for Image Analysis in Cursor
Description:
When using Cursor with my Azure OpenAI subscription, everything works correctly for text completions and chat, both with my Azure API key and deployment endpoint. However, when I try to use image analysis (e.g., uploading an image to the chat), I get an error message:
Unauthorized User Openai API key
Details:
- Text completions and chat: Work fine with my Azure OpenAI API key.
- Image analysis: Always fails with the “Unauthorized User Openai API key” error when using my Azure OpenAI key.
- If I use the built-in models (like GPT-4.1) without my own key, image analysis works (but this uses OpenAI’s own API, not my Azure subscription).
- On the official Azure OpenAI portal, image analysis works perfectly with my Azure subscription and deployment.
Conclusion:
It appears that Cursor is not handling image analysis requests correctly when using Azure OpenAI:
- Either it’s not building the request according to Azure OpenAI’s requirements,
- Or it’s trying to use the Azure API key against the OpenAI endpoint for images (which will always fail).
Suggested Solution:
Please review and update Cursor to properly support image analysis with Azure OpenAI:
- Allow specifying Azure endpoints and deployments for image analysis, not just text.
- Ensure that image requests are sent to the correct Azure OpenAI endpoint using the correct headers and payload structure.
Steps to reproduce:
- Set up Cursor to use an Azure OpenAI API key and endpoint.
- Use chat/text completion – works as expected.
- Try to upload an image for analysis – error:
Unauthorized User Openai API key
. - Repeat the same in the Azure OpenAI portal – image analysis works.