Mistral AI Integration
If you have purchased the AI boilerplate, then you can have Mistral AI api already integrated into your project.
Setup
-
Create an account on Mistral AI (opens in a new tab).
-
Create an API key.
-
Add the API key to your
.env
file asMISTRAL_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.",
});