Problem: I cannot use free models with my API Key

Hi there!! I started to try some models but I cannot get an inference, I’m testing it with this code:

API_KEY = os.getenv(“NVIDIA_API_KEY”)

headers = {
“Authorization”: f"Bearer {API_KEY}",
“Accept”: “application/json”,
“Content-Type”: “application/json”
}

if res_models.status_code == 200:
print(“\n— Probando Chat Completions —”)
url_chat = “https://integrate.api.nvidia.com/v1/chat/completions”
data = {
“model”: “openai/gpt-oss-20b”,
“temperature”: 0.5,
“messages” = [
{
“role”: “system”,
“content”: “Eres un asistente inteligente listo para conversar acerca de los datos que conforman todo tu conocimiento. Se amigable y preciso sobre las preguntas que te hace el usuario.”
},
{
“role”: “user”,
“content”: “Hola, me gustaría saber cuales son los temas que dominas y que forman parte de tu entrenamiento para hacerte preguntas en base a esto.”
}
]
)
}
res_chat = requests.post(url_chat, headers=headers, json=data)
print(f"Status Code Chat: {res_chat.status_code}")
print(res_chat.text)

But I get this one:

-– Probando Chat Completions —
Status Code Chat: 401
{“status”:401,“title”:“Unauthorized”,“detail”:“Authentication failed”}

Anyone has resolved this issue? Thanks in advanced!!