> For the complete documentation index, see [llms.txt](https://modelmesh.gitbook.io/cline-zhong-wen-ban-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://modelmesh.gitbook.io/cline-zhong-wen-ban-docs/ollama.md).

# Ollama

#### 📋 Prerequisites <a href="#prerequisites" id="prerequisites"></a>

* Windows, macOS, or Linux computer
* Cline installed in VS Code

#### 🚀 Setup Steps <a href="#setup-steps" id="setup-steps"></a>

**1. Install Ollama**

* Visit [ollama.com](https://ollama.com/)
* Download and install for your operating system

![](https://docs.cline.bot/~gitbook/image?url=https%3A%2F%2F3321249260-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252Ff8Oh1Lcy6yWYq1caYESV%252Fuploads%252F8z5yfpC0EHIHSKaSkKQk%252Fimage.png%3Falt%3Dmedia%26token%3D04a389e5-76bd-46d7-a54d-68ecbb5dee5e\&width=768\&dpr=4\&quality=100\&sign=27783f58\&sv=2)

**2. Choose and Download a Model**

* Browse models at [ollama.com/search](https://ollama.com/search)
* Select model and copy command:

  Copy

  ```
  ollama run [model-name]
  ```

![](https://docs.cline.bot/~gitbook/image?url=https%3A%2F%2F3321249260-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252Ff8Oh1Lcy6yWYq1caYESV%252Fuploads%252F5qasRAyYhybTUUqf3oC4%252Follama-model-grab.gif%3Falt%3Dmedia%26token%3D4af97fbf-b43c-46d7-bd42-19d0696fd57d\&width=768\&dpr=4\&quality=100\&sign=96346b63\&sv=2)

* Open your Terminal and run the command:
  * Example:

    Copy

    ```
    ollama run llama2
    ```

![](https://docs.cline.bot/~gitbook/image?url=https%3A%2F%2F3321249260-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252Ff8Oh1Lcy6yWYq1caYESV%252Fuploads%252FJKxtNSs0rV7EdEpnYqHJ%252Fstarting-ollama-terminal.gif%3Falt%3Dmedia%26token%3D0c48b366-eef5-46fc-a97d-b87310ed83c5\&width=768\&dpr=4\&quality=100\&sign=f354b3f5\&sv=2)

**✨ Your model is now ready to use within Cline!**

**3. Configure Cline**

1. Open VS Code
2. Click Cline settings icon
3. Select "Ollama" as API provider
4. Enter configuration:
   * Base URL: `http://localhost:11434/` (default value, can be left as is)
   * Select the model from your available options

![](https://docs.cline.bot/~gitbook/image?url=https%3A%2F%2F3321249260-files.gitbook.io%2F%7E%2Ffiles%2Fv0%2Fb%2Fgitbook-x-prod.appspot.com%2Fo%2Fspaces%252Ff8Oh1Lcy6yWYq1caYESV%252Fuploads%252F9tGgGtdYlMhc1KNmEwcw%252Fselecting-ollama-model-cline.gif%3Falt%3Dmedia%26token%3Dcdc4792a-9a0b-4016-9b46-8d98e7b10bf3\&width=768\&dpr=4\&quality=100\&sign=ae75d61c\&sv=2)

#### ⚠️ Important Notes <a href="#important-notes" id="important-notes"></a>

* Start Ollama before using with Cline
* Keep Ollama running in background
* First model download may take several minutes

#### 🔧 Troubleshooting <a href="#troubleshooting" id="troubleshooting"></a>

If Cline can't connect to Ollama:

1. Verify Ollama is running
2. Check base URL is correct
3. Ensure model is downloaded

Need more info? Read the [Ollama Docs](https://github.com/ollama/ollama/blob/main/docs/api.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://modelmesh.gitbook.io/cline-zhong-wen-ban-docs/ollama.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
