Agents SDK Issues with model access

Is anyone having issues with python sdk agents calls with messages like “invalid request error” … project “proj_xxxxxxxxxxxxx” does not have access to model ‘gpt-4o-mini-2024-07-18’, even when you have configured model access privileges on you dashboard??.

1 Like

After some (a lot of them) attempts… I’ve solved the issue by doing this:

  • First of all if you are using model : gpt-4o-mini, ensure that you grant access to model gpt-4o-2024-07-18 on your api dashboard (yes, surprisingly, on dashboard there are two different checks fro gpt-4o-mini and gpt-4o-mini-2024-07-18). that’s because sdk agents api calls automatically converts your gpt-4o-mini calls to gpt-4o-mini-2024-07-18 (may be it would be different depeding when you are reading this post :slight_smile: ) … By the way … after you grants access to any model on you api dashboard it would take a few minutes to be ready to be accessed by you api calls.
  • 2 - In my case I don’t want to use export openai_api_key to be available on python enviroment. I’ve tried to use dotenv, but it doesn’t work for me… finally I found a solution using from agents import set_default_openai_key and then set_default_openai_key(" your api key") …

I Hope my experience would be useful for someone else :wink:

3 Likes