> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gourmand.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Gobi Autocomplete Setup and Configuration Guide

> Step-by-step guide to setting up and configuring autocomplete in Gobi, including Codestral, Ollama, and IDE settings.

export const ModelRecommendations = ({role = "all"}) => {
  const parseMarkdownLinks = text => {
    const regex = /\[([^\]]+)\]\(([^)]+)\)/g;
    const parts = [];
    let lastIndex = 0;
    let match;
    let key = 0;
    while ((match = regex.exec(text)) !== null) {
      if (match.index > lastIndex) {
        const beforeText = text.slice(lastIndex, match.index);
        if (beforeText) {
          parts.push(<span key={key++}>{beforeText}</span>);
        }
      }
      const [, linkText, url] = match;
      parts.push(<a key={key++} href={url} target="_blank" rel="noopener noreferrer" style={{
        color: "#0066cc",
        textDecoration: "underline"
      }}>
          {linkText}
        </a>);
      lastIndex = regex.lastIndex;
    }
    if (lastIndex < text.length) {
      const remainingText = text.slice(lastIndex);
      if (remainingText) {
        parts.push(<span key={key++}>{remainingText}</span>);
      }
    }
    return parts.length > 0 ? parts : text;
  };
  const modelRecs = {
    agent_plan: {
      open: ["[Qwen3 Coder (480B)](https://hub.gourmand.dev/openrouter/qwen3-coder)", "[Qwen3 Coder (30B)](https://hub.gourmand.dev/ollama/qwen3-coder-30b)", "[Devstral (27B)](https://hub.gourmand.dev/ollama/devstral)", "[Kimi K2 (1T)](https://hub.gourmand.dev/openrouter/kimi-k2)", "[gpt-oss (120B)](https://hub.gourmand.dev/openrouter/gpt-oss-120b)", "[gpt-oss (20B)](https://hub.gourmand.dev/ollama/gpt-oss-20b)", "[GLM 4.5 (355B)](https://hub.gourmand.dev/openrouter/glm-4-5)", "[GLM 4.5 Air (106B)](https://hub.gourmand.dev/openrouter/glm-4-5-air)"],
      closed: ["[Claude Opus 4.1](https://hub.gourmand.dev/anthropic/claude-4-1-opus)", "[Claude Sonnet 4](https://hub.gourmand.dev/anthropic/claude-4-sonnet)", "[GPT-5](https://hub.gourmand.dev/openai/gpt-5)", "[Gemini 2.5 Pro](https://hub.gourmand.dev/google/gemini-2.5-pro)"],
      notes: "Closed models are slightly better than open models"
    },
    chat_edit: {
      open: ["[Qwen3 Coder (480B)](https://hub.gourmand.dev/openrouter/qwen3-coder)", "[Qwen3 Coder (30B)](https://hub.gourmand.dev/ollama/qwen3-coder-30b)", "[gpt-oss (120B)](https://hub.gourmand.dev/openrouter/gpt-oss-120b)", "[gpt-oss (20B)](https://hub.gourmand.dev/ollama/gpt-oss-20b)"],
      closed: ["[Claude Opus 4.1](https://hub.gourmand.dev/anthropic/claude-4-1-opus)", "[Claude Sonnet 4](https://hub.gourmand.dev/anthropic/claude-4-sonnet)", "[GPT-5](https://hub.gourmand.dev/openai/gpt-5)", "[Gemini 2.5 Pro](https://hub.gourmand.dev/google/gemini-2.5-pro)"],
      notes: "Closed and open models have pretty similar performance"
    },
    autocomplete: {
      open: ["[QwenCoder2.5 (1.5B)](https://hub.gourmand.dev/ollama/qwen2.5-coder-1.5b)", "[QwenCoder2.5 (7B)](https://hub.gourmand.dev/ollama/qwen2.5-coder-7b)"],
      closed: ["[Codestral](https://hub.gourmand.dev/mistral/codestral)", "[Mercury Coder](https://hub.gourmand.dev/inception/mercury-coder)"],
      notes: "Closed models are slightly better than open models"
    },
    apply: {
      open: ["N/A"],
      closed: ["[Relace Instant Apply](https://hub.gourmand.dev/relace/instant-apply)", "[Morph Fast Apply](https://hub.gourmand.dev/morphllm/morph-v2)"],
      notes: "Open models are not good enough for this model role"
    },
    embed: {
      open: ["[Nomic Embed Text](https://hub.gourmand.dev/ollama/nomic-embed-text-latest)", "Qwen3 Embedding"],
      closed: ["[Voyage Code 3](https://hub.gourmand.dev/voyageai/voyage-code-3)", "[Morph Embeddings](https://hub.gourmand.dev/morphllm/morph-embedding-v2)", "Codestral Embed"],
      notes: "Closed models are slightly better than open models"
    },
    rerank: {
      open: ["zerank-1", "zerank-1-small", "Qwen3 Reranker"],
      closed: ["[Voyage Rerank 2.5](https://hub.gourmand.dev/voyageai/rerank-2-5)", "Relace Code Rerank", "[Morph Rerank](https://hub.gourmand.dev/morphllm/morph-rerank-v2)"],
      notes: "Open models are beginning to emerge for this model role"
    },
    next_edit: {
      open: ["[Instinct](https://hub.gourmand.dev/gobi/instinct)"],
      closed: ["[Mercury Coder](https://hub.gourmand.dev/inception/mercury-coder)"],
      notes: "Closed models are better than open models"
    }
  };
  let rolesToShow = [];
  if (!role || role === "all") {
    rolesToShow = Object.keys(modelRecs);
  } else {
    const key = role.toLowerCase().replace(/\s|\//g, "_").replace(/-/g, "_");
    if (modelRecs[key]) {
      rolesToShow = [key];
    }
  }
  if (rolesToShow.length === 0) {
    return <div>No recommendations found for role: {role}</div>;
  }
  return <table style={{
    width: "100%",
    borderCollapse: "collapse",
    marginTop: "1rem"
  }}>
      <thead>
        <tr>
          <th style={{
    textAlign: "left",
    borderBottom: "1px solid #ddd",
    padding: "8px"
  }}>
            Model role
          </th>
          <th style={{
    textAlign: "left",
    borderBottom: "1px solid #ddd",
    padding: "8px"
  }}>
            Best open models
          </th>
          <th style={{
    textAlign: "left",
    borderBottom: "1px solid #ddd",
    padding: "8px"
  }}>
            Best closed models
          </th>
          <th style={{
    textAlign: "left",
    borderBottom: "1px solid #ddd",
    padding: "8px"
  }}>
            Notes
          </th>
        </tr>
      </thead>
      <tbody>
        {rolesToShow.map(roleKey => {
    const rec = modelRecs[roleKey];
    if (!rec) return null;
    return <tr key={roleKey}>
              <td style={{
      fontWeight: 600,
      verticalAlign: "top",
      padding: "8px"
    }}>
                {roleKey.replace(/_/g, " ").replace(/\b\w/g, l => l.toUpperCase())}
              </td>
              <td style={{
      padding: "8px",
      verticalAlign: "top"
    }}>
                {rec.open.map((m, i) => <div key={i} style={{
      marginBottom: "4px"
    }}>
                    {parseMarkdownLinks(m)}
                  </div>)}
              </td>
              <td style={{
      padding: "8px",
      verticalAlign: "top"
    }}>
                {rec.closed.map((m, i) => <div key={i} style={{
      marginBottom: "4px"
    }}>
                    {parseMarkdownLinks(m)}
                  </div>)}
              </td>
              <td style={{
      padding: "8px",
      verticalAlign: "top"
    }}>
                {rec.notes}
              </td>
            </tr>;
  })}
      </tbody>
    </table>;
};

