Skip to content
masterclassBuddyTech Buzz5 fresh blogs · 5:00 AM IST

AI Tools · Function

createMistral

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.

How it works

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.

Syntax

createMistral(options?)

Parameters

NameTypeDescription
optionsMistralProviderSettingsProvider configuration settings, including options such as a custom API key or base URL.

Returns

A configured Mistral provider instance that can create language, embedding, speech, and transcription models.

Key points

  • Import createMistral from the @ai-sdk/mistral package.
  • The factory accepts settings for a customized provider instance.
  • Assign the configured factory result to a provider variable, commonly named mistral.

Common mistakes

  • Use createMistral for customized configuration rather than the default mistral instance.

Example: Create a customized Mistral provider

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.

When to use it

Customized provider configuration

Set a non-default API key, endpoint, or other provider option for a Mistral integration.

Language-model access

Create Mistral language models for text generation through the AI SDK provider interface.

Multiple configurations

Configure one provider instance separately from the package's default mistral export.

Interview questions

QWhat problem does createMistral solve?

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.

QHow do you obtain a model after creating the provider?

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.

QWhen would you choose createMistral instead of mistral?

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/mistral
  • mistral-large-latest
  • mistral-small-latest
  • pixtral-large-latest

Source: Mistral AI - AI SDK. Checked 2026-10-15.