ChatGPT API: Attempt One

Today I tried to use the ChatGPT API and send a curl request to it.

Needless to say, it did not go well.

Firstly, I made a new OpenAI account, and added my phone number.

Then I went to the Dashboard and then to API keys

I created an API key, then opened my virtual machine and typed the following request:

curl https://api.openai.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -d '{
     "model": "gpt-4o-mini",
     "messages": [{"role": "user", "content": "Say this is a test!"}],
     "temperature": 0.7
   }'

The error I got said I hit the request limit for free API users, despite it being my first request. I then spent half an hour trying to trouble shooting and I could not figure out why it wasn’t working.

Leave a Reply

Your email address will not be published. Required fields are marked *