Icindekiler
Google AI Studio Nedir?
Google AI Studio, Google'in Gemini modellerini test etmek, prompt tasarlamak ve uygulamalariniza AI entegre etmek icin gelistirdigi ucretsiz bir web tabanli platformdur. Tarayicinizdan dogrudan erisebilir, kod yazmadan prompt deneyebilir ve API anahtari alarak uygulamalara entegre edebilirsiniz.
Chat Prompt'lar
Cok turlu sohbet formatinda prompt tasarimi ve test.
Yapilandirilmis Prompt
Ornek girdi/cikti ile prompt sablonlari olusturun.
Gorsel Analiz
Gorsel yukleme, analiz etme ve gorsellerle kod uretimi.
Kurulum ve Baslangic
Adim 1: AI Studio'ya Erisim
aistudio.google.com adresine gidin ve Google hesabinizla giris yapin. Herhangi bir kurulum gerektirmez.
Adim 2: API Anahtari Alin
# 1. AI Studio'da "Get API Key" butonuna tiklayin
# 2. Yeni bir proje olusturun veya mevcut birini secin
# 3. API anahtarini kopyalayin
# Ortam degiskenini ayarlayin
export GEMINI_API_KEY="your-api-key-here"
# Node.js SDK kurulumu
npm install @google/generative-ai
Adim 3: Ilk API Cagrisi
import { GoogleGenerativeAI } from "@google/generative-ai";
const genAI = new GoogleGenerativeAI(process.env.GEMINI_API_KEY);
const model = genAI.getGenerativeModel({ model: "gemini-2.0-flash" });
const result = await model.generateContent(
"Write a TypeScript function that validates a credit card number using the Luhn algorithm"
);
console.log(result.response.text());
Ucretsiz Kullanim
Google AI Studio'nun ucretsiz katmani oldukca comert. Gemini 2.0 Flash ile dakikada 15 istek, gunde 1500 istek yapabilirsiniz. Prototipleme ve ogrenme icin idealdir.
Temel Kullanim
Chat Prompt'lar
const chat = model.startChat({
history: [
{ role: "user", parts: [{ text: "You are a senior React developer." }] },
{ role: "model", parts: [{ text: "I'm ready to help with React development." }] },
],
});
const result = await chat.sendMessage(
"Create a custom hook for infinite scrolling with IntersectionObserver"
);
console.log(result.response.text());
Kod Uretimi
const result = await model.generateContent({
contents: [{ role: "user", parts: [{ text: `
Generate a complete Express.js middleware for:
1. Rate limiting (100 requests per 15 minutes per IP)
2. Request logging with timestamps
3. CORS configuration for production
Use TypeScript and add JSDoc comments.
`}]}],
generationConfig: {
temperature: 0.2,
maxOutputTokens: 2048,
}
});
Gorsel Analizi
import * as fs from "fs";
const imageData = fs.readFileSync("ui-mockup.png");
const base64Image = imageData.toString("base64");
const result = await model.generateContent([
{ inlineData: { mimeType: "image/png", data: base64Image } },
{ text: "Convert this UI mockup to a React component with Tailwind CSS. Make it responsive." }
]);
console.log(result.response.text());
Web Sitesi Olusturma
AI Studio'da prompt tasarlayip, urettigi kodu export ederek web uygulamasi olusturalim.
Adim 1: Prompt Tasarimi
AI Studio'da "Create New" ile yeni bir chat prompt olusturun. System instruction olarak su sekilde yapilandirin:
System Instruction:
"You are a full-stack web developer. Generate clean, production-ready code.
Use React 19, TypeScript, and Tailwind CSS. Handle all states: loading,
error, empty, success. Include proper error handling and accessibility."
User Prompt:
"Create a landing page for a SaaS product called 'DataFlow'.
Include: hero section with CTA, features grid (6 features),
pricing table (3 tiers), testimonials carousel, and footer.
Make it fully responsive."
Adim 2: Kodu Export Etme
# AI Studio'da "Get Code" butonuyla API kodunu alin
# Uretilen React componentleri projenize kopyalayin
# Proje olusturma
npx create-next-app@latest dataflow --typescript --tailwind
cd dataflow
# AI Studio'dan gelen componentleri src/components/ altina yerlestirin
Adim 3: Gemini API Entegrasyonu
// src/app/api/chat/route.ts
import { GoogleGenerativeAI } from "@google/generative-ai";
import { NextRequest, NextResponse } from "next/server";
const genAI = new GoogleGenerativeAI(process.env.GEMINI_API_KEY!);
export async function POST(req: NextRequest) {
const { message } = await req.json();
const model = genAI.getGenerativeModel({ model: "gemini-2.0-flash" });
const result = await model.generateContent(message);
return NextResponse.json({ response: result.response.text() });
}
Mobil Uygulama Gelistirme
Flutter ile Gemini API entegrasyonlu bir mobil uygulama gelistirelim.
Adim 1: Flutter Projesi Olusturma
# Flutter projesi olusturun
flutter create gemini_app
cd gemini_app
# Gemini SDK'yi ekleyin
flutter pub add google_generative_ai
Adim 2: Gemini Servisi
// lib/services/gemini_service.dart
import 'package:google_generative_ai/google_generative_ai.dart';
class GeminiService {
late final GenerativeModel _model;
GeminiService(String apiKey) {
_model = GenerativeModel(
model: 'gemini-2.0-flash',
apiKey: apiKey,
);
}
Future<String> generateResponse(String prompt) async {
final content = [Content.text(prompt)];
final response = await _model.generateContent(content);
return response.text ?? 'No response';
}
}
Adim 3: Chat Ekrani
// lib/screens/chat_screen.dart
// AI Studio'da tasarladiginiz prompt'lari
// Flutter uygulamasinda kullanabilirsiniz.
// Ornek: Gorsel analizi, kod uretimi, metin ozeti
// Gorsel ile prompt
final response = await model.generateContent([
Content.multi([
TextPart('Describe this image'),
DataPart('image/jpeg', imageBytes),
])
]);
Ileri Seviye Ipuclari
Model Karsilastirmasi
Gemini 2.5 Pro karmasik kod gorevleri icin, Gemini 2.0 Flash hizli ve ucuz islemler icin, Gemini 2.0 Flash Lite basit gorevler icin idealdir.
Guvenlik Ayarlari
AI Studio'da guvenlik filtrelerini ayarlayabilirsiniz. Kod uretimi icin genellikle varsayilan ayarlar uygundur, ancak ozel kullanim durumlari icin filtreleri ozellestirin.
Grounding (Temellendirme)
Google Search grounding ile modelin yanlarini guncel bilgilerle destekleyin. API dokumantasyonlari ve en son framework versiyonlari icin cok faydali.
Context Caching
Buyuk dosyalari veya uzun system instruction'lari tekrar tekrar gondermek yerine context caching kullanarak maliyet ve gecikme suresini azaltin.
Fiyatlandirma
Google AI Studio comert bir ucretsiz katman sunar. API kullaniminda kullandiginiz kadar odersiniz.
Ucretsiz Katman
- 15 RPM (Gemini 2.0 Flash)
- 1500 istek/gun
- Tum modellere erisim
- AI Studio arayuzu
Gemini 2.0 Flash
- En hizli model
- 1M token context
- Multimodal destegi
Gemini 2.5 Pro
- En yetenekli model
- 1M token context
- Thinking destegi
Pratik Alistirmalar
Alistirma 1: Gorsel -> Kod Cevirici
AI Studio'da bir UI mockup gorseli yukleyin ve Gemini'den bu gorseli React + Tailwind koduna cevirmesini isteyin. Uretilen kodu bir Next.js projesinde calistirin ve mockup'a ne kadar yakin oldugunu karsilastirin.
Alistirma 2: Chatbot Olusturma
Gemini API kullanarak bir musteri destek chatbot'u olusturun. System instruction ile chatbot'un kisiligini ve bilgi tabanini tanimlayin. Streaming response kullanin.
Alistirma 3: Multimodal Uygulama
Hem metin hem gorsel isleme yapan bir web uygulamasi olusturun. Kullanici gorsel yukleyip soru sorabilsin. Ornegin: yemek gorseli yukleyip "kalori hesapla" diyebilsin.