> For the complete documentation index, see [llms.txt](https://docs.tabnine.com/main/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tabnine.com/main/getting-started/tabnine-cli/features/model-selection.md).

# Model Selection

Choose which AI model powers your Tabnine CLI interactions.

### Opening the Model Dialog

```bash
/model
```

This opens an interactive dialog showing available models.

### Available Models

Tabnine CLI uses the same models described on the [AI Models](/main/welcome/readme/ai-models.md) page.

### Changing Models

#### Via `/model` Command

{% stepper %}
{% step %}
**Open the model dialog**

Run:

```bash
/model
```

This opens the interactive model selection dialog.
{% endstep %}

{% step %}
**Navigate**

Use the arrow keys or `J` / `K` to move through available models.
{% endstep %}

{% step %}
**Select**

Press `Enter` to select the highlighted model.
{% endstep %}

{% step %}
**Immediate effect**

Model changes take effect immediately after selection.
{% endstep %}
{% endstepper %}

#### Via `/model set` (Non-Interactive)

You can also change the model without opening the dialog:

```bash
/model set <model-name>
```

This sets the model for the current session only. To persist the change across sessions, add the `--persist` flag:

```bash
/model set <model-name> --persist
```

#### Via `--model` Flag

Specify the model when launching Tabnine CLI:

```bash
tabnine --model <model-name>
```

The `-m` short form also works:

```bash
tabnine -m <model-name>
```

#### Via Environment Variable

Set the `TABNINE_MODEL` environment variable before launching:

```bash
TABNINE_MODEL=<model-name> tabnine
```

### Model Selection Precedence

When multiple sources specify a model, the following precedence applies (highest to lowest):

1. `--model` command-line flag (or `-m`)
2. `TABNINE_MODEL` environment variable
3. `model.name` in `settings.json`
4. Default model from Tabnine service

### Model Information

View current session statistics (including token usage):

```bash
/stats
```

View current model and context usage in the footer (shown if enabled in settings).

#### Token Limits

Tabnine CLI automatically manages token limits based on the selected model.

### Fallback Behavior

If your selected model is unavailable, Tabnine CLI may:

1. Prompt you to select another model
2. Automatically fall back to a default model (depending on settings)

### Model Persistence

Your model selection is saved and persists across sessions when using:

* `/model set <model-name> --persist` — writes `model.name` to `settings.json`
* The interactive `/model` dialog — persists your selection automatically

Persistent selections are stored in `.tabnine/agent/settings.json`.

### Fast Model Configuration

You can configure a lightweight model to handle background CLI tasks, reducing latency for operations the user never directly sees. To configure a fast model, add `"fastModel": "<model-name>"` to your `settings.json` or use the `/model fast` slash command in the CLI.

The following tasks are routed to the fast model when one is configured:

* Session summary
* Shell output summary
* Tool output summary
* Edit corrector
* Fast ack helper
* Loop detection (primary pass)
* LLM edit fixer

Loop detection double-check and next-speaker checker remain on the main model, as they require higher-confidence reasoning. When no fast model is configured, all tasks use the main model. The fast model setting is provider-agnostic and works with any model the backend supports.


---

# 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://docs.tabnine.com/main/getting-started/tabnine-cli/features/model-selection.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.
