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

# Mistral

> LLM service implementation using Mistral's API with OpenAI-compatible interface

## Overview

`MistralLLMService` provides access to Mistral's language models through an OpenAI-compatible interface. It inherits from `OpenAILLMService` and supports streaming responses, function calling, and vision with Mistral-specific optimizations for tool use and message handling.

<CardGroup cols={2}>
  <Card title="Mistral LLM API Reference" icon="code" href="https://reference-server.pipecat.ai/en/latest/api/pipecat.services.mistral.llm.html">
    Pipecat's API methods for Mistral integration
  </Card>

  <Card title="Example Implementation" icon="play" href="https://github.com/pipecat-ai/pipecat/blob/main/examples/function-calling/function-calling-mistral.py">
    Complete example with function calling
  </Card>

  <Card title="Mistral Documentation" icon="book" href="https://docs.mistral.ai/api/">
    Official Mistral API documentation and features
  </Card>

  <Card title="Mistral Console" icon="microphone" href="https://console.mistral.ai/">
    Access models and manage API keys
  </Card>
</CardGroup>

## Installation

To use Mistral services, install the required dependency:

```bash theme={null}
uv add "pipecat-ai[mistral]"
```

## Prerequisites

### Mistral Account Setup

Before using Mistral LLM services, you need:

1. **Mistral Account**: Sign up at [Mistral Console](https://console.mistral.ai/)
2. **API Key**: Generate an API key from your console dashboard
3. **Model Selection**: Choose from available models (Mistral Small, Mistral Large, etc.)

### Required Environment Variables

* `MISTRAL_API_KEY`: Your Mistral API key for authentication

## Configuration

<ParamField path="api_key" type="str" required>
  Mistral API key for authentication.
</ParamField>

<ParamField path="base_url" type="str" default="https://api.mistral.ai/v1">
  Base URL for Mistral API endpoint.
</ParamField>

<ParamField path="model" type="str" default="None" deprecated>
  Model identifier to use.

  *Deprecated in v0.0.105. Use `settings=MistralLLMService.Settings(model=...)` instead.*
</ParamField>

<ParamField path="settings" type="MistralLLMService.Settings" default="None">
  Runtime-configurable settings. See [Settings](#settings) below.
</ParamField>

### Settings

Runtime-configurable settings passed via the `settings` constructor argument using `MistralLLMService.Settings(...)`. These can be updated mid-conversation with `LLMUpdateSettingsFrame`. See [Service Settings](/pipecat/fundamentals/service-settings) for details.

This service uses the same settings as `OpenAILLMService`. See [OpenAI LLM Settings](/api-reference/server/services/llm/openai#settings) for the full parameter reference.

## Usage

### Basic Setup

```python theme={null}
import os
from pipecat.services.mistral import MistralLLMService

llm = MistralLLMService(
    api_key=os.getenv("MISTRAL_API_KEY"),
    model="mistral-small-latest",
)
```

### With Custom Settings

```python theme={null}
from pipecat.services.mistral import MistralLLMService

llm = MistralLLMService(
    api_key=os.getenv("MISTRAL_API_KEY"),
    settings=MistralLLMService.Settings(
        model="mistral-large-latest",
        temperature=0.7,
        top_p=0.9,
        max_completion_tokens=1024,
    ),
)
```

### Updating Settings at Runtime

```python theme={null}
from pipecat.frames.frames import LLMUpdateSettingsFrame
from pipecat.services.mistral.llm import MistralLLMSettings

await task.queue_frame(
    LLMUpdateSettingsFrame(
        delta=MistralLLMSettings(
            temperature=0.3,
            max_tokens=512,
        )
    )
)
```

## Notes

* **Function calling**: Mistral supports tool/function calling. The service includes deduplication logic to prevent repeated execution of the same function calls across conversation turns.
* **Mistral API constraints**: The service automatically handles Mistral-specific requirements, such as ensuring tool result messages are followed by an assistant message and that system messages appear only at the start of the conversation.
* **Vision**: Supports image inputs via base64-encoded JPEG content.
* **Default model**: `mistral-small-latest` is used when no model is specified.

<Tip>
  The `InputParams` / `params=` pattern is deprecated as of v0.0.105. Use
  `Settings` / `settings=` instead. See the [Service Settings
  guide](/pipecat/fundamentals/service-settings) for migration details.
</Tip>
