Skip to content

Mistral ​

Direct access to Mistral's La Plateforme endpoints. Use it when your stack standardizes on Mistral for chat text with streaming, speech synthesis, transcription, and embeddings.

Capabilities ​

Text with streaming, audio generation, transcription, and embeddings.

Configuration ​

Configure via environment variables. config/ai.php only forwards them with env() — set the values in .env or the host environment, never hardcode keys in the config file.

php
// In config/ai.php
return [
    'Ai' => [
        'providers' => [
            'mistral' => [
                'className' => 'Crustum\Ai\Providers\MistralProvider',
                'key' => env('MISTRAL_API_KEY'),
                'url' => env('MISTRAL_URL', 'https://api.mistral.ai/v1'),
                'models' => [
                    'text' => [
                        'default' => env('MISTRAL_TEXT_MODEL', 'mistral-large-2512'),
                        'cheapest' => env('MISTRAL_TEXT_MODEL_CHEAPEST', 'mistral-small-4'),
                        'smartest' => env('MISTRAL_TEXT_MODEL_SMARTEST', 'mistral-medium-3-5'),
                    ],
                    'embeddings' => [
                        'default' => env('MISTRAL_EMBEDDINGS_MODEL', 'mistral-embed-2312'),
                        'dimensions' => (int)env('MISTRAL_EMBEDDINGS_DIMENSIONS', 1024),
                    ],
                    'transcription' => [
                        'default' => env('MISTRAL_TRANSCRIPTION_MODEL', 'voxtral-mini-2602'),
                    ],
                ],
            ],
        ],
    ],
];
Config keyEnv varPurpose
className—Provider class. Keep the default unless subclassing.
key (apiKey also accepted)MISTRAL_API_KEYKey from console.mistral.ai. Required.
urlMISTRAL_URLAPI base URL. Change only for proxies or gateways.
models.text.defaultMISTRAL_TEXT_MODELChat model for normal calls.
models.text.cheapestMISTRAL_TEXT_MODEL_CHEAPESTBudget model.
models.text.smartestMISTRAL_TEXT_MODEL_SMARTESTFlagship model.
models.audio.defaultMISTRAL_AUDIO_MODELText-to-speech model (no env mapping in the default file; add one if you use audio).
models.transcription.defaultMISTRAL_TRANSCRIPTION_MODELSpeech-to-text (Voxtral) model.
models.embeddings.defaultMISTRAL_EMBEDDINGS_MODELEmbeddings model.
models.embeddings.dimensionsMISTRAL_EMBEDDINGS_DIMENSIONSVector width of the embeddings model.
headers— (config only)Extra HTTP headers merged into every request. Add as a plain array if needed.

Model selection priority per call: explicit model: argument wins, then the matching models.* value above, then the provider's built-in fallback.

See also ​

Released under the MIT License.