Gemini 3.8 Flash (gemini-3.8-flash) เป็นโมเดล Flash ที่ชาญฉลาดที่สุดของเรา ซึ่งได้รับการออกแบบมาเพื่อวิศวกรรมซอฟต์แวร์ระยะยาว, Agent ที่ทำงานได้ด้วยตัวเอง และเวิร์กโฟลว์ที่ซับซ้อนขององค์กร
คู่มือนี้จะอธิบายสิ่งใหม่ๆ ใน Gemini 3.8 Flash, การเปลี่ยนแปลง API, ตัวอย่างโค้ด และคำแนะนำในการย้ายข้อมูล
โมเดลใหม่
| รุ่น | รหัสโมเดล | ระดับการคิดเริ่มต้น | ราคา | คำอธิบาย |
|---|---|---|---|---|
| Gemini 3.8 Flash | gemini-3.8-flash |
medium |
3.8 Flash พร้อมให้บริการจนถึงสิ้นปีในราคาช่วงแนะนำที่ $0.75/1 ล้านโทเค็นขาเข้าและ $3.75/1 ล้านโทเค็นขาออก ดูรายละเอียดเพิ่มเติมได้ที่ ราคา | โมเดล Flash ที่ชาญฉลาดที่สุดของเรา ซึ่งได้รับการออกแบบมาเพื่อวิศวกรรมซอฟต์แวร์ระยะยาว, Agent ที่ทำงานได้ด้วยตัวเอง และเวิร์กโฟลว์ที่ซับซ้อนขององค์กร |
Gemini 3.8 Flash รองรับหน้าต่างบริบทขนาด 1 ล้านโทเค็น, โทเค็นขาออกสูงสุด 64, 000 โทเค็น, ระดับการคิดที่ปรับได้ (low, medium, high) และชุดเครื่องมือในตัวที่ครอบคลุมชุดเดียวกัน
ดูสเปคทั้งหมดได้ที่หน้าโมเดล Gemini 3.8 Flash ดูรายละเอียดราคาช่วงแนะนำได้ในส่วนราคาในหน้านี้หรือหน้าการกำหนดราคา
คู่มือเริ่มใช้งานฉบับย่อ
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."
}'
สิ่งใหม่ๆ ใน Gemini 3.8 Flash
- วิศวกรรมซอฟต์แวร์ระยะยาว: ให้ผลลัพธ์ที่ยอดเยี่ยมในการเปรียบเทียบประสิทธิภาพการเขียนโค้ดในโลกแห่งความเป็นจริง, การปรับโครงสร้างโค้ดหลายไฟล์ที่ซับซ้อน และการดำเนินการเครื่องมือที่กำหนดได้ ดูรายละเอียดได้ที่ระเบียบวิธีประเมิน
- Agent ที่ทำงานได้ด้วยตัวเอง: ช่วยให้คุณสร้างเวิร์กโฟลว์การวางแผนและการจัดการเครื่องมือแบบหลายขั้นตอนที่ยืดหยุ่นได้ ซึ่งจะช่วยลดการวนซ้ำที่ล้มเหลวและข้อผิดพลาดได้อย่างมาก
- เวิร์กโฟลว์ที่ซับซ้อนขององค์กร: ให้ความแม่นยำที่เหนือกว่า, การให้เหตุผลเชิงลึก และความถูกต้องของข้อเท็จจริงสูงในงานที่ต้องใช้ความเชี่ยวชาญเฉพาะด้านและ Data Pipeline ขนาดใหญ่
- โมเดลเริ่มต้นสำหรับ Managed Agents: Agent เริ่มต้นสำหรับ Managed Agents ซึ่งก็คือ Agent ของ Antigravity ตอนนี้ใช้ Gemini 3.8 Flash แล้ว นอกจากนี้ Antigravity SDK ยังใช้ Gemini 3.8 Flash เป็นค่าเริ่มต้นด้วย
- ราคาช่วงแนะนำ: Gemini 3.8 Flash พร้อมให้บริการในราคาช่วงแนะนำที่ $0.75/1 ล้านโทเค็นขาเข้าและ $3.75/1 ล้านโทเค็นขาออกจนถึงวันที่ 31 ธันวาคม 2026 ราคามาตรฐานที่ $1.50/1 ล้านโทเค็นขาเข้าและ $7.50/1 ล้านโทเค็นขาออกจะมีผลตั้งแต่วันที่ 1 มกราคม 2027
Gemini 3.8 Flash สามารถใช้โทเค็นมากขึ้นในงานที่ใช้เวลานานขึ้นและซับซ้อนขึ้น ซึ่งเป็นไปตามการออกแบบ โมเดลจะใช้ขั้นตอนการให้เหตุผลที่สั้นลง เรียกใช้เครื่องมือซ้ำๆ และตรวจสอบงานของตัวเองไปพร้อมๆ กัน เพื่อให้ได้ผลลัพธ์ที่มีคุณภาพสูงขึ้นสำหรับเป้าหมายที่ยากและมีหลายขั้นตอน เวิร์กโฟลว์บางอย่างอาจไม่จำเป็นต้องมีการตรวจสอบในระดับนี้ สำหรับงานประจำวัน คุณสามารถลดความพยายามในการให้เหตุผลเพื่อลดการใช้โทเค็นได้ หรือจะใช้ Gemini 3.6 Flash ต่อไปก็ได้
ทำความเข้าใจระดับการให้เหตุผล
Gemini 3.8 Flash ช่วยให้คุณควบคุมเวลาในการตอบสนองและความฉลาดได้อย่างยืดหยุ่นโดยการปรับระดับการคิดของโมเดล ดังนี้
- การประมวลผลความคิดต่ำ: ลดเวลาในการตอบสนองสำหรับงานที่สำคัญต่อเวลาในการตอบสนอง เช่น ไปป์ไลน์การตอบสนองต่อเหตุการณ์, การแชทแบบเรียลไทม์, การเขียนฉบับร่าง และการวิเคราะห์ข้อมูลอย่างรวดเร็ว
- ปานกลาง (ค่าเริ่มต้น): คุณภาพดีที่สุดสำหรับงานส่วนใหญ่ แนะนำให้ใช้กับโค้ดที่ซับซ้อนและกรณีการใช้งานแบบ Agent ซึ่งจะให้ความแม่นยำในการผ่านครั้งแรกสูงขึ้น
- การประมวลผลความคิดสูง: เพิ่มขีดความสามารถในการให้เหตุผลและการจัดการเครื่องมือของโมเดลให้สูงสุด เหมาะที่สุดสำหรับการให้เหตุผลเชิงลึก, คณิตศาสตร์ และงานที่ยากและมีหลายขั้นตอน
ตัวอย่างต่อไปนี้จะตั้งค่า thinking_level เป็น medium สำหรับคำขอวิเคราะห์โค้ดที่ซับซ้อน
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"
}
}'
Agent ของ Antigravity ที่อัปเดตแล้ว
เนื่องจากประสิทธิภาพและการให้เหตุผลที่ได้รับการปรับปรุง ตอนนี้ Agent ของ Antigravity ใน Gemini Managed Agents จึงสร้างขึ้นด้วย Gemini 3.8 Flash เป็นค่าเริ่มต้น
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"
}'
คุณสามารถกำหนดค่าโมเดล Gemini ที่อยู่เบื้องหลัง ได้ โดยใช้ agent_config
เช็กลิสต์การย้ายข้อมูล
`/gemini-api-dev migrate my app to Gemini 3.8 Flash`
ย้ายข้อมูลไปใช้ gemini-3.8-flash
- อัปเดตรหัสโมเดล: เปลี่ยนสตริงโมเดลเป้าหมายเป็น
gemini-3.8-flash - กำหนดค่าระดับการคิด: แทนที่
thinking_budgetด้วย enum สตริงthinking_levelโปรดทราบว่า Gemini 3.8 Flash ไม่รองรับminimalให้เลือกlow,medium(ค่าเริ่มต้น) หรือhigh - ใช้การเปลี่ยนแปลงพารามิเตอร์ Gemini 3 API: นำพารามิเตอร์การสุ่มตัวอย่างที่เลิกใช้งานแล้ว (
temperature,top_p,top_k),candidate_count(ไม่รองรับใน Gemini 3 และเวอร์ชันที่ใหม่กว่า) และรอบการโต้ตอบของโมเดลที่กำหนดไว้ล่วงหน้าออก ดู การเปลี่ยนแปลง Gemini 3.6 API และการอัปเดตพารามิเตอร์ - บังคับใช้กฎการตรวจสอบการโต้ตอบ: ทำให้การสนทนาแบบหลายรอบเป็นมาตรฐานใน
previous_interaction_idฝั่งเซิร์ฟเวอร์และนำรอบการโต้ตอบของโมเดลที่กำหนดไว้ล่วงหน้าออก - ตรวจสอบการเรียกใช้ฟังก์ชัน:
- วางเนื้อหาหลายรูปแบบไว้ในเพย์โหลดการตอบกลับ
- จัดรูปแบบคำแนะนำแบบอินไลน์โดยใช้
\n\n - หากเห็นข้อผิดพลาด
Malformed_Function_Callที่เชื่อมโยงกับข้อความก่อนเครื่องมือ โปรดดู วิธีแก้ปัญหาสำหรับข้อกำหนดข้อความก่อนเครื่องมือ - เฉพาะในกรณีที่ใช้ generateContent API: ตรวจสอบว่าออบเจ็กต์
FunctionResponseทั้งหมดมีcall_idและname
- ข้อกำหนดพื้นฐานของ Gemini 3: ดูการอัปเดต SDK และการเก็บรักษาลายเซ็นความคิดได้ที่ลายเซ็นความคิด
ราคา
ใช้ประโยชน์จากราคาช่วงแนะนำใน Google AI Studio และแพลตฟอร์ม Agent ของ Gemini Enterprise จนถึงวันที่ 31 ธันวาคม 2026 สำหรับ Gemini 3.8 Flash และ Gemini 3.6 Flash ราคามาตรฐานจะมีผลตั้งแต่วันที่ 1 มกราคม 2027 ดูระดับราคาทั้งหมดได้ที่หน้าการกำหนดราคา
โมเดลอื่นๆ
ขั้นตอนถัดไป
- ตรวจสอบสเปค API ในภาพรวมของโมเดล
- สำรวจการจัดการ Agent หลายรายการในภาพรวมของ Interactions API
- ทดสอบและปรับแต่งพรอมต์ใน Google AI Studio