> ## Documentation Index
> Fetch the complete documentation index at: https://agno-v2.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Mistral

> Use Mistral models with Agno agents.

Mistral provides API endpoints for its large language models.
See their library of models [here](https://docs.mistral.ai/getting-started/models/models_overview/).

We recommend experimenting to find the best-suited model for your use-case. Here are some general recommendations:

* `codestral` model is good for code generation and editing.
* `mistral-large-latest` model is good for most use-cases.
* `open-mistral-nemo` is a free model that is good for most use-cases.
* `ministral-14b-2512` supports vision tasks such as OCR, document transcription, and image comparison.

Mistral has tier-based rate limits. See the [tier docs](https://docs.mistral.ai/deployment/laplateforme/tier/).

## Installation

```bash theme={null}
uv pip install -U mistralai agno
```

## Authentication

Set your `MISTRAL_API_KEY` environment variable. Get your key from [here](https://console.mistral.ai/api-keys/).

```bash Mac theme={null}
export MISTRAL_API_KEY=***
```

```bash Windows theme={null}
setx MISTRAL_API_KEY ***
```

## Example

Use `MistralChat` with your `Agent`:

```python agent.py theme={null}
import os

from agno.agent import Agent
from agno.models.mistral import MistralChat

mistral_api_key = os.getenv("MISTRAL_API_KEY")

agent = Agent(
    model=MistralChat(
        id="mistral-large-latest",
        api_key=mistral_api_key,
    ),
    markdown=True
)

# Print the response in the terminal
agent.print_response("Share a 2 sentence horror story.")

```

> [!NOTE]
>
> View more examples [here](https://agno-v2.mintlify.site/models/providers/native/mistral/usage/basic.md).

## Params

| Parameter | Type | Default | Description |
| - | - | - | - |
| `id` | `str` | `"mistral-large-latest"` | The id of the Mistral model to use |
| `name` | `str` | `"MistralChat"` | The name of the model |
| `provider` | `str` | `"Mistral"` | The provider of the model |
| `temperature` | `Optional[float]` | `None` | Controls randomness in the model's output |
| `max_tokens` | `Optional[int]` | `None` | Maximum number of tokens to generate |
| `top_p` | `Optional[float]` | `None` | Controls diversity via nucleus sampling |
| `random_seed` | `Optional[int]` | `None` | Random seed for reproducibility |
| `safe_mode` | `bool` | `False` | Enable safe mode content filtering |
| `safe_prompt` | `bool` | `False` | Prepend a safety prompt to all requests |
| `request_params` | `Optional[Dict[str, Any]]` | `None` | Additional parameters for the request |
| `api_key` | `Optional[str]` | `None` | The API key for Mistral (defaults to `MISTRAL_API_KEY` env var) |
| `endpoint` | `Optional[str]` | `None` | Custom endpoint for the Mistral API |
| `max_retries` | `Optional[int]` | `None` | Maximum number of retries for API requests |
| `timeout` | `Optional[int]` | `None` | Request timeout in seconds |
| `client_params` | `Optional[Dict[str, Any]]` | `None` | Additional parameters for client configuration |
| `mistral_client` | `Optional[Mistral]` | `None` | A pre-configured Mistral client instance to use |

`MistralChat` is a subclass of the [Model](https://agno-v2.mintlify.site/reference/models/model.md) class and has access to the same params.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.