# 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`.

### See Also

* [Commands](/main/getting-started/tabnine-cli/features/commands.md)
* [CLI Commands](broken://pages/FmoS4AtQYuyrwjcNe9iO)
* [Settings](/main/getting-started/tabnine-cli/features/settings.md)


---

# Agent Instructions: 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:

```
GET https://docs.tabnine.com/main/getting-started/tabnine-cli/features/model-selection.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
