> For the complete documentation index, see [llms.txt](https://help.alianhub.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.alianhub.com/app-installation-and-start-guide/4.-installation-guide/4.6-ai-configuration.md).

# 4.6 AI Configuration

<figure><img src="/files/1w5ZomU9zsfVZd8Fhuj0" alt=""><figcaption></figcaption></figure>

### AI Operations Powered by OpenAI

We utilize OpenAI to enhance the AI capabilities within our web application. This integration ensures advanced, reliable, and efficient AI-driven features for a superior user experience.

### Steps to Generate an API Token for OpenAI

#### Step 1: Sign Up or Log In to OpenAI

1. **Visit OpenAI's Website:**
   * Open your web browser and navigate to [OpenAI's website](https://platform.openai.com/login?launch).
2. **Sign Up or Log In:**

   * If you do not have an account, click on the "Sign Up" button and follow the prompts to create a new account.
   * If you already have an account, click on the "Log In" button and enter your credentials to access your account.

   <figure><img src="/files/qo5AmloWGcIw28bCcBQg" alt=""><figcaption></figcaption></figure>

#### Step 2: Access the API Dashboard

1. **Navigate to the API Section:**
   * Once logged in, go to the Dashboard section of the website. You can usually find this in the main menu.
2. **API Dashboard:**
   * Click on the link or menu item that takes you to the API dashboard. This is where you manage your API keys and settings.

<figure><img src="/files/BLoE35IN8NWv9qnVjR2s" alt=""><figcaption></figcaption></figure>

#### Step 3: Generate a New API Token

1. **Create New API Key:**

   * In the API dashboard, look for a button or link that says "Create New Secret Key". Click on it to start the process.

   <figure><img src="/files/hqYy7ls9Sz27VOqxCV1N" alt=""><figcaption></figcaption></figure>
2. **Specify Key Details:**
   * You may be prompted to provide a name or label for the new API key. This helps you identify the key later, especially if you have multiple keys.
3. **Create Secret Key:**

   * Click on the "Create Secret Key" button to create the new API key.

   <figure><img src="/files/r50P3sGRsqcavkGLqeso" alt=""><figcaption></figcaption></figure>

#### Step 4: Copy and Store the API Token

1. **Copy the Token:**
   * Once the key is generated, it will be displayed on the screen. Copy this key immediately. Some platforms do not show the key again for security reasons.
   * Paste the copied key in the form field in the installation step and choose your preferred AI model.

By following these steps, you can successfully generate a token for OpenAI.

### Add/Update API key later on

**Note:** if you have an **Extended License** then you will get the option to update the API key and gpt models from the admin panel as shown in the below image:

<figure><img src="/files/yIMLJctGlxMX6mC6QtX5" alt=""><figcaption></figcaption></figure>

and if you have any other licenses then you can upate the API key and gpt models using the **.env** file present in the root directory of the project.

<figure><img src="/files/Lfcwg09sdVCgmsCV2nit" alt=""><figcaption></figcaption></figure>

For the API key update the `AI_API_KEY` and for the models, you can change `AI_MODEL` as shown in the below image.

<figure><img src="/files/NPpqCPsMk64jF6iDCzog" alt=""><figcaption></figcaption></figure>

**NOTE:** Please restart the server after the updates and be cautious when updating the **.env** files.
