Incorrect API key provided but is valid and existing on Open AI Dashboard

Hey guys, I’ve just start messing with the Quickstart https://openai.github.io/openai-agents-python/quickstart/ and I’ve generated an API key on

https://platform.openai.com/account/api-keys

also put some credit on it and so on but on the quick start when I call the runner with the agent I do get

Tracing client error 401: {
  "error": {
    "message": "Incorrect API key provided:

It’s a python code, I do have OPENAI_API_KEY=sk-proj- in my .env and they are loaded not sure why its happening macos

Welcome!

Have you tried printing out the env to make sure it’s correct?

2 Likes

Apologise, I had another api key set in OS and it was using this one :X Sorry about that! Excited to deep dive into world of open ai

2 Likes

Nice. Happy coding!

Come back to let us know what you’re tinkering on!

1 Like