# 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="/files/5Gzw1Wwevm7vtlrS39Xe" 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="/files/LmsWyJh560DtaqMmfgck" 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="/files/rHNCPBAapQi9oLj9Ziw5" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/0QrFHWqwDlch9t1H6pbX" 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="/files/o6T76OTguz3qpjXzNxY6" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/vFHKUm3pRRDkvyWY5adb" 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="/files/brN179kunVvjmoy22vIW" 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="/files/ANLvt9UimOTbOVW5E7Ag" alt=""><figcaption></figcaption></figure>

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

<figure><img src="/files/SuAmIMc5AFJfRGdVgAUp" 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="/files/yx3QMAKrMmRSuBn6eead" alt=""><figcaption></figcaption></figure>

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

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

3. Enter your card information and billing:

<figure><img src="/files/0i5W3a6ib85a3rjQR56v" 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="/files/BHfLy5EZ5DnOtIeRbnNv" 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="/files/y2FAcIb0DZm72fWtbPvm" alt=""><figcaption></figcaption></figure>


---

# 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://docs.stylemixthemes.com/cost-calculator-builder/calculator-elements/total/ai-assistant-pro-feature.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.
