Don’t Want to Top Up for Anthropic? Use FREE Gemini AI Instead!
Switching from Anthropic’s Claude to **Google’s Gemini AI** is super easy and FREE! Here’s how you can do it:
1. Install the Package:
Instead of `@ai-sdk/anthropic`, install `@ai-sdk/google`:
npm install @ai-sdk/google
2. Configure Gemini AI:
Use the `createGoogleGenerativeAI` function to set it up:
import { createGoogleGenerativeAI } from "@ai-sdk/google";
const google = createGoogleGenerativeAI({
apiKey: process.env.GEMINI_API_KEY,
});
3. Choose Your Model:
Select a model like this:
const model = google("gemini-2.0-flash");
Check out all available models here: https://ai.google.dev/gemini-api/docs/models/gemini
4. Get Your API Key
Grab your FREE API key from here: https://aistudio.google.com/app/apikey
5. That’s It!
The rest of your code stays the same -- just swap out the configurations.
If you need help, drop a comment below.
11
8 comments
Aayush Jaiswal
5
Don’t Want to Top Up for Anthropic? Use FREE Gemini AI Instead!
University of Code
skool.com/universityofcode
You'll get Exclusive Lessons & Content, Badass Community Support & More here to elevate as a Dev!
Leaderboard (30-day)
Powered by