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

# Mistral AI

> Use the Mistral AI LLM plugin in a Zero Runtime pipeline. Setup and usage in Python and JavaScript.

Mistral AI is an **LLM** plugin. It takes the transcribed conversation and generates the reply with Mistral's chat models, with support for tool calling.

## Setup

Set your Mistral AI API key in the worker environment. Generate a key from the [Mistral console](https://console.mistral.ai/api-keys):

```bash theme={null}
export MISTRALAI_API_KEY=<key>
```

> [!NOTE]
>
> The variable is `MISTRALAI_API_KEY`, not the `MISTRAL_API_KEY` that Mistral's own SDK reads.

## Usage

Import the plugin and pass it to the pipeline's `llm` slot.

```python Python theme={null}
from zeroruntime.plugins import MistralAILLM

llm = MistralAILLM(
    model="mistral-small-latest",
)

# Pipeline(llm=llm, ...)
```

```typescript Node JS theme={null}
import { MistralAILLM } from '@zeroruntime/js-sdk/plugins';

const llm = MistralAILLM({
  model: 'mistral-small-latest',
});

// Pipeline({ llm, ... })
```

## Parameters

*Constructor parameters for `MistralAILLM`. The Python and Node JS SDKs share these field names.*

| Parameter | Type | Default | Description |
| - | - | - | - |
| `api_key` | `str` | `None` | Mistral AI API key. Falls back to the `MISTRALAI_API_KEY` environment variable when unset. |
| `model` | `str` | `"mistral-small-latest"` | Mistral model name, e.g. "mistral-small-latest" or "mistral-medium-latest". |
| `base_url` | `str` | `"https://api.mistral.ai/v1"` | Base URL of the Mistral API. Change it only when routing through a proxy or compatible endpoint. |
| `temperature` | `float` | `0.7` | Sampling temperature. Lower values give more focused, repeatable replies. |
| `tool_choice` | `Literal['auto', 'required', 'none']` | `"auto"` | How the model may call tools: "auto" lets it decide, "required" forces a tool call, "none" disables tools. |
| `max_completion_tokens` | `int \| None` | `None` | Maximum number of tokens the model may generate per reply. Leave unset for no explicit limit. |

## Import paths

| SDK | Import | Constructor |
| - | - | - |
| Python | `from zeroruntime.plugins import MistralAILLM` | `MistralAILLM()` |
| Node JS | `import { MistralAILLM } from '@zeroruntime/js-sdk/plugins'` | `MistralAILLM()` |

See the [plugins overview](https://docs.zeroruntime.ai/runtime-sdk/plugins/overview.md) for how the LLM slot fits into the rest of the pipeline.


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