AI
Mistral AI

Mistral AI Integration

If you have purchased the AI boilerplate, then you can have Mistral AI api already integrated into your project.

Setup

  1. Create an account on Mistral AI (opens in a new tab).

  2. Create an API key.

  3. Add the API key to your .env file as MISTRAL_API_KEY=your_api_key_here.

Usage

Use the following code to generate text from a prompt:

import mistral from "@/src/lib/mistral";
import { generateText } from "ai";
 
const { text } = await generateText({
	model: mistral("mistral-large-latest"),
	prompt: "Write a vegetarian lasagna recipe for 4 people.",
});