Can not access GPT-4o - Issue with billing?

I trying to access gpt-4o from Python code, and using the sample code below to test it:

from openai import OpenAI

MODEL = "gpt-4o"


client = OpenAI(api_key="XXXXXXXXXXXX")

# Basic Chat

completion = client.chat.completions.create(
    model = MODEL,
    messages=[
        {"role":"system", "content":"You are a helpful assistant. Help me with my math homework"},
        {"role":"user", "content":"Hello! Can you solve 9+11?"}
    ]
)

print(f"Assistant: {completion.choices[0].message.content}")

At the end I am getting

Error code: 404 - {'error': {'message': 'The model `gpt-4o` does not exist or you do not have access to it.', 'type': 'invalid_request_error', 'param': None, 'code': 'model_not_found'}}

My question is, although it is announced it is going to be free to access GPT-4o, does it cover all sorts of access or only via the browser on the chat window?

I tested your code and it works fine on my end. Please check the permissions of your API key to ensure it has access to the GPT-4o model.

Thanks @tiansenxu , just to confirm, you are also on free tier (never made any credit top up or so) ?

You’re welcome. I am using a paid account. Regarding your question, the free access might be for specific users, such as new registrants. Although I’m not entirely sure, I recall that new users often receive some free credits or access privileges.。

I have exactly the same problem - have enough credits and code was working before with v3.5
+updated to the latest python openai package version, didn’t solve the problem

I am using paid account and generated my api_key just today.
When I checked my project api keys permissions I can see “All”

openai.NotFoundError: Error code: 404 - {‘error’: {‘message’: ‘The model gpt-4o does not exist or you do not have access to it.’, ‘type’: ‘invalid_request_error’, ‘param’: None, ‘code’: ‘model_not_found’}}

python code is just similar:

from openai import OpenAI

model=“gpt-4o”
client = OpenAI(api_key=“sk-proj-gC6fUxxxxxxxxxxx”)

completion = client.chat.completions.create(
model=model,
messages=[
{“role”:“system”,
“content”: “You are a helpful assitance. He me to solve my math homework!”},

    { "role":"user",
     "content": "Hello! could you solve 2+2 for me?"}
]

)

print("Assitant: "+ completion.choices[0].message.content)

You might need to wait until you hit billing Tier 1 or Tier 2… I’d check the docs.

1 Like

Thanks @PaulBellow
After checking the tiers and limits page, it seems like the case for me.

@PaulBellow where can I check my limit … what should to do hit billing tier 1 or tier2? which docs are you referring . apart from being gptplus user should I need toapy additionally to access apis? thx

https://platform.openai.com/settings/organization/limits