# 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.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.alianhub.com/app-installation-and-start-guide/4.-installation-guide/4.6-ai-configuration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
