Claude AI Integration
If you have purchased the AI boilerplate, then you can have Claude AI api already integrated into your project.
Setup
-
Create an account on Claude AI (opens in a new tab).
-
Create an API key.
-
Add the API key to your
.env
file asCLAUDE_API_KEY=your_api_key_here
.
Usage
Use the following code to generate text from a prompt:
import { generateText } from "ai";
import claude from "@/src/lib/claude";
const { text } = await generateText({
model: anthropic("claude-3-haiku-20240307"),
prompt: "Write a vegetarian lasagna recipe for 4 people.",
});