# Create Azure OpenAI API Key

### Step 1: Create Azure OpenAI resource

Go to <https://portal.azure.com/#home>, and click **Create a resource**.

<figure><img src="https://2130568151-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fxe3N3qPZEhbHGWOpdQfl%2Fuploads%2FsImkfPjIFAF64tB7fj4G%2Fazure1.jpg?alt=media&#x26;token=f9358617-2a9d-47b9-a01b-65662ce4010d" alt=""><figcaption></figcaption></figure>

Search for **Azure OpenAI** and select it.

<figure><img src="https://2130568151-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fxe3N3qPZEhbHGWOpdQfl%2Fuploads%2FsCtul5Dfsmtn9oWEv6HF%2Fazure2.jpg?alt=media&#x26;token=eca78158-b7aa-4e01-9964-645e21b90a09" alt=""><figcaption></figcaption></figure>

Select plan and click **Create**.

<figure><img src="https://2130568151-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fxe3N3qPZEhbHGWOpdQfl%2Fuploads%2FEn0F46iyaf1KCseCawQz%2Fazure3.jpg?alt=media&#x26;token=9c140450-5ff2-4229-a8ca-49e59719b6e2" alt=""><figcaption></figcaption></figure>

Enter below information and click **Next**.

<figure><img src="https://2130568151-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fxe3N3qPZEhbHGWOpdQfl%2Fuploads%2FKPdMU7JcSlMDjLv9eizl%2Fazure4.jpg?alt=media&#x26;token=1de1ff45-fca6-4866-91c7-64b3fa3cfcb0" alt=""><figcaption></figcaption></figure>

Configure your network preference and click **Next**.

<figure><img src="https://2130568151-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fxe3N3qPZEhbHGWOpdQfl%2Fuploads%2FMURdv1EQhXfNGgIJt6NX%2Fazure5.jpg?alt=media&#x26;token=30458486-189f-4594-8165-8494a9fcb9e4" alt=""><figcaption></figcaption></figure>

Click **Next**.

<figure><img src="https://2130568151-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fxe3N3qPZEhbHGWOpdQfl%2Fuploads%2F6XLGHjXX0Xnn7NOj6QYa%2Fazure6.jpg?alt=media&#x26;token=298f925c-63cf-438b-abc7-c416c33eacac" alt=""><figcaption></figcaption></figure>

Review and click **Create**.

<figure><img src="https://2130568151-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fxe3N3qPZEhbHGWOpdQfl%2Fuploads%2FzhxIeceHz8o20Vzy1B2Q%2Fazure7.jpg?alt=media&#x26;token=4e80ea83-fc33-4fb9-b1d1-64cbd2c1e54c" alt=""><figcaption></figcaption></figure>

It may take some minutes to deploy new resource.&#x20;

### Step 2: Grab API key, location & endpoint URL

When the resource has been deployed successfully, go back to <https://portal.azure.com/#home> and click on that resource.

<figure><img src="https://2130568151-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fxe3N3qPZEhbHGWOpdQfl%2Fuploads%2FxLtEe0c6jSBzMOqHu53X%2Fazure8.jpg?alt=media&#x26;token=52900777-b479-4a3f-992e-d22193de0462" alt=""><figcaption></figcaption></figure>

On tab **Overview**, copy key, location/region and endpoint URL. You will need them later.

<figure><img src="https://2130568151-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fxe3N3qPZEhbHGWOpdQfl%2Fuploads%2F8d0fkh1u1rH5s1hHSAiu%2Fazure9.jpg?alt=media&#x26;token=390228a5-c1e9-469a-ae86-4e21c84e8bd9" alt=""><figcaption></figcaption></figure>

### Step 3: Create new deployment

Switch to tab **Model deployments** and click **Manage Deployments**. You will be redirect to Azure OpenAI Studio.

<figure><img src="https://2130568151-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fxe3N3qPZEhbHGWOpdQfl%2Fuploads%2FvEjRZANeGcAG4Jtg0PUB%2Fazure10_1.jpg?alt=media&#x26;token=67998f76-b253-4992-a616-060315819cd2" alt=""><figcaption></figcaption></figure>

Click **Create new deployments**.

<figure><img src="https://2130568151-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fxe3N3qPZEhbHGWOpdQfl%2Fuploads%2FoD5yudn0c78CWYpO20FF%2Fazure11.jpg?alt=media&#x26;token=1fb85165-3679-41e6-abe1-55c192193ac0" alt=""><figcaption></figcaption></figure>

Enter deployment model information and click **Create**. It may take some minutes to start a deployment.

<figure><img src="https://2130568151-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fxe3N3qPZEhbHGWOpdQfl%2Fuploads%2F8XjPFjMM6mvddLCOCC6V%2Fazure12.jpg?alt=media&#x26;token=23a0ad9b-7ded-42a9-a6fe-58824cac0b60" alt=""><figcaption></figcaption></figure>

Copy the deployment name.

<figure><img src="https://2130568151-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fxe3N3qPZEhbHGWOpdQfl%2Fuploads%2FvUyzcbaYRWACALwR6cRQ%2Fazure13.jpg?alt=media&#x26;token=6f374a71-e8ab-447f-aefe-6824ef8def70" alt=""><figcaption></figcaption></figure>

### Step 4: Construct full endpoint URL

Full endpoint URL has this format:&#x20;

> {your-endpoint}/openai/deployments/{deployment-id}/chat/completions?api-version={api-version}

where:

* your-endpoint: is the endpoint copied from [#step-2-grab-api-key-location-and-endpoint-url](#step-2-grab-api-key-location-and-endpoint-url "mention")&#x20;
* deployment-id: deployment name from [#step-3-create-new-deployment](#step-3-create-new-deployment "mention")
* api-version: use 2023-05-15 for now

For example: <https://mindmac.openai.azure.com/openai/deployments/mindmac-gpt-35-turbo/chat/completions?api-version=2023-05-15>.

Now use this full URL and the key from [#step-2-grab-api-key-location-and-endpoint-url](#step-2-grab-api-key-location-and-endpoint-url "mention") to create new API endpoint in MindMac. More details at [](https://docs.mindmac.app/how-to.../add-api-key "mention").


---

# 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.mindmac.app/how-to.../add-api-key/create-azure-openai-api-key.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.
