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

# Mistral

## Example

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

  from phi.agent import Agent, RunResponse
  from phi.model.mistral import MistralChat

  mistral_api_key = os.getenv("MISTRAL_API_KEY")

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

  # Get the response in a variable
  # run: RunResponse = agent.run("Share a 2 sentence horror story.")
  # print(run.content)

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

  ```
</CodeGroup>

## Usage

Get your key from [here](https://console.mistral.ai/api-keys/).

<Steps>
  <Snippet file="create-venv-step.mdx" />

  <Step title="Install libraries">
    ```bash theme={null}
    pip install -U mistralai phidata
    ```
  </Step>

  <Step title="Export `MISTRAL_API_KEY`">
    ```bash theme={null}
    export MISTRAL_API_KEY=xxx
    ```
  </Step>

  <Step title="Run Mistral Agent">
    ```bash theme={null}
    python cookbook/providers/mistral/basic.py
    ```
  </Step>
</Steps>

## Information

* View on [Github](https://github.com/agno-agi/phidata/tree/main/cookbook/providers/mistral/basic.py)
