How do I send a GPT-4 API request from Python?

I am trying to build a simple AI chatbot using the GPT-4 API.

I created an API key but I don’t understand how to send a request from Python.

Can someone show a simple example?

Hi and welcome to the community!

Have you tried the quickstart guide from the docs? If yes, can you share where you ran into an issue?

GPT-4 is an AI model, and you’ll likely want to start with gpt-5-nano for testing (and with a new organization where you have gone through “create building”, you might have minimal free usage before needing to prepay for credits.

Here’s sending a request, and the rest of API support for “build a simple AI chatbot” - by way of searching the forum.