# Why finetune, BasicModelRunner 401 Client Error

**URL:** <https://community.deeplearning.ai/t/why-finetune-basicmodelrunner-401-client-error/426236>\
**Category:** Finetuning Large Language Models\
**Created:** [August 23, 2023, 6:21pm UTC](https://community.deeplearning.ai/t/why-finetune-basicmodelrunner-401-client-error/426236 "2023-08-23T18:21:42Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Adam\_Hjerpe](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@Adam\_Hjerpe](https://community.deeplearning.ai/u/Adam_Hjerpe)\
**Post date:** [August 23, 2023, 6:21pm UTC](https://community.deeplearning.ai/t/why-finetune-basicmodelrunner-401-client-error/426236/1 "2023-08-23T18:21:42Z")

</div>

The following code in the notebook throws a 401 Client Error, has anyone made the request to work?

```auto
from llama import BasicModelRunner
non_finetuned = BasicModelRunner("meta-llama/Llama-1-7b-hf")
non_finetuned_output = non_finetuned("Tell me how to train my dog to sit")
401 Client Error: Unauthorized for url: https://api.powerml.co/v1/llama/run_program

```

---

<div class="post-metadata">

**Author:** ![Adam\_Hjerpe](https://avatars.discourse-cdn.com/v4/letter/a/aeb1de/32.png) [@Adam\_Hjerpe](https://community.deeplearning.ai/u/Adam_Hjerpe)\
**Post date:** [August 23, 2023, 6:38pm UTC](https://community.deeplearning.ai/t/why-finetune-basicmodelrunner-401-client-error/426236/2 "2023-08-23T18:38:24Z")

</div>

The API-key can be obtained from the lamini page, [Authentication -](https://lamini-ai.github.io/auth/).

After I fetched the API-key I used this approach outlined in another DeepLearning.AI short courses. I paste the details below if someone else runs into the same problem.

```auto
from llama import LLMEngine

_ = load_dotenv(find_dotenv())
lamini_api_key = os.environ['LAMINI_API_KEY']

llm = LLMEngine(
    id="marketing",
    config={
        "production": {
            "key": lamini_api_key,
        }
    },
)
_ = load_dotenv(find_dotenv())
lamini_api_key = os.environ['LAMINI_API_KEY']

```

---

<div class="post-metadata">

**Author:** ![Fang-Chun\_Yeh](https://avatars.discourse-cdn.com/v4/letter/f/7ba0ec/32.png) [@Fang-Chun\_Yeh](https://community.deeplearning.ai/u/Fang-Chun_Yeh)\
**Post date:** [August 28, 2023, 4:51pm UTC](https://community.deeplearning.ai/t/why-finetune-basicmodelrunner-401-client-error/426236/3 "2023-08-28T16:51:49Z")

</div>

Hey Thanks for sharing the code here, it solved my 401 Client Error: Unauthorized error too!
