# language_models: Add \`auto_discover\` setting for Ollama \(\#42207\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/ebd5a50cce74b1e903a1403a3e5f38ddff93b0c4)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: ebd5a50cce74b1e903a1403a3e5f38ddff93b0c4

Requested commit: ebd5a50cce74b1e903a1403a3e5f38ddff93b0c4

Commit: ebd5a50cce74b1e903a1403a3e5f38ddff93b0c4

Tree: ec234f72fc43b4eb08009bc40b5b132254675759

Author: Patrick Elsen

Committer: GitHub

## Message

````
language_models: Add `auto_discover` setting for Ollama (#42207)

First up: I'm sorry if this is a low quality PR, or if this feature
isn't wanted. I implemented this because I'd like to have this
behaviour. If you don't think that this is useful, feel free to close
the PR without comment. :)

My idea is this: I love to pull random models with Ollama to try them.
At the same time, not all of them are useful for coding, or some won't
work out of the box with the context_length set. So, I'd like to change
Zed's behaviour to not show me all models Ollama has, but to limit it to
the ones that I configure manually.

What I did is add an `auto_discover` field to the settings. The idea is
that you can write a config like this:

```json
"language_models": {
    "ollama": {
      "api_url": "http://localhost:11434",
      "auto_discover": false,
      "available_models": [
        {
          "name": "qwen3:4b",
          "display_name": "Qwen3 4B 32K",
          "max_tokens": 32768,
          "supports_tools": true,
          "supports_thinking": true,
          "supports_images": true
        }
      ]
    }
  }
```

The `auto_discover: false` means that Zed won't pick up or show the
language models that Ollama knows about, and will only show me the one I
manually configured in `available_models`. That way, I can pull random
models with Ollama, but in Zed I can only see the ones that I know work
(because I've configured them).

The default for `auto_discover` (when it is not explicitly set) is
`true`, meaning that the existing behaviour is preserved, and this is
not a breaking change for configurations.

Release Notes:

- ollama: Added `auto_discover` setting to optionally limit visible
models to only those manually configured in `available_models`
````

## Parents

- [f760233704f927ea778b14bdb8121c085bf8b654](https://git.cafe/gitcafe/zed/commit/f760233704f927ea778b14bdb8121c085bf8b654?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/ebd5a50cce74b1e903a1403a3e5f38ddff93b0c4?format=markdown)