## Model Recommendations for Autocomplete

<ModelRecommendations role="autocomplete" />

## How to Set Up Autocomplete in Gobi with Codestral (Recommended)

If you want to have the best autocomplete experience, we recommend using Codestral, which is available through the [Mistral API](https://console.mistral.ai/). To do this, obtain an API key and add it to your config:

<Tabs>
  <Tab title="Hub">
    [Mistral Codestral model block](https://hub.gourmand.dev/mistral/codestral)
  </Tab>

  <Tab title="YAML">
    ```yaml title="config.yaml" theme={null}
    models:
      - name: Codestral
        provider: mistral
        model: codestral-latest
        apiKey: <YOUR_CODESTRAL_API_KEY>
        roles:
          - autocomplete
    ```
  </Tab>

  <Tab title="JSON">
    ```json title="config.json" theme={null}
    {
      "tabAutocompleteModel": {
        "title": "Codestral",
        "provider": "mistral", 
        "model": "codestral-latest",
        "apiKey": "<YOUR_CODESTRAL_API_KEY>"
      }
    }
    ```
  </Tab>
</Tabs>

<Tip>
  **Codestral API Key**: The API keys for Codestral and the general Mistral APIs
  are different. If you are using Codestral, you probably want a Codestral API
  key, but if you are sharing the key as a team or otherwise want to use
  `api.mistral.ai`, then make sure to set `"apiBase":
      "https://api.mistral.ai/v1"` in your `tabAutocompleteModel`.
</Tip>

## How to Set Up Autocomplete in Gobi with Ollama (Local Model)

If you'd like to run your autocomplete model locally, we recommend using Ollama. To do this, first download the latest version of Ollama from [here](https://ollama.ai). Then, run the following command to download our recommended model:

```bash theme={null}
ollama run qwen2.5-coder:1.5b
```

Then, add the model to your configuration:

<Tabs>
  <Tab title="Hub">
    [Ollama Qwen 2.5 Coder 1.5B model block](https://hub.gourmand.dev/ollama/qwen2.5-coder-1.5b)
  </Tab>

  <Tab title="YAML">
    ```yaml title="config.yaml" theme={null}
    models:
      - name: Qwen 1.5b Autocomplete Model
        provider: ollama
        model: qwen2.5-coder:1.5b
        roles:
          - autocomplete
    ```
  </Tab>

  <Tab title="JSON">
    ```json title="config.json" theme={null}
    {
      "tabAutocompleteModel": {
        "title": "Qwen 1.5b Autocomplete Model",
        "provider": "ollama", 
        "model": "qwen2.5-coder:1.5b",
      }
    }
    ```
  </Tab>
</Tabs>

Once the model has been downloaded, you should begin to see completions in VS Code.

<Note>
  Typically, thinking-type models are not recommended as they generate more
  slowly and are not suitable for scenarios that require speed.
</Note>

However, if you use any thinking-switchable models, you can configure these models for autocomplete functions by turning off the thinking mode.

For example:

<Tabs>
  <Tab title="YAML">
    ```yaml title="config.yaml" theme={null}
    models:
      - name: Qwen3 without Thinking for Autocomplete
        provider: ollama
        model: qwen3:4b # qwen3 is a thinking-switchable model
        roles:
          - autocomplete
        requestOptions:
          extraBodyProperties:
            think: false # turning off the thinking
    ```
  </Tab>
</Tabs>

Then, in the gobi panel, select this model as the default model for autocomplete.

## Autocomplete Configuration Options in Gobi

### Autocomplete Models Available on the Gobi Hub

Explore autocomplete model configurations on [the hub](https://hub.gourmand.dev/explore/models?roles=autocomplete)

### Customize Autocomplete User Settings in the Gobi Extension

The following settings can be configured for autocompletion in the IDE extension User Settings Page:

* `Multiline Autocompletions`: Controls multiline completions for autocomplete. Can be set to `always`, `never`, or `auto`. Defaults to `auto`
* `Disable autocomplete in files`: List of comma-separated glob pattern to disable autocomplete in matching files. E.g., "\_/.md, \*/.txt"

### How to Configure Autocomplete with `config.json` (Deprecated Format)

#### YAML Configuration

The `config.yaml` format offers model-level configuration using the `autocompleteOptions` field. See the [YAML Reference](/reference#models) for more details.

```yaml theme={null}
models:
  - name: Codestral
    provider: mistral
    model: codestral-latest
    roles:
      - autocomplete
    autocompleteOptions:
      disable: false
      maxPromptTokens: 1024
      debounceDelay: 250
      modelTimeout: 150
      maxSuffixPercentage: 0.2
      prefixPercentage: 0.3
      onlyMyCode: true
```

#### JSON Configuration (Deprecated)

The `config.json` configuration format offers configuration options through `tabAutocompleteOptions`. See the [JSON Reference](/reference/json-reference#tabautocomplete-options) for more details.

## Autocomplete FAQs and Troubleshooting in Gobi

### I want better completions, should I use GPT-4?

Perhaps surprisingly, the answer is no. The models that we suggest for autocomplete are trained with a highly specific prompt format, which allows them to respond to requests for completing code (see examples of these prompts [here](https://github.com/gourmand/gobi/blob/main/core/autocomplete/templating/AutocompleteTemplate.ts)). Some of the best commercial models like GPT-4 or Claude are not trained with this prompt format, which means that they won't generate useful completions. Luckily, a huge model is not required for great autocomplete. Most of the state-of-the-art autocomplete models are no more than 10b parameters, and increasing beyond this does not significantly improve performance.

### Autocomplete Not Working – How to Fix It

Follow these steps to ensure that everything is set up correctly:

1. Make sure you have the "Enable Tab Autocomplete" setting checked (in VS Code, you can toggle by clicking the "Gobi" button in the status bar, and in JetBrains by going to Settings -> Tools -> Gobi).
2. Make sure you have downloaded Ollama.
3. Run `ollama run qwen2.5-coder:1.5b` to verify that the model is downloaded.
4. Make sure that any other completion providers are disabled (e.g. Copilot), as they may interfere.
5. Check the output of the logs to find any potential errors: <kbd>cmd/ctrl</kbd> + <kbd>shift</kbd> + <kbd>P</kbd> -> "Toggle Developer Tools" -> "Console" tab in VS Code, \~/.gobi/logs/core.log in JetBrains.
6. Check VS Code settings to make sure that `"editor.inlineSuggest.enabled"` is set to `true` (use <kbd>cmd/ctrl</kbd> + <kbd>,</kbd> then search for this and check the box)
7. If you are still having issues, please let us know in our [Discord](https://discord.gg/TODO) and we'll help as soon as possible.

### Why Are My Completions Only Single-Line?

To ensure that you receive multi-line completions, you can set `"multilineCompletions": "always"` in `tabAutocompleteOptions`. By default, it is `"auto"`. If you still find that you are only seeing single-line completions, this may be because some models tend to produce shorter completions when starting in the middle of a file. You can try temporarily moving text below your cursor out of your active file, or switching to a larger model.

### How to Set a Trigger Key for Autocomplete Suggestions

In VS Code, if you don't want to be shown suggestions automatically you can:

1. Set `"editor.inlineSuggest.enabled": false` in VS Code settings to disable automatic suggestions
2. Open "Keyboard Shortcuts" (cmd/ctrl+k, cmd/ctrl+s) and search for `editor.action.inlineSuggest.trigger`
3. Click the "+" icon to add a new keybinding
4. Press the key combination you want to use to trigger suggestions (e.g. <kbd>cmd/ctrl</kbd> + <kbd>space</kbd>)
5. Now whenever you want to see a suggestion, you can press your key binding (e.g. <kbd>cmd/ctrl</kbd> + <kbd>space</kbd>) to trigger suggestions manually

### Shortcut for Accepting One Line at a Time in Autocomplete

This is a built-in feature of VS Code, but it's just a bit hidden. Follow these settings to reassign the keyboard shortcuts in VS Code:

1. Press <kbd>Ctrl</kbd>+<kbd>Shift</kbd>+<kbd>P</kbd>, type the command: `Preferences: Open Keyboard Shortcuts`, and enter the keyboard shortcuts settings page.
2. Search for `editor.action.inlineSuggest.acceptNextLine`.
3. Set the key binding to <kbd>Tab</kbd>.
4. Set the trigger condition (when) to `inlineSuggestionVisible && !editorReadonly`.
   This will make multi-line completion (including gobi and from VS Code built-in or other plugin snippets) still work, and you will see multi-line completion. However, Tab will only fill in one line at a time. Any unnecessary code can be canceled with <kbd>Esc</kbd>.
   If you need to apply all the code, just press <kbd>Tab</kbd> multiple times.

### How to Turn Off Autocomplete in Gobi (VS Code and JetBrains)

#### VS Code

Click the "Gobi" button in the status panel at the bottom right of the screen. The checkmark will become a "cancel" symbol and you will no longer see completions. You can click again to turn it back on.

Alternatively, open VS Code settings, search for "Gobi" and uncheck the box for "Enable Tab Autocomplete".

You can also use the default shortcut to disable autocomplete directly using a chord: press and hold <kbd>ctrl/cmd</kbd> + <kbd>K</kbd> (gobi holding <kbd>ctrl/cmd</kbd>) and press <kbd>ctrl/cmd</kbd> + <kbd>A</kbd>. This will turn off autocomplete without navigating through settings.

#### JetBrains

Open Settings -> Tools -> Gobi and uncheck the box for "Enable Tab Autocomplete".

#### Feedback

If you're turning off autocomplete, we'd love to hear how we can improve! Please let us know in our [Discord](https://discord.gg/TODO) or file an issue on GitHub.
