AI
Claude AI

Claude AI Integration

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

Setup

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

  2. Create an API key.

  3. Add the API key to your .env file as CLAUDE_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.",
});