# OpenAI

### **Configuring PowerPilot (AI) in Power Embedded**

To have an assistant in the portal, you need to configure the following steps:

1. Validate the [prerequisites ](https://docs.powerembedded.com.br/en/portal-de-administracao/power-pilot-ia/pre-requisitos)in the Power BI Admin Portal (you are here).
2. Contract the model on  [Azure OpenAI](https://docs.powerembedded.com.br/en/portal-de-administracao/power-pilot-ia/contratacao-de-uma-ia/azure-openai) or [OpenAI (ChatGPT)](https://docs.powerembedded.com.br/en/portal-de-administracao/power-pilot-ia/contratacao-de-uma-ia/openai)
3. [Create a model ](https://docs.powerembedded.com.br/en/portal-de-administracao/power-pilot-ia/assistentes-de-ia)on Power Embedded
4. [Create an assistant](https://docs.powerembedded.com.br/en/portal-de-administracao/power-pilot-ia/assistentes-de-ia) on Power Embedded

Requirements for Creating an Assistant on the OpenAI Portal

* Have an account registered with OpenAI.
* Have a payment method configured for billing. (It is necessary to have a payment method registered for the assistant to work)

To create the AI access feature, [click on this link.](https://platform.openai.com/assistants)&#x20;

**Step 1** – The first step to create an assistant through OpenAI is to create a "Secret Key". To do this, go to **API Keys > Create new secret key.**

<figure><img src="https://2731617315-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdK3JKuIebMeMb9nnUas8%2Fuploads%2Fgit-blob-c2f24a0c0b96237a5c8a1a93e741a75ef6e0a20c%2Fimage%20(93).png?alt=media" alt=""><figcaption></figcaption></figure>

After clicking on **API Keys or API Key**, you will see a button to validate your phone number if your account is newly created. After validation, you can create your first **API key**.

\
The "Owned By" field can be left as default; define a name for your key and click on "Create secret key"

<div align="left"><figure><img src="https://2731617315-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdK3JKuIebMeMb9nnUas8%2Fuploads%2Fgit-blob-e9e64924c72724e297dc60a60bcd4139cc72b2b4%2Fimage%20(94).png?alt=media" alt=""><figcaption></figcaption></figure></div>

Make sure to copy and store your API key in a secure location. See the example below:

<div align="left"><figure><img src="https://2731617315-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdK3JKuIebMeMb9nnUas8%2Fuploads%2Fgit-blob-a774c856bf990e7c52165fb4c5e6877ef258a30c%2Fimage%20(95).png?alt=media" alt=""><figcaption></figcaption></figure></div>

Copy this key and save it in a notepad. This key is what you will paste in the "Key" field when creating the AI model in the admin portal. It is very important to save this key, as it cannot be recovered once you leave this screen.

**Step 2 –** Defining the Model for Your AI Assistant

<figure><img src="https://2731617315-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdK3JKuIebMeMb9nnUas8%2Fuploads%2Fgit-blob-d1a265bc06c8b04a32b6802ac570cf39df851d0d%2Fimage%20(97).png?alt=media" alt=""><figcaption></figcaption></figure>

When you click on "Create", you are redirected to the model creation tab.

Fill in the name fields and define which AI model will be used. For this documentation, we are using the "gpt-4o-mini" model, which currently has a lower cost per token. Once you fill in the fields, just create the assistant.

<figure><img src="https://2731617315-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FdK3JKuIebMeMb9nnUas8%2Fuploads%2Fgit-blob-7b21facc4c8de20ce8c854d03f57448782498895%2Fimage%20(98).png?alt=media" alt=""><figcaption></figcaption></figure>

Done, now we need to go to the Power Embedded portal to create a model and create an assistant.
