Gemini 3.8 Flash (gemini-3.8-flash) tersedia secara umum (GA) dan siap digunakan untuk produksi. Model Flash ini adalah model tercerdas kami, yang dirancang untuk rekayasa software dengan cakupan panjang, agen otonom, dan alur kerja perusahaan yang kompleks.
Panduan ini menjelaskan hal-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 tercerdas kami, yang dirancang untuk rekayasa software dengan cakupan waktu panjang, agen otonom, dan alur kerja perusahaan yang kompleks. |
Gemini 3.8 Flash mendukung jendela konteks 1 juta token, output maksimum 64 ribu token, tingkat pemikiran 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 bawah 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 dengan cakupan luas: Memberikan hasil yang kuat pada benchmark coding dunia nyata, refaktorisasi multi-file yang kompleks, dan eksekusi alat yang deterministik. Lihat metodologi evaluasi untuk mengetahui detailnya.
- Agen otonom: Memungkinkan Anda membangun alur kerja perencanaan multilangkah dan orkestrasi alat yang tangguh, sehingga secara signifikan mengurangi kegagalan loop dan error.
- Alur kerja perusahaan yang kompleks: Memberikan akurasi yang lebih baik, 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 Antigravitasi, kini menggunakan Gemini 3.8 Flash. Antigravity SDK juga menggunakan Gemini 3.8 Flash secara default.
- Harga perkenalan: Gemini 3.8 Flash tersedia dengan tarif perkenalan sebesar $0,75/1 juta token input dan $3,75/1 juta token output hingga 31 Desember 2026. Harga standar sebesar $1,50/1M token input dan $7,50/1M token output akan berlaku mulai 1 Januari 2027.
Gemini 3.8 Flash dapat menggunakan lebih banyak token pada tugas yang berjalan lebih lama dan kompleks, berdasarkan desainnya. Untuk memberikan hasil yang berkualitas lebih tinggi pada tujuan multi-langkah yang sulit, model mengambil langkah-langkah penalaran yang lebih kecil, memanggil alat secara berulang, dan memverifikasi pekerjaannya di 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.7 Flash tetap didukung sepenuhnya.
Memahami tingkat penalaran
Gemini 3.8 Flash memberi Anda kontrol yang fleksibel atas latensi dan kecerdasan dengan menyesuaikan tingkat penalaran model:
- Upaya berpikir yang rendah: Mengurangi waktu untuk menjawab tugas-tugas penting latensi seperti pipeline respons insiden, chat real-time, penulisan draf, dan analisis data cepat.
- Sedang (default): Kualitas terbaik untuk sebagian besar tugas. Direkomendasikan untuk kode kompleks dan kasus penggunaan agentic, yang memberikan akurasi lintasan 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 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 peningkatan performa dan penalaran, 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. - Menghapus parameter pengambilan sampel yang tidak digunakan lagi:
- Hapus
temperature,top_p, dantop_kdari konfigurasi pembuatan. - Ganti
thinking_budgetdengan enum stringthinking_level. Perhatikan bahwaminimaltidak didukung di Flash 3.8. - Menghapus
candidate_count(tidak didukung di Gemini 3 dan yang lebih baru).
- Hapus
- Menerapkan aturan validasi giliran:
- Menstandardisasi percakapan bolak-balik di
previous_interaction_idsisi server. - Menghapus giliran model yang telah diisi otomatis.
- Menstandardisasi percakapan bolak-balik di
- Panggilan fungsi audit:
- Tempatkan aset multimodal di dalam payload respons.
- Format petunjuk inline menggunakan
\n\n. - Jika Anda melihat error
Malformed_Function_Callyang terkait dengan teks sebelum alat, lihat Solusi untuk persyaratan teks sebelum alat. - Khusus jika menggunakan generateContent API: Pastikan semua objek
FunctionResponsemenyertakancall_iddanname.
- Persyaratan dasar Gemini 3: Untuk pembaruan SDK dan pelestarian tanda tangan pemikiran, lihat Daftar Periksa Migrasi Gemini 3.5.
Harga
Manfaatkan harga perkenalan di Google AI Studio dan Gemini Enterprise Agent Platform hingga 31 Desember 2026 untuk Gemini 3.8 Flash, Gemini 3.7 Flash, dan Gemini 3.6 Flash. Harga standar akan berlaku mulai 1 Januari 2027. Untuk mengetahui tingkat harga lengkap, lihat halaman harga.
Langkah berikutnya
- Tinjau spesifikasi API di Ringkasan Model.
- Pelajari orkestrasi multi-agen di Ringkasan Interactions API.
- Uji dan sempurnakan perintah di Google AI Studio.