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

AI Tools · Const

Mistral

mistral is the default Mistral provider from @ai-sdk/mistral. Call it with a model ID to create a model for AI SDK text generation and streaming.

How it works

mistral is the default provider instance exported by @ai-sdk/mistral. Calling it with a model ID returns a model that targets Mistral's chat API, which can then be passed to AI SDK functions such as generateText or streamText.

Syntax

mistral(modelId)

Parameters

NameTypeDescription
modelIdstringMistral model identifier, for example mistral-large-latest.

Returns

A language model configured to call Mistral's chat API.

Key points

  • Install and import the provider from the dedicated @ai-sdk/mistral package.
  • The package exposes a ready-to-use default provider instance named mistral.
  • Calling the provider with a model ID produces a model connected to Mistral's chat API.
  • The provider's models work with both complete-text generation and streaming APIs, and can support Mistral web-search tools.

Common mistakes

  • Pass a Mistral model identifier as the provider's first argument; it is not a configuration object.

Example: Generate text with Mistral

import { mistral } from '@ai-sdk/mistral';
import { generateText } from 'ai';

const result = await generateText({
  model: mistral('mistral-large-latest'),
  prompt: 'Explain dependency injection in one sentence.',
});

console.log(result.text);

This creates a Mistral chat model by ID and uses it with generateText to produce text.

When to use it

One-shot text generation

Generate a complete response from a prompt with generateText.

Streaming responses

Produce incremental output with streamText for responsive interfaces.

Custom provider setup

Use a custom endpoint or provider configuration with createMistral.

Interview questions

QHow do you use the Mistral provider to generate text?

Import the default mistral provider from @ai-sdk/mistral, call it with a model ID, and pass the resulting model to generateText or streamText. This keeps model invocation aligned with the AI SDK interface.

Follow-up: How would you customize the provider? Import createMistral and create a provider instance with the required settings, then call that instance with a model ID.

QHow do you construct a Mistral language model?

The package is @ai-sdk/mistral, and the default instance is imported as mistral. A model is created by calling mistral(modelId), such as mistral('mistral-large-latest').

Follow-up: What API does the resulting model call? It targets Mistral's chat API through the provider implementation.

QWhen should you use createMistral instead of mistral?

Use createMistral when the default provider instance is insufficient. It creates a provider with custom settings, while the default mistral instance provides the standard setup.

Follow-up: Which endpoint does the standard provider use? Its default prefix is https://api.mistral.ai/v1.

  • createMistral
  • generateText
  • streamText
  • @ai-sdk/mistral

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