Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ UPSTASH_REDIS_REST_TOKEN=your_upstash_redis_rest_token
# console.groq.com → API Keys
GROQ_API_KEY=your_groq_api_key

# -------------------------------------------------------
# Gemini API Key (optional — enables the /api/ai/roast route)
# aistudio.google.com → Get API key
GEMINI_API_KEY=your_gemini_api_key

# -------------------------------------------------------
# Leaderboard Configuration
# Controls concurrent user fetches during leaderboard builds
Expand Down
11 changes: 10 additions & 1 deletion src/app/api/ai/roast/route.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,19 @@
import { NextResponse } from 'next/server';
import { GoogleGenerativeAI } from '@google/generative-ai';

const GEMINI_API_KEY = process.env.GEMINI_API_KEY || '';

// Initialize the Google Generative AI SDK
const genAI = new GoogleGenerativeAI(process.env.GEMINI_API_KEY || '');
const genAI = new GoogleGenerativeAI(GEMINI_API_KEY);
Comment on lines +4 to +7

export async function POST(req: Request) {
if (!GEMINI_API_KEY) {
return NextResponse.json(
{ error: 'Gemini API key is not configured' },
{ status: 500 }
);
}

try {
const body = await req.json();
const { mode, stats } = body;
Expand Down
Loading