Exception: [403] Forbidden Invalid UAM response

I am not able to retrieve a response from:

# Send the query and context to the LLM
client = ChatNVIDIA(
  model="meta/llama-3.3-70b-instruct",
  api_key=os.getenv("OPENAI_API_KEY"), 
  temperature=0.2,
  top_p=0.7,
  max_tokens=1024,
)

for chunk in client.stream([{"role":"user","content":"hello how are you"}]): 
  print(chunk.content, end="")

The error that I am getting is this:

raceback (most recent call last):
File “/Users/alexitopro/Desktop/LearningPython/QuillaGPT/quilla-gpt/testing.py”, line 46, in
for chunk in client.stream([{“role”:“user”,“content”:“hello how are you”}]):
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/Users/alexitopro/Desktop/LearningPython/QuillaGPT/venv/lib/python3.12/site-packages/langchain_core/language_models/chat_models.py”, line 420, in stream
raise e
File “/Users/alexitopro/Desktop/LearningPython/QuillaGPT/venv/lib/python3.12/site-packages/langchain_core/language_models/chat_models.py”, line 400, in stream
for chunk in self._stream(messages, stop=stop, **kwargs):
File “/Users/alexitopro/Desktop/LearningPython/QuillaGPT/venv/lib/python3.12/site-packages/langchain_nvidia_ai_endpoints/chat_models.py”, line 420, in _stream
for response in self._client.get_req_stream(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/Users/alexitopro/Desktop/LearningPython/QuillaGPT/venv/lib/python3.12/site-packages/langchain_nvidia_ai_endpoints/_common.py”, line 563, in get_req_stream
self._try_raise(response)
File “/Users/alexitopro/Desktop/LearningPython/QuillaGPT/venv/lib/python3.12/site-packages/langchain_nvidia_ai_endpoints/_common.py”, line 462, in _try_raise
raise Exception(f"{header}\n{body}") from None
Exception: [403] Forbidden
Invalid UAM response

I do have a side project in which I use OpenAI as client and I do have this error as well. I am not sure why this is happening considering that I still have plenty of credits remaining and a couple of hours ago it pretty much worked fine. I don’t know how to fix this as there’s little to none workarounds on the net.

Have the same issue, hoping it’s a bug which will be fixed soon

1 out of 3 times its giving Invalid UAM response on calling interface api

Have the same issue, hope that the api_key can keep same in longer stage and can be shared using between different apis on the same platform.

I had the same issue soon after I created a new developer account. So I generated the API Key once again and it worked fine. I tried various models - meta/llama-3.3-70b-instruct, google/gemma-7b and all of them worked fine after generating the API key once again.

This is where I generated the API keys - llama-3.3-70b-instruct Model by Meta | NVIDIA NIM. The same key works for all models.