Step-by-step guide for Gemini Pro, Gemini 1.5, and Gemini 2.0 Flash
Google offers a generous free tier for Gemini API:
This is enough for dozens of AI ethical assessments without any cost!
That's it! If you have a Google account, you can get started immediately.
Visit Google AI Studio (formerly MakerSuite):
aistudio.google.com/apikeyClick "Sign in with Google" and select your Google account. If you're already signed in to Google, this step may be automatic.
Review and accept Google's AI Studio Terms of Service. This includes:
Your API key will look something like this:
AIzaSyAaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpClick the copy button to copy it to your clipboard.
Now that you have your API key, you can use it with AI Assess Tech:
import { GoogleGenerativeAI } from '@google/generative-ai';
import { AIAssessClient } from '@aiassesstech/sdk';
const genAI = new GoogleGenerativeAI(process.env.GEMINI_API_KEY!);
const model = genAI.getGenerativeModel({ model: 'gemini-1.5-flash' });
const client = new AIAssessClient({
healthCheckKey: process.env.AIASSESS_KEY
});
const result = await client.assess(async (question) => {
const response = await model.generateContent(question);
return response.response.text();
});| Model | Free Tier | Paid (per 1M tokens) | Est. Cost per Assessment |
|---|---|---|---|
| Gemini 1.5 Flash Recommended | 15 RPM, 1M tokens/min | $0.075 input / $0.30 output | Free* |
| Gemini 1.5 Pro | 2 RPM, 32K tokens/min | $1.25 input / $5.00 output | ~$0.08 |
| Gemini 2.0 Flash | 10 RPM | $0.10 input / $0.40 output | ~$0.01 |
| Gemini Pro | 60 RPM | $0.50 input / $1.50 output | ~$0.02 |
*Within free tier limits. Check ai.google.dev/pricing for current rates.
Make sure you copied the entire key. Gemini keys start with "AIza". Also verify you're using the right API endpoint for Gemini.
You've hit the free tier rate limits. Wait a minute for RPM limits, or wait until the next day for daily limits. Consider enabling billing for higher limits.
Make sure the Generative Language API is enabled in your Google Cloud project. Go to Google Cloud Console to enable it.
Now that you have your Gemini API key, you can run your first AI ethical assessment: