BAHADIR ARAZ Greetings!
I'm glad that your issue is resolved and thank you for posting your solution so that others experiencing the same thing can easily reference this!
Since the Microsoft Q&A community has a policy that the question author cannot accept their own answer, they can only accept answers by others, I'll repost your solution in case you'd like to Accept the answer.
I want to use GPT-4o without using Cognitive Search. In previous versions of Azure Open AI, this was possible, but now it is not.
Cognitive search resource is required to generate the results if you use your data. There are other Supported data sources as well.
{'statusCode': 401, 'message': 'Unauthorized. Access token is missing, invalid, audience is incorrect (https://cognitiveservices.azure.com), or have expired.'}
As per the error, it is possible that your API key is missing or invalid, or the endpoint is incorrect. Please make sure that you have a valid API key and endpoint for GPT-4o.
Thanks for confirming that your issue is resolved. "Interestingly, it is fixed, and now I can use it just like in the example I mentioned and you are using python 3.12 openai>=1.30.1 api_version 2024-02-01"
If you have any other questions, please let me know. Thank you again for your time and patience throughout this issue.