---
title: "MistralProvider"
description: "European AI models for prose generation – structured output coverage is uneven, so prefer Gemini for blocks and layouts."
canonical_url: "https://kirby.tools/docs/copilot/php-classes/providers/mistral"
---

# MistralProvider

> European AI models for prose generation – structured output coverage is uneven, so prefer Gemini for blocks and layouts.

Use Mistral through its OpenAI-compatible API. Configuration mirrors [`OpenAIProvider`](/docs/copilot/php-classes/providers/openai) – only the default base URL and model differ.

```php
final class MistralProvider extends OpenAIProvider
{
    public const DEFAULT_BASE_URL = 'https://api.mistral.ai/v1';
}
```

When no `model` is configured, the provider falls back to `mistral-medium-latest`.

<callout color="info" icon="i-ri-external-link-line" to="https://docs.mistral.ai/api">

See Mistral's API documentation for the full model list and feature support.

</callout>

## Configuration

```php [config.php]
return [
    'johannschopplich.copilot' => [
        'provider' => 'mistral',
        'providers' => [
            'mistral' => [
                'apiKey' => env('MISTRAL_API_KEY'),
                'model' => 'mistral-medium-latest',
            ],
        ],
    ],
];
```

<warning>

Mistral's structured output coverage varies by model. Smaller models in particular may emit looser JSON than the schema requires – the provider rethrows as `ProviderException(reason: 'response was not a JSON object')` when this happens. For blocks and layouts, prefer [Gemini](/docs/copilot/php-classes/providers/gemini).

</warning>

---

Every page of this site as Markdown: <https://kirby.tools/sitemap.md>
