Zum Hauptinhalt springen
Echtzeit-Radar & Feeds
Alle RSS Feeds ➔
👥 Community & Social
••••
Reverse EngineeringReverse-engineered 8BitDo firmware encryption(27.09.2026 um 01:18 Uhr)
••••
Sichere ProgrammierungHow Hindsight Turned Deployment #1017 Into the Fix for #1057(29.09.2026 um 06:25 Uhr)
••••••
Reverse EngineeringReverse-engineered 8BitDo firmware encryption(27.09.2026 um 01:18 Uhr)
••••
Sichere ProgrammierungHow Hindsight Turned Deployment #1017 Into the Fix for #1057(29.09.2026 um 06:25 Uhr)
••
Intelligence View
⚡ tsecurity.de Intelligence

How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed)

Here's how I integrated Google Gemini's free API into a Next.js app - calling it directly from the client with zero backend cost. Why Client-Side? I initially used a serverless function (API route) to call Gemini. But on…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

Here's how I integrated Google Gemini's free API into a Next.js app - calling it directly from the client with zero backend cost.






Why Client-Side?



I initially used a serverless function (API route) to call Gemini. But on Netlify's free tier, functions have a 10-second timeout. Gemini sometimes takes 5-8 seconds, and with cold starts, it was hitting 502 errors.



Solution: Call the Gemini API directly from the browser. Since I'm using the free tier API key (rate-limited by Google), there's no security concern.






Setup






1. Get a Free Gemini API Key



Go to aistudio.google.com. Free tier gives you:




  • 15 requests per minute

  • 1,500 requests per day






2. Environment Variable






NEXT_PUBLIC_GEMINI_API_KEY=your_key_here









3. Call the API






const res = await fetch(
`https://generativelanguage.googleapis.com/v1beta/models/gemini-2.0-flash:generateContent?key=${apiKey}`,
{
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
contents: [{ parts: [{ text: prompt }] }],
generationConfig: { maxOutputTokens: 2000, temperature: 0.7 },
}),
}
);
const data = await res.json();
const text = data?.candidates?.[0]?.content?.parts?.[0]?.text;









4. Static Export for Netlify






// next.config.ts
const nextConfig = { output: "export" };






No serverless functions needed. Deploy with netlify deploy --prod --dir out.






Live Examples





Source: github.com/x-tahosin/maxai-writer



Questions? Drop them below!

2. Cyber Threat Intelligence & Forensik

CTI Threat Relationship Graph2 Knoten / 1 Relationen
CVE / Incident Software MITRE ATT&CK CWE Weakness IoC
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten How to Call Google Gemini API from Next.js (Free Tier, No Backend Needed)

Thematisch verwandte Begriffe: Call, Google, Gemini, from · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

💬 Kommentare werden geladen…
Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-102367 | mall4j through 4.0 contains an insufficient session expiration vulnerab…
Advisory →
tsecurity.de Icon
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag