# Problem with API key while fine-tuning

**URL:** <https://community.openai.com/t/problem-with-api-key-while-fine-tuning/24374>\
**Category:** API\
**Created:** [December 14, 2022, 12:47pm UTC](https://community.openai.com/t/problem-with-api-key-while-fine-tuning/24374 "2022-12-14T12:47:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![nikolasavra](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/nikolasavra/32/7064_2.png) [@nikolasavra](https://community.openai.com/u/nikolasavra)\
**Post date:** [December 14, 2022, 12:47pm UTC](https://community.openai.com/t/problem-with-api-key-while-fine-tuning/24374/1 "2022-12-14T12:47:25Z")

</div>

Hi, everyone. Nice to meet you. I just started using Open AI for my personal projects recently and currently face a problem I can’t seem to overcome.

I am trying to fine tune a model and I am following the instructions exaclty as they are in OpenAI’s website. When I’m using the !openai api fine\_tunes.create -t ‘\<PREPARED\_FILE\>’ -m ‘\<MODEL’ command I am getting the following error:

Error: No API key provided. You can set your API key in code using ‘openai.api\_key = ’, or you can set the environment variable OPENAI\_API\_KEY=). If your API key is stored in a file, you can point the openai module at it with ‘openai.api\_key\_path = ’. You can generate API keys in the OpenAI web interface.

I tried setting the key as it is recommended in the error but nothing happens. The key is valid, i can use it for other tasks (for example I can use it to call a model for text completion). I am working on google colab.  
Could anybody help me?

---

<div class="post-metadata">

**Author:** ![georgejs](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/georgejs/32/20387_2.png) [@georgejs](https://community.openai.com/u/georgejs)\
**Post date:** [January 29, 2023, 2:39pm UTC](https://community.openai.com/t/problem-with-api-key-while-fine-tuning/24374/2 "2023-01-29T14:39:06Z")

</div>

I have this same issue. Anyone can help?

---

<div class="post-metadata">

**Author:** ![carollhwrd](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/carollhwrd/32/146493_2.png) [@carollhwrd](https://community.openai.com/u/carollhwrd)\
**Post date:** [June 23, 2023, 7:30am UTC](https://community.openai.com/t/problem-with-api-key-while-fine-tuning/24374/3 "2023-06-23T07:30:15Z")

</div>

I have an opinion.  
I think your openai api\_key is not allowed to fine tune selected GPT3 model.  
You can check which models you can finetune using this command in python.  
import openai  
OPENAI\_API\_KEY=“Your\_Key”  
openai.api\_key = OPENAI\_API\_KEY  
openai.Model.list()  
Here, only “allow\_fine\_tuning”: true models you can finetune.

---

<div class="post-metadata">

**Author:** ![curt.kennedy](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/curt.kennedy/32/709249_2.png) [@curt.kennedy](https://community.openai.com/u/curt.kennedy)\
**Post date:** [December 17, 2023, 6:11pm UTC](https://community.openai.com/t/problem-with-api-key-while-fine-tuning/24374/4 "2023-12-17T18:11:12Z")

</div>


