> For the complete documentation index, see [llms.txt](https://docs.mindmac.app/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.mindmac.app/how-to.../add-ollama-endpoint.md).

# Add Ollama endpoint

## Prerequisite

* Ollama version: 0.1.19 or later
* Running at least one model under Ollama

## Add endpoint

Go to **MindMac** -> **Settings...** -> **Account** or press <mark style="color:purple;">**⌘**</mark> + <mark style="color:purple;">**,**</mark> to open Account Setting.

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

* Select **Ollama** as provider
* Enter a name
* If you don't change any Ollama configuration, just use <http://localhost:11434/api/chat> as URL
* Enter a random text in API Key text area
* Click **Save** to finish

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

***

## Customize Context Length (Optional)

Currently Ollama does not provide exact context length for each model, so if you want to control **max tokens** (or context length) parameter,  you might need to enter that value manually for every Ollama model. Follow below steps to do so.

Go to **MindMac** -> **Settings...** -> **Account** or press <mark style="color:purple;">**⌘**</mark> + <mark style="color:purple;">**,**</mark> to open Account Setting.

Click on the brain icon to show Ollama model list.

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

Click on the edit button.

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

Enter max tokens value for that model and click **Save** to finish.

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

To get max tokens value for each model, you can find in configuration file (**config.json** for example) of that model on Hugging Face. For instance, with the model [Mixtral-8x7B-Instruct-v0.1](https://huggingface.co/mistralai/Mixtral-8x7B-Instruct-v0.1) , you can go to <https://huggingface.co/mistralai/Mixtral-8x7B-Instruct-v0.1/blob/main/config.json> and grab the value **max\_position\_embeddings** as its context length. Kindly be aware that there is no standard specifying which key determines the context length of a model in the model configuration file.

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