401 Authorization Required

Hi there,

After successfully obtaining the API_KEY, I tried the following code but received an AuthenticationError. Could you help me with this issue? Thanks a lot.

import openai
from openai import OpenAI

client = OpenAI(
    base_url="https://fast-api.snova.ai/v1",  # the endpoint IP running on vLLM
    api_key=SAMBANOVA_API_KEY,
)

def call_llama(sys_prompt, prompt, **kwargs):
    completion = client.chat.completions.create(
      model="llama3-405b",
      messages=[
        {"role": "user", "content": prompt}
      ],
      stream=True,
      **kwargs,
    )
    response = ""
    for chunk in completion:
        response += chunk.choices[0].delta.content or ""
    return response
sys_prompt = "Answer the question in a couple sentences."
prompt = "Share a happy story with me"
out = call_llama(sys_prompt, prompt)
print(out)
1 Like

Hi!

Welcome to the SambaNova community and thanks for registering for the Fast API Program. I will investigate this for you and as this is an access issue provide you an update privately as soon as we are able.

Kind Regards
Alex Penketh

1 Like

Hi @overwindows, I think there was a fix on the API side a few days earlier. I had similar issues a week ago. But I tried your code with my KEY just now, and it works as expected.

1 Like

@overwindows you should have received anew key today. We had a few that had gotten corrupt and we resent them. Please let use know if you received your new one. According to my emial logs it was sent.

1 Like

@overwindows were you able to use the key provided ?

regards

Coby

1 Like

Yes, pefect! thanks,Coby