Gemini 3.8 Flash (gemini-3.8-flash) adalah model Flash kami yang paling cerdas, yang dirancang untuk rekayasa software jangka panjang, agen otonom, dan alur kerja perusahaan yang kompleks.
Panduan ini menjelaskan hal baru di Gemini 3.8 Flash, perubahan API, contoh kode, dan panduan migrasi.
Model baru
| Model | ID Model | Tingkat penalaran default | Harga | Deskripsi |
|---|---|---|---|---|
| Gemini 3.8 Flash | gemini-3.8-flash |
medium |
3.8 Flash tersedia hingga akhir tahun dengan harga perkenalan $0,75/1 juta token input dan $3,75/1 juta token output; lihat harga untuk mengetahui detail selengkapnya. | Model Flash kami yang paling cerdas, yang dirancang untuk rekayasa software jangka panjang, agen otonom, dan alur kerja perusahaan yang kompleks. |
Gemini 3.8 Flash mendukung jendela konteks 1 juta token, maksimum 64 ribu token output, tingkat penalaran yang dapat disesuaikan (low, medium, high), dan rangkaian lengkap alat bawaan yang sama.
Untuk mengetahui spesifikasi lengkapnya, lihat halaman model Gemini 3.8 Flash. Untuk mengetahui detail harga perkenalan, lihat bagian harga di halaman ini atau halaman harga.
Panduan memulai
Python
from google import genai
client = genai.Client()
interaction = client.interactions.create(
model="gemini-3.8-flash",
input="Write a three.js script that renders a realistic 3D black hole."
)
print(interaction.output_text)
JavaScript
import { GoogleGenAI } from "@google/genai";
const client = new GoogleGenAI({});
const interaction = await client.interactions.create({
model: "gemini-3.8-flash",
input: "Write a three.js script that renders a realistic 3D black hole.",
});
console.log(interaction.output_text);
Java
import com.google.genai.Client;
import com.google.genai.gaos.models.interactions.CreateModelInteraction;
import com.google.genai.gaos.models.interactions.Interaction;
import com.google.genai.gaos.models.interactions.InteractionsInput;
import com.google.genai.gaos.models.interactions.Model;
import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;
Client client = new Client();
CreateModelInteraction params =
CreateModelInteraction.builder()
.model(Model.of("gemini-3.8-flash"))
.input(
InteractionsInput.of(
"Write a three.js script that renders a realistic 3D black hole."))
.build();
Interaction interaction =
client.interactions.create(CreateInteractionRequestBody.of(params)).interaction().get();
System.out.println(interaction.outputText().orElse(""));
Go
package main
import (
"context"
"fmt"
"log"
"google.golang.org/genai"
"google.golang.org/genai/interactions/models/interactions"
"google.golang.org/genai/interactions/models/operations"
)
func main() {
ctx := context.Background()
client, err := genai.NewClient(ctx, nil)
if err != nil {
log.Fatal(err)
}
res, err := client.Interactions.Create(ctx, operations.CreateInteractionRequest{
Body: operations.NewCreateInteractionRequestBody(interactions.CreateModelInteraction{
Model: interactions.Model("gemini-3.8-flash"),
Input: interactions.NewInteractionsInput("Write a three.js script that renders a realistic 3D black hole."),
}),
})
if err != nil {
log.Fatal(err)
}
if res.Interaction.OutputText != nil {
fmt.Println(*res.Interaction.OutputText)
}
}
REST
curl "https://generativelanguage.googleapis.com/v1beta/interactions" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H 'Content-Type: application/json' \
-X POST \
-d '{
"model": "gemini-3.8-flash",
"input": "Write a three.js script that renders a realistic 3D black hole."
}'
Yang baru di Gemini 3.8 Flash
- Rekayasa software jangka panjang: Memberikan hasil yang kuat pada benchmark coding dunia nyata, refactoring multi-file yang kompleks, dan eksekusi alat deterministik. Lihat metodologi evaluasi untuk mengetahui detailnya.
- Agen otonom: Memungkinkan Anda membuat alur kerja perencanaan multi-langkah dan orkestrasi alat yang tangguh, sehingga mengurangi loop dan error yang gagal secara signifikan.
- Alur kerja perusahaan yang kompleks: Memberikan akurasi yang unggul, penalaran yang mendalam, dan ketelitian faktual yang tinggi di seluruh tugas domain yang menuntut dan pipeline data skala besar.
- Model default untuk Agen Terkelola: Agen default untuk agen terkelola: agen Antigravity, kini menggunakan Gemini 3.8 Flash. Antigravity SDK juga menggunakan Gemini 3.8 Flash secara default.
- Harga perkenalan: Gemini 3.8 Flash tersedia dengan harga perkenalan $0,75/1 juta token input dan $3,75/1 juta token output hingga 31 Desember 2026. Harga standar $1,50/1 juta token input dan $7,50/1 juta token output berlaku mulai 1 Januari 2027.
Gemini 3.8 Flash dapat menggunakan lebih banyak token pada tugas yang berjalan lebih lama dan kompleks, berdasarkan desain. Untuk memberikan hasil yang lebih berkualitas pada tujuan multi-langkah yang sulit, model ini mengambil langkah penalaran yang lebih kecil, memanggil alat secara berulang, dan memverifikasi pekerjaannya sepanjang proses. Tidak semua alur kerja memerlukan tingkat verifikasi ini. Untuk tugas sehari-hari, Anda dapat menurunkan upaya penalaran untuk mengurangi konsumsi token. Atau, Gemini 3.6 Flash tetap didukung.
Memahami tingkat penalaran
Gemini 3.8 Flash memberi Anda kontrol yang fleksibel atas latensi dan kecerdasan dengan menyesuaikan tingkat penalaran model:
- Upaya penalaran rendah: Mengurangi waktu untuk menjawab tugas yang penting latensinya seperti pipeline respons insiden, chat real-time, draf penulisan, dan analisis data cepat.
- Sedang (default): Kualitas terbaik untuk sebagian besar tugas. Direkomendasikan untuk kode yang kompleks dan kasus penggunaan agentik, yang memberikan akurasi lulus pertama yang lebih tinggi.
- Upaya penalaran tinggi: Memaksimalkan kemampuan penalaran dan orkestrasi alat model. Terbaik untuk penalaran mendalam, matematika, dan tugas multi-langkah yang sulit.
Contoh berikut menetapkan thinking_level ke medium untuk permintaan analisis kode yang kompleks:
Python
from google import genai
client = genai.Client()
interaction = client.interactions.create(
model="gemini-3.8-flash",
input="Analyze this payment processing pipeline for race conditions during retry attempts and rewrite the transaction locks safely.",
generation_config={
"thinking_level": "medium" # Balanced reasoning effort for complex tasks
}
)
print(interaction.output_text)
JavaScript
import { GoogleGenAI } from "@google/genai";
const client = new GoogleGenAI({});
const interaction = await client.interactions.create({
model: "gemini-3.8-flash",
input: "Analyze this payment processing pipeline for race conditions during retry attempts and rewrite the transaction locks safely.",
generation_config: {
thinking_level: "medium"
}
});
console.log(interaction.output_text);
Java
import com.google.genai.Client;
import com.google.genai.gaos.models.interactions.CreateModelInteraction;
import com.google.genai.gaos.models.interactions.GenerationConfig;
import com.google.genai.gaos.models.interactions.Interaction;
import com.google.genai.gaos.models.interactions.InteractionsInput;
import com.google.genai.gaos.models.interactions.Model;
import com.google.genai.gaos.models.interactions.ThinkingLevel;
import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;
Client client = new Client();
CreateModelInteraction params =
CreateModelInteraction.builder()
.model(Model.of("gemini-3.8-flash"))
.input(
InteractionsInput.of(
"Analyze this payment processing pipeline for race conditions during retry attempts and rewrite the transaction locks safely."))
.generationConfig(
GenerationConfig.builder()
.thinkingLevel(ThinkingLevel.MEDIUM) // Balanced reasoning effort for complex tasks
.build())
.build();
Interaction interaction =
client.interactions.create(CreateInteractionRequestBody.of(params)).interaction().get();
System.out.println(interaction.outputText().orElse(""));
Go
package main
import (
"context"
"fmt"
"log"
"google.golang.org/genai"
"google.golang.org/genai/interactions/models/interactions"
"google.golang.org/genai/interactions/models/operations"
)
func main() {
ctx := context.Background()
client, err := genai.NewClient(ctx, nil)
if err != nil {
log.Fatal(err)
}
res, err := client.Interactions.Create(ctx, operations.CreateInteractionRequest{
Body: operations.NewCreateInteractionRequestBody(interactions.CreateModelInteraction{
Model: interactions.Model("gemini-3.8-flash"),
Input: interactions.NewInteractionsInput("Analyze this payment processing pipeline for race conditions during retry attempts and rewrite the transaction locks safely."),
GenerationConfig: &interactions.GenerationConfig{
ThinkingLevel: interactions.ThinkingLevelMedium.ToPointer(), // Balanced reasoning effort for complex tasks
},
}),
})
if err != nil {
log.Fatal(err)
}
if res.Interaction.OutputText != nil {
fmt.Println(*res.Interaction.OutputText)
}
}
REST
curl "https://generativelanguage.googleapis.com/v1beta/interactions" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H 'Content-Type: application/json' \
-X POST \
-d '{
"model": "gemini-3.8-flash",
"input": "Analyze this payment processing pipeline for race conditions during retry attempts and rewrite the transaction locks safely.",
"generation_config": {
"thinking_level": "medium"
}
}'
Agen Antigravity yang diperbarui
Karena performa dan penalaran yang ditingkatkan, agen Antigravity di Agen Terkelola Gemini kini dibuat dengan Gemini 3.8 Flash secara default.
Python
from google import genai
client = genai.Client()
interaction = client.interactions.create(
agent="antigravity-preview-09-2026",
input=(
"Audit https://web.dev for performance, Core Web Vitals, and SEO. "
"Query Google's PageSpeed Insights API for both Mobile and Desktop strategies. "
"Check search indexing with Google Search for site:web.dev. "
"Format the output as a side-by-side scorecard table with prioritized fixes."
),
environment="remote",
)
print(interaction.output_text)
JavaScript
import { GoogleGenAI } from "@google/genai";
const client = new GoogleGenAI({});
const interaction = await client.interactions.create({
agent: "antigravity-preview-09-2026",
input: "Audit https://web.dev for performance, Core Web Vitals, and SEO. Query Google's PageSpeed Insights API for both Mobile and Desktop strategies. Check search indexing with Google Search for site:web.dev. Format the output as a side-by-side scorecard table with prioritized fixes.",
environment: "remote",
}, { timeout: 300000 });
console.log(interaction.output_text);
Java
import com.google.genai.Client;
import com.google.genai.gaos.models.interactions.AgentOption;
import com.google.genai.gaos.models.interactions.CreateAgentInteraction;
import com.google.genai.gaos.models.interactions.CreateAgentInteractionEnvironment;
import com.google.genai.gaos.models.interactions.Interaction;
import com.google.genai.gaos.models.interactions.InteractionsInput;
import com.google.genai.gaos.models.operations.CreateInteractionRequestBody;
Client client = new Client();
CreateAgentInteraction params =
CreateAgentInteraction.builder()
.agent(AgentOption.of("antigravity-preview-09-2026"))
.input(
InteractionsInput.of(
"Audit https://web.dev for performance, Core Web Vitals, and SEO. "
+ "Query Google's PageSpeed Insights API for both Mobile and Desktop strategies. "
+ "Check search indexing with Google Search for site:web.dev. "
+ "Format the output as a side-by-side scorecard table with prioritized fixes."))
.environment(CreateAgentInteractionEnvironment.of("remote"))
.build();
Interaction interaction =
client.interactions.create(CreateInteractionRequestBody.of(params)).interaction().get();
System.out.println(interaction.outputText().orElse(""));
Go
package main
import (
"context"
"fmt"
"log"
"google.golang.org/genai"
"google.golang.org/genai/interactions/models/interactions"
"google.golang.org/genai/interactions/models/operations"
)
func main() {
ctx := context.Background()
client, err := genai.NewClient(ctx, nil)
if err != nil {
log.Fatal(err)
}
res, err := client.Interactions.Create(ctx, operations.CreateInteractionRequest{
Body: operations.NewCreateInteractionRequestBody(interactions.CreateAgentInteraction{
Agent: interactions.AgentOption("antigravity-preview-09-2026"),
Input: interactions.NewInteractionsInput(
"Audit https://web.dev for performance, Core Web Vitals, and SEO. " +
"Query Google's PageSpeed Insights API for both Mobile and Desktop strategies. " +
"Check search indexing with Google Search for site:web.dev. " +
"Format the output as a side-by-side scorecard table with prioritized fixes.",
),
Environment: genai.Ptr(interactions.NewCreateAgentInteractionEnvironment("remote")),
}),
})
if err != nil {
log.Fatal(err)
}
if res.Interaction.OutputText != nil {
fmt.Println(*res.Interaction.OutputText)
}
}
REST
curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \
-H "Content-Type: application/json" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-d '{
"agent": "antigravity-preview-09-2026",
"input": "Audit https://web.dev for performance, Core Web Vitals, and SEO. Query Google'\''s PageSpeed Insights API for both Mobile and Desktop strategies. Check search indexing with Google Search for site:web.dev. Format the output as a side-by-side scorecard table with prioritized fixes.",
"environment": "remote"
}'
Model Gemini yang mendasarinya dapat dikonfigurasi menggunakan agent_config.
Checklist migrasi
`/gemini-api-dev migrate my app to Gemini 3.8 Flash`
Bermigrasi ke gemini-3.8-flash
- Perbarui ID Model: Ubah string model target Anda menjadi
gemini-3.8-flash. - Konfigurasi tingkat penalaran: Ganti
thinking_budgetdengan enum stringthinking_level. Perhatikan bahwaminimaltidak didukung di Gemini 3.8 Flash; pilihlow,medium(default), atauhigh. - Terapkan perubahan parameter Gemini 3 API: Hapus parameter pengambilan sampel yang tidak digunakan lagi (
temperature,top_p,top_k),candidate_count(tidak didukung di Gemini 3 dan yang lebih baru), dan giliran model yang telah diisi sebelumnya. Lihat Perubahan Gemini 3.6 API dan pembaruan parameter. - Terapkan aturan validasi giliran: Standarkan percakapan multi-giliran di
previous_interaction_idsisi server dan hapus giliran model yang telah diisi sebelumnya. - Audit pemanggilan fungsi:
- Tempatkan aset multimodal di dalam payload respons.
- Format petunjuk inline menggunakan
\n\n. - Jika Anda melihat
Malformed_Function_Callerror yang terkait dengan teks pra-alat, lihat Solusi untuk persyaratan teks pra-alat. - Hanya jika menggunakan generateContent API: Pastikan semua objek
FunctionResponsemenyertakancall_iddanname.
- Persyaratan dasar Gemini 3: Untuk pembaruan SDK dan pelestarian tanda tangan pemikiran, lihat Tanda tangan pemikiran.
Harga
Manfaatkan harga perkenalan di Google AI Studio dan Gemini Enterprise Agent Platform hingga 31 Desember 2026 untuk Gemini 3.8 Flash dan Gemini 3.6 Flash. Harga standar berlaku mulai 1 Januari 2027. Untuk mengetahui tingkat harga lengkap, lihat halaman harga.
Model lainnya
Langkah berikutnya
- Tinjau spesifikasi API di Ringkasan Model.
- Pelajari orkestrasi multi-agen di Ringkasan Interactions API.
- Uji dan sempurnakan perintah di Google AI Studio.