# AI Assistant (Pro feature)

The **Cost Calculator Builder** plugin includes a powerful **AI Assistant** integrated directly into the Formula field. This feature leverages **OpenAI’s GPT model**, allowing users to create complex formulas by simply writing prompts in plain English.

**The AI Assistant** takes the hassle out of writing formulas by translating your instructions into a fully functional calculation. Whether you’re creating a simple arithmetic formula or a more complex conditional expression, the AI **handles it for you.**

<figure><img src="https://834137925-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MDTO7zmTA5-HpvK8JDA%2Fuploads%2FeoCVDF2Ve2LoOAendVJ4%2Fimage.png?alt=media&#x26;token=5b7d27f5-9096-4612-9805-02d1e6187d3d" alt=""><figcaption></figcaption></figure>

## How to obtain OpenAI API

{% hint style="warning" %}
Please note that using OpenAI’s API **is NOT free**. Users need to have an active subscription that suits their usage requirements.

* [**How to Set up Billing?**](#how-to-set-up-billing)
  {% endhint %}

1. &#x20;Go to the <https://platform.openai.com/api-keys> and login to the system:

<figure><img src="https://834137925-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MDTO7zmTA5-HpvK8JDA%2Fuploads%2Fp4og8TuHquOTHPFpa4ND%2Fimage.png?alt=media&#x26;token=a2d31a36-627d-4fe9-a35f-f118703d3d5c" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
If you have not done it before, you might be asked to **verify your phone number.**
{% endhint %}

<figure><img src="https://834137925-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MDTO7zmTA5-HpvK8JDA%2Fuploads%2FQ30HY3eXRXyVQZv7kLiB%2Fimage.png?alt=media&#x26;token=9e2fab0f-cd7e-44ad-856e-62c118aef419" alt=""><figcaption></figcaption></figure>

2. Click on the **Create new secret key** button:

<figure><img src="https://834137925-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MDTO7zmTA5-HpvK8JDA%2Fuploads%2FXag3EyepT5oy2Nc0omHx%2Fimage.png?alt=media&#x26;token=d0120fbb-a079-4054-aacd-4631e541d2dc" alt=""><figcaption></figcaption></figure>

3. Set the parameters **as above**, **name** your project according to your needs, and click on **Create Secret Key:**

<figure><img src="https://834137925-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MDTO7zmTA5-HpvK8JDA%2Fuploads%2Fh2aivSkstUtrzK7rVZHZ%2Fimage.png?alt=media&#x26;token=02489c27-adf7-47f0-a30e-5f37e8e5a262" alt=""><figcaption></figcaption></figure>

4. Copy the generated **Secret Key:**

<figure><img src="https://834137925-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MDTO7zmTA5-HpvK8JDA%2Fuploads%2FbsbDpzpt3nIrMlAQNwCu%2Fimage.png?alt=media&#x26;token=055dcb25-0ffe-4a9a-a3d2-ddba04bdb912" alt=""><figcaption></figcaption></figure>

5. Follow Cost Calculator **Global Settings > AI Formula** and paste the key to the designated area. Save the changes:

<figure><img src="https://834137925-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MDTO7zmTA5-HpvK8JDA%2Fuploads%2F4If16kpHq6gmUjVP9LQu%2Fimage.png?alt=media&#x26;token=106740ba-048a-42f2-b6e2-0e42213a4c83" alt=""><figcaption></figcaption></figure>

If this is your first time using the AI Assistant within the calculator, you can paste the API key directly into the calculator as well, and it will be saved for future uses:

<figure><img src="https://834137925-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MDTO7zmTA5-HpvK8JDA%2Fuploads%2FrXz76cx0MRsVM6MAQNi1%2Fimage.png?alt=media&#x26;token=8d5b0df0-076d-4e5b-b41e-3d020fa8a49d" alt=""><figcaption></figcaption></figure>

6. And you are **done, happy using:**

<figure><img src="https://834137925-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MDTO7zmTA5-HpvK8JDA%2Fuploads%2FbOGvzkok0JlfecwziDL4%2Fimage.png?alt=media&#x26;token=79ee1588-b81a-40da-bf0a-8ffd51712167" alt=""><figcaption></figcaption></figure>

## How to Set up Billing

OpenAI charges for its API based on usage, so if you haven’t already set up a payment method for billing, you’ll need to do so. **Otherwise, the API key you created won’t function.**

{% embed url="<https://openai.com/api/pricing>" %}

1. To begin, click the settings (cog) icon in the top right corner of the API keys screen:

<figure><img src="https://834137925-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MDTO7zmTA5-HpvK8JDA%2Fuploads%2FUkP5qe6EIludZVmCQBZb%2Fimage.png?alt=media&#x26;token=67843173-a7e2-4ee9-a6e6-f879846b3204" alt=""><figcaption></figcaption></figure>

2. On the opened page move to the **Billing tab a**nd click on **Add Payment Details:**

<figure><img src="https://834137925-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MDTO7zmTA5-HpvK8JDA%2Fuploads%2FnCM9CdYlhY5NqKSDwnHS%2Fimage.png?alt=media&#x26;token=5e703643-6e78-4208-a4a7-bd38c7f3bf75" alt=""><figcaption></figcaption></figure>

3. Enter your card information and billing:

<figure><img src="https://834137925-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MDTO7zmTA5-HpvK8JDA%2Fuploads%2F71NFAU79eERulKF7oWdd%2Fimage.png?alt=media&#x26;token=bfe58792-340d-4576-9344-3bfcf0ce6d87" alt=""><figcaption></figcaption></figure>

4. Set up the payment amount and/or automatic recharge settings according to your needs, and initiate the payment:

<figure><img src="https://834137925-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MDTO7zmTA5-HpvK8JDA%2Fuploads%2F2KJ9VU8cS8bEAO0hpTNt%2Fimage.png?alt=media&#x26;token=817f9ea5-5612-431f-bc3c-4964f52d338b" alt=""><figcaption></figcaption></figure>

5. Now that you’ve set up billing, it’s a good idea to set usage limits to control your monthly API spending. Simply click **Limits** in the left menu, set your desired monthly budget, and choose an email notification threshold according to your needs. Finally, click **Save** to apply your settings.

<figure><img src="https://834137925-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MDTO7zmTA5-HpvK8JDA%2Fuploads%2FI64T9S0YxgyElTvvWSOb%2Fimage.png?alt=media&#x26;token=dc07853e-a486-42b8-9d4f-ebf4ed81a1cd" alt=""><figcaption></figcaption></figure>
