Sudden emergence of 404 error for basic calls

Usually my python code with openai apis work jut fine, but this morning onwards, Ive started getting 404 errors.

So, I went back to the most basic code from the api docs - yet I get the 404 error, for code that worked fine till yesterday

Thanks for the help. - pls see below.

“Error code: 404 - {‘error’: {‘type’: ‘invalid_request_error’, ‘code’: ‘unknown_url’, ‘message’: 'Unknown request URL:”

the code itself is very straightforward - copy-paste from the docs…

from openai import OpenAI
client = OpenAI()

response = client.chat.completions.create(
  model="gpt-3.5-turbo",
  messages=[
    {"role": "system", "content": "You are a helpful assistant."},
    {"role": "user", "content": "Who won the world series in 2020?"},
    {"role": "assistant", "content": "The Los Angeles Dodgers won the World Series in 2020."},
    {"role": "user", "content": "Where was it played?"}
  ]

Hi @banerji.arindam,

Welcome to the OpenAI dev forum.

Has there been any change to your internet connection?

e.g., you started using some VPN or turned on a firewall.

I’d recommend making a cURL call to the API to make sure if it’s really a network issue:

curl https://api.openai.com/v1/chat/completions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $OPENAI_API_KEY" \
  -d '{
    "model": "gpt-4o",
    "messages": [
      {
        "role": "system",
        "content": "You are a helpful assistant."
      },
      {
        "role": "user",
        "content": "Hello!"
      }
    ]
  }'

Additionally, you can also ping api.openai.com to make sure that you’re able to reach the URL.