# M2\_UGL\_1: error in runing util localy -\> OpenAIError

**URL:** <https://community.deeplearning.ai/t/m2-ugl-1-error-in-runing-util-localy-openaierror/895537>\
**Category:** Agentic AI\
**Tags:** week-module-2, dl-ai-learning-platform\
**Created:** [October 6, 2026, 3:28pm UTC](https://community.deeplearning.ai/t/m2-ugl-1-error-in-runing-util-localy-openaierror/895537 "2026-10-06T15:28:24Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Redwan](https://avatars.discourse-cdn.com/v4/letter/r/848f3c/32.png) [@Redwan](https://community.deeplearning.ai/u/Redwan)\
**Post date:** [October 6, 2026, 3:28pm UTC](https://community.deeplearning.ai/t/m2-ugl-1-error-in-runing-util-localy-openaierror/895537/1 "2026-10-06T15:28:24Z")

</div>

Hi all,

**How i can configure a valid `OPENAI_API_KEY` in my local environment to lunch launches Jupyter notbook.**

when I tried to run M2\_UGL\_1 on my local machine I got an **OpenAIError: Missing credentials.**

OpenAIError Traceback (most recent call last)  
Cell In[3], line 6  
2 import re  
3 import json  
4  
5 # Local helper module  
----\> 6 import utils

File d:\WorkSpace\_coding\agentic\_ai\M2\ungraded\_labs\M2\_UGL\_1\utils.py:24  
21 anthropic\_api\_key = os.getenv(“ANTHROPIC\_API\_KEY”)  
23 # Both clients read keys from env by default; explicit is also fine:  
—\> [24](file:///D:/WorkSpace\_coding/agentic\_ai/M2/ungraded\_labs/M2\_UGL\_1/utils.py:24) openai\_client = OpenAI(api\_key=openai\_api\_key) if openai\_api\_key else OpenAI()  
25 anthropic\_client = Anthropic(api\_key=anthropic\_api\_key) if anthropic\_api\_key else Anthropic()  
26 anthropic\_client = Anthropic(  
27 base\_url=“[http://jupyter-api-proxy.internal.dlai/rev-proxy/anthropic](http://jupyter-api-proxy.internal.dlai/rev-proxy/anthropic)”  
28 )

File d:\WorkSpace\_coding\venv\Lib\site-packages\openai\_client.py:274, in OpenAI.\__init_\_(self, api\_key, admin\_api\_key, workload\_identity, organization, project, webhook\_secret, provider, base\_url, data\_residency, websocket\_base\_url, timeout, max\_retries, default\_headers, default\_query, http\_client, \_strict\_response\_validation, \_enforce\_credentials)  
264 self.admin\_api\_key = admin\_api\_key if provider\_runtime is None else None  
266 if (  
267 provider\_runtime is None  
268 and \_enforce\_credentials  
(…) 272 and self.admin\_api\_key is None  
273 ):

…

```
276 )
278 if organization is None and provider_runtime is None:
279 organization = os.environ.get("OPENAI_ORG_ID")

```

OpenAIError: Missing credentials. Please pass an `api_key`, `workload_identity`, `admin_api_key`, or set the `OPENAI_API_KEY` or `OPENAI_ADMIN_KEY` environment variable.

---

<div class="post-metadata">

**Author:** ![TMosh](https://sea1.discourse-cdn.com/dlai/user_avatar/community.deeplearning.ai/tmosh/32/9321_2.png) [@TMosh](https://community.deeplearning.ai/u/TMosh)\
**Post date:** [October 6, 2026, 5:32pm UTC](https://community.deeplearning.ai/t/m2-ugl-1-error-in-runing-util-localy-openaierror/895537/2 "2026-10-06T17:32:09Z")

</div>

You need to provide your own API key.
