Customized provider configuration
Set a non-default API key, endpoint, or other provider option for a Mistral integration.
AI Tools · Function
createMistral creates a configurable Mistral provider for the AI SDK. Configure the provider, then call it with a Mistral model identifier to obtain a model.
createMistral builds a Mistral provider instance using optional configuration such as an API key. The returned provider is callable: pass a Mistral model identifier to obtain a language model that can be used with AI SDK functions.
createMistral(options?)| Name | Type | Description |
|---|---|---|
options | MistralProviderSettings | Provider configuration settings, including options such as a custom API key or base URL. |
A configured Mistral provider instance that can create language, embedding, speech, and transcription models.
import { createMistral } from '@ai-sdk/mistral';
const mistral = createMistral({
apiKey: process.env.MISTRAL_API_KEY,
});
const model = mistral('mistral-large-latest');
console.log(model.modelId);Creates a customized Mistral provider and selects a model from it.
Set a non-default API key, endpoint, or other provider option for a Mistral integration.
Create Mistral language models for text generation through the AI SDK provider interface.
Configure one provider instance separately from the package's default mistral export.
createMistral is the factory for a customized Mistral provider. Import it from @ai-sdk/mistral, pass provider settings, and call the resulting provider with a model identifier.
Follow-up: How would you use the default configuration? Import mistral from @ai-sdk/mistral and call it with the desired model identifier.
The provider package is @ai-sdk/mistral. The factory returns a provider instance, which can then create models for Mistral APIs.
Follow-up: What should be passed to the provider instance? A supported Mistral model identifier, such as mistral-large-latest.
Use createMistral when provider settings must be customized; otherwise, the package also exposes a default mistral provider instance. Both are imported from @ai-sdk/mistral.
Follow-up: Why use the provider abstraction? It lets AI SDK code work through a standardized model interface across providers.
mistral@ai-sdk/mistralmistral-large-latestmistral-small-latestpixtral-large-latest