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

# Mistral

> 了解如何在 Agno 中使用 Mistral 模型。

Mistral 是一个为大型语言模型提供端点的平台。
在此处查看其模型库：[here](https://docs.mistral.ai/getting-started/models/models_overview/)。

我们建议进行实验，以找到最适合您用例的模型。以下是一些通用建议：

* `codestral` 模型适用于代码生成和编辑。
* `mistral-large-latest` 模型适用于大多数用例。
* `open-mistral-nemo` 是一个免费模型，适用于大多数用例。
* `pixtral-12b-2409` 是一个视觉模型，适用于 OCR、文档转录和图像比较。它不一定擅长工具调用。

Mistral 有基于层级的速率限制。请参阅 [docs](https://docs.mistral.ai/deployment/laplateforme/tier/) 了解更多信息。

## Authentication

设置您的 `MISTRAL_API_KEY` 环境变量。在此处获取您的密钥：[here](https://console.mistral.ai/api-keys/)。

<CodeGroup>
  ```bash Mac theme={null}
  export MISTRAL_API_KEY=***
  ```

  ```bash Windows theme={null}
  setx MISTRAL_API_KEY ***
  ```
</CodeGroup>

## Example

在您的 `Agent` 中使用 `Mistral`：

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

  from agno.agent import Agent, RunResponse
  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
  )

  # 在终端打印响应
  agent.print_response("Share a 2 sentence horror story.")

  ```
</CodeGroup>

<Note> 在此处查看更多示例：[here](../examples/models/mistral)。 </Note>

## Params

<Snippet file="model-mistral-params.mdx" />

`MistralChat` 是 [Model](/reference/models/model) 类的子类，可以访问相同的参数。
