Skip to main content

Overview

The Mistral provider gives you access to Mistral AI’s models for chat completion and embeddings, optimized for European languages and multilingual tasks.

Installation

createMistral()

Create a Mistral provider instance.

Options

string
Your Mistral API key. Defaults to MISTRAL_API_KEY environment variable.
string
Custom base URL for API requests.
Mistral
Provide your own configured Mistral client instance.

Returns

MistralProvider with methods chatModel() and embeddingModel().

Supported models

Chat models

  • mistral-large-4 and mistral-large-4-0 — Mistral Large 4 (public preview). Multimodal, 1M context, adjustable reasoning
  • mistral-large-latest — latest general-availability Large model (Large 3, mistral-large-2512)
  • mistral-medium-3-5, mistral-medium-3, and mistral-medium-latest — Mistral Medium 3.5. Multimodal, adjustable reasoning
  • mistral-small-2603 and mistral-small-latest — Mistral Small 4. Multimodal, adjustable reasoning
  • zai-glm-5-3, zai-glm-5, and zai-glm-latest — Z.ai GLM 5.3, hosted on the Mistral API. Text only, adjustable reasoning (low, high, max)
  • codestral-latest — code generation

Embedding models

  • mistral-embed - High-quality text embeddings

Provider support

Model capabilities

reasoning.mode is optional when the model accepts reasoning_effort, and unsupported otherwise. Omitting reasoning does not send the parameter. Every other model id reports reasoning.mode: 'unsupported'. reasoning.effort is ignored, and reasoning_effort is not sent. Thinking chunks in a response are still returned as reasoning parts. Inspect the model instance or use the exported helper:
modalities.input is resolved per model. Vision families such as mistral-large, mistral-medium, mistral-small, magistral-*, ministral-*, and pixtral-* advertise ['text', 'image', 'file'] (image sources: base64 and url); text-only families such as codestral, devstral-*, open-mistral-*, open-mixtral-*, and zai-glm-* advertise ['text'] and reject images. Unrecognized model IDs are treated as multimodal capable. modalities.output is ['text'] for all chat models. Adjustable-reasoning ids are matched first. Everything else prefers an exact model ID and then falls back to the family, ignoring the -latest alias and the -YYMM version suffix. That family fallback is how vision is resolved: pinning an older version reports the capabilities of that version rather than of -latest:

Strict tool schemas

Mistral’s API accepts a strict flag but does not document enforcement, so every model reports model.capabilities.tools.strictSchemas as { supported: false } and strict: true throws ToolSchemaStrictnessError locally. See Strict tool schemas.

Examples

Basic chat

Streaming

Reasoning output

effort: 'high' is sent as reasoning_effort: 'high'. effort: 'minimal' is sent as none, which omits the thinking trace. Native Mistral reasoning is replayed as a thinking chunk on the next turn.

Tool calling

Embeddings

Batch embeddings

Code generation

Provider-specific options

Options are namespaced under mistral in providerOptions:

Generate options

Available fields: stopSequences, frequencyPenalty, presencePenalty, randomSeed, parallelToolCalls, promptMode, safePrompt.
Use parallelToolCalls to enable or disable parallel tool execution when using multiple tools.

Embed options

Available fields: outputDtype ('float' | 'int8' | 'uint8' | 'binary' | 'ubinary'), encodingFormat ('float' | 'base64'), metadata.

Error handling

OpenAI Provider

GPT models with reasoning effort control

Anthropic Provider

Claude models with extended thinking

Embeddings Guide

Learn how to use embeddings