# OPENAI command for finetune

**URL:** <https://community.openai.com/t/openai-command-for-finetune/307463>\
**Category:** API\
**Tags:** fine-tuning, api, python\
**Created:** [July 24, 2023, 4:23am UTC](https://community.openai.com/t/openai-command-for-finetune/307463 "2023-07-24T04:23:22Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![nrameshsankaralerts](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/nrameshsankaralerts/32/146303_2.png) [@nrameshsankaralerts](https://community.openai.com/u/nrameshsankaralerts)\
**Post date:** [July 24, 2023, 4:23am UTC](https://community.openai.com/t/openai-command-for-finetune/307463/1 "2023-07-24T04:23:22Z")

</div>

i installed openai using “pip install openai” and “pip show openai” show the details.  
But when i use openai , getting command not found. It occurs both in window and linux. I could not find better docs or solution.

openai: command not found

result of show command  
Name: openai  
Version: 0.27.8  
Summary: Python client library for the OpenAI API  
etc

---

<div class="post-metadata">

**Author:** ![Foxalabs](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/foxalabs/32/738355_2.png) [@Foxalabs](https://community.openai.com/u/Foxalabs)\
**Post date:** [July 24, 2023, 7:35am UTC](https://community.openai.com/t/openai-command-for-finetune/307463/2 "2023-07-24T07:35:40Z")

</div>

Welcome to the developer forum!

If I have understood this error correctly, you are trying to run the OpenAI library from the command line, that is not how it should be used, you should use a text editor to create a (in this case python) application that makes use of the OpenAI library.

```auto
import openai

openai.api_key = 'your-api-key'

response = openai.ChatCompletion.create(
  model="gpt-3.5-turbo",
  messages=[
        {"role": "system", "content": "You are a helpful assistant."},
        {"role": "user", "content": "Who won the world series in 2020?"},
    ]
)

print(response['choices'][0]['message']['content'])

```

This is a small example that will import the `openaiai` library, and make a call to the API endpoint and show you the reply. Not that putting your API key in the code like that is NOT best practice, but it is a quick way to check you have installed everything correctly.

You can read the documentation for further study here

> **[OpenAI Platform](https://platform.openai.com/docs/introduction)**
>
> Explore developer resources, tutorials, API docs, and dynamic examples to get the most out of OpenAI's platform.

And you can make use of the excellent free short courses here

> **[Short Courses](https://www.deeplearning.ai/short-courses/)**
>
> Take your generative AI skills to the next level with short courses from DeepLearning.AI. Enroll today to learn directly from industry leaders, and practice generative AI concepts via hands-on exercises. Available free for a limited time.

---

<div class="post-metadata">

**Author:** ![\_j](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/_j/32/766292_2.png) [@\_j](https://community.openai.com/u/_j)\
**Post date:** [July 24, 2023, 7:44am UTC](https://community.openai.com/t/openai-command-for-finetune/307463/3 "2023-07-24T07:44:07Z")

</div>

One can also run line-by-line tedious commands from within the python shell.

In your operating system:  
C:\users\yourname\> **python**

Then a series of commands entered one at a time (or they can be concatenated with semicolon):

```auto
>>> import openai
>>> openai.api_key = "sk-12345xxxxx"
>>> models = openai.Model.list()
>>> print(models)

```

The above prints a long list of all AI models supported by an account.

Even the command for making a question to the AI is more typing than I want to do. Write a script/program that you just need to edit when you mess up.

---

<div class="post-metadata">

**Author:** ![nrameshsankaralerts](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/nrameshsankaralerts/32/146303_2.png) [@nrameshsankaralerts](https://community.openai.com/u/nrameshsankaralerts)\
**Post date:** [July 24, 2023, 7:51am UTC](https://community.openai.com/t/openai-command-for-finetune/307463/4 "2023-07-24T07:51:26Z")

</div>

Thanks for your reply. I am trying the below from windows and getting failed as “openai” command not found. Fine tuning the model using “openai tools” command

> **[OpenAI Platform](https://platform.openai.com/docs/guides/fine-tuning)**
>
> Explore developer resources, tutorials, API docs, and dynamic examples to get the most out of OpenAI's platform.

---

<div class="post-metadata">

**Author:** ![Foxalabs](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/foxalabs/32/738355_2.png) [@Foxalabs](https://community.openai.com/u/Foxalabs)\
**Post date:** [July 24, 2023, 7:53am UTC](https://community.openai.com/t/openai-command-for-finetune/307463/5 "2023-07-24T07:53:37Z")

</div>

Ahh, I see, have you done a

`pip install --upgrade openai`

?

openai tools should give a response like

![image](https://us1.discourse-cdn.com/openai1/original/3X/8/8/88fc7cbb65a75b398120408cc644ccd019299678.png)

---

<div class="post-metadata">

**Author:** ![EricGT](https://sea2.discourse-cdn.com/openai1/user_avatar/community.openai.com/ericgt/32/20571_2.png) [@EricGT](https://community.openai.com/u/EricGT)\
**Post date:** [December 13, 2023, 6:35pm UTC](https://community.openai.com/t/openai-command-for-finetune/307463/6 "2023-12-13T18:35:45Z")

</div>


