Mô hình mới nhất Các mô hình khác
Gemini 3.8 Flash (gemini-3.8-flash) là mô hình Flash thông minh nhất của chúng tôi, được thiết kế cho kỹ thuật phần mềm dài hạn, tác nhân tự động và quy trình công việc phức tạp của doanh nghiệp.
Hướng dẫn này giải thích những điểm mới trong Gemini 3.8 Flash, các thay đổi về API, ví dụ về mã và hướng dẫn di chuyển.
Mô hình mới
| Mô hình | Mã kiểu máy | Cấp độ tư duy mặc định | Giá | Mô tả |
|---|---|---|---|---|
| Gemini 3.8 Flash | gemini-3.8-flash |
medium |
3.8 Flash được cung cấp cho đến hết năm với mức giá ưu đãi là 0,75 USD/1 triệu token đầu vào và 3,75 USD/1 triệu token đầu ra; hãy xem phần giá để biết thêm thông tin chi tiết. | Mô hình Flash thông minh nhất của chúng tôi, được thiết kế cho kỹ thuật phần mềm dài hạn, tác nhân tự động và quy trình công việc phức tạp của doanh nghiệp. |
Gemini 3.8 Flash hỗ trợ cửa sổ ngữ cảnh 1 triệu token, tối đa 64 nghìn token đầu ra, các cấp độ tư duy có thể điều chỉnh (low, medium, high) và cùng một bộ công cụ tích hợp toàn diện.
Để biết thông số kỹ thuật đầy đủ, hãy xem trang mô hình Gemini 3.8 Flash. Để biết thông tin chi tiết về giá ưu đãi, hãy xem phần giá ở phần sau của trang này hoặc trang giá.
Bắt đầu nhanh
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."
}'
Điểm mới trong Gemini 3.8 Flash
- Kỹ thuật phần mềm dài hạn: Mang lại kết quả tốt trên các tiêu chuẩn mã hoá trong thế giới thực, tái cấu trúc phức tạp nhiều tệp và thực thi công cụ xác định. Xem phương pháp đánh giá để biết thông tin chi tiết.
- Tác nhân tự động: Cho phép bạn xây dựng quy trình công việc lập kế hoạch nhiều bước và điều phối công cụ linh hoạt, giảm đáng kể các vòng lặp và lỗi không thành công.
- Quy trình công việc phức tạp của doanh nghiệp: Mang lại độ chính xác vượt trội, khả năng suy luận sâu sắc và tính chính xác cao trên các nhiệm vụ đòi hỏi khắt khe trong miền và các quy trình dữ liệu quy mô lớn.
- Mô hình mặc định cho Tác nhân được quản lý: Tác nhân mặc định cho các tác nhân được quản lý: tác nhân Antigravity, hiện sử dụng Gemini 3.8 Flash. Antigravity SDK cũng sử dụng Gemini 3.8 Flash theo mặc định.
- Giá ưu đãi: Gemini 3.8 Flash được cung cấp với mức giá ưu đãi là 0,75 USD/1 triệu token đầu vào và 3,75 USD/1 triệu token đầu ra cho đến hết ngày 31 tháng 12 năm 2026. Giá thông thường là 1,50 USD/1 triệu token đầu vào và 7,50 USD/1 triệu token đầu ra sẽ có hiệu lực từ ngày 1 tháng 1 năm 2027.
Theo thiết kế, Gemini 3.8 Flash có thể sử dụng nhiều token hơn cho các nhiệm vụ phức tạp và chạy lâu hơn. Để mang lại kết quả chất lượng cao hơn cho các mục tiêu khó, nhiều bước, mô hình này sẽ thực hiện các bước suy luận nhỏ hơn, gọi các công cụ một cách lặp đi lặp lại và xác minh công việc của mình trong quá trình thực hiện. Không phải quy trình công việc nào cũng cần mức độ xác minh này. Đối với các công việc hằng ngày, bạn có thể giảm nỗ lực suy luận để giảm mức tiêu thụ token. Ngoài ra, Gemini 3.6 Flash vẫn được hỗ trợ.
Tìm hiểu về các cấp độ suy luận
Gemini 3.8 Flash cho phép bạn kiểm soát linh hoạt độ trễ và trí thông minh bằng cách điều chỉnh cấp độ tư duy của mô hình:
- Mức độ tư duy thấp: Giảm thời gian trả lời cho các nhiệm vụ quan trọng về độ trễ như pipeline phản hồi sự cố, trò chuyện theo thời gian thực, viết bản nháp và phân tích dữ liệu nhanh.
- Trung bình (mặc định): Chất lượng tốt nhất cho hầu hết các nhiệm vụ. Được đề xuất cho các trường hợp sử dụng tác nhân và mã phức tạp, mang lại độ chính xác cao hơn trong lần đầu tiên.
- Mức độ tư duy cao: Tối đa hoá khả năng suy luận và điều phối công cụ của mô hình. Tốt nhất cho suy luận sâu sắc, toán học và các nhiệm vụ phức tạp nhiều bước.
Ví dụ sau đây đặt thinking_level thành medium cho yêu cầu phân tích mã phức tạp:
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"
}
}'
Tác nhân Antigravity đã cập nhật
Do hiệu suất và khả năng suy luận được cải thiện, tác nhân Antigravity trong Tác nhân được quản lý của Gemini hiện được xây dựng bằng Gemini 3.8 Flash theo mặc định.
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"
}'
Bạn có thể định cấu hình mô hình Gemini cơ bản bằng cách sử dụng agent_config.
Danh sách kiểm tra cho quá trình di chuyển
`/gemini-api-dev migrate my app to Gemini 3.8 Flash`
Di chuyển sang gemini-3.8-flash
- Cập nhật Mã mô hình: Thay đổi chuỗi mô hình mục tiêu thành
gemini-3.8-flash. - Định cấu hình cấp độ tư duy: Thay thế
thinking_budgetbằng enum chuỗithinking_level. Xin lưu ý rằng Gemini 3.8 Flash không hỗ trợminimal; hãy chọnlow,medium(mặc định) hoặchigh. - Áp dụng các thay đổi về tham số API Gemini 3: Xoá các tham số lấy mẫu không dùng nữa (
temperature,top_p,top_k),candidate_count(không được hỗ trợ trong Gemini 3 trở lên) và lượt phản hồi điền sẵn của mô hình. Xem Các thay đổi về API Gemini 3.6 và thông tin cập nhật về tham số. - Thi hành các quy tắc xác thực lượt: Chuẩn hoá các cuộc trò chuyện nhiều lượt trên
previous_interaction_idphía máy chủ và xoá các lượt phản hồi điền sẵn của mô hình. - Kiểm tra lệnh gọi hàm:
- Đặt các thành phần đa phương thức bên trong tải trọng phản hồi.
- Định dạng hướng dẫn nội tuyến bằng cách sử dụng
\n\n. - Nếu bạn thấy các lỗi
Malformed_Function_Callliên quan đến văn bản trước công cụ, hãy xem phần Giải pháp cho các yêu cầu về văn bản trước công cụ. - Chỉ khi sử dụng API generateContent: Đảm bảo tất cả các đối tượng
FunctionResponseđều bao gồmcall_idvàname.
- Các yêu cầu cơ bản của Gemini 3: Để biết thông tin cập nhật về SDK và giữ lại chữ ký tư duy, hãy xem phần Chữ ký tư duy.
Giá
Tận dụng giá ưu đãi trên Google AI Studio và Nền tảng tác nhân Gemini Enterprise cho đến hết ngày 31 tháng 12 năm 2026 đối với Gemini 3.8 Flash và Gemini 3.6 Flash. Giá thông thường sẽ có hiệu lực từ ngày 1 tháng 1 năm 2027. Để biết đầy đủ các bậc giá, hãy xem trang giá.
Các mô hình khác
Bước tiếp theo
- Xem lại thông số kỹ thuật của API trên trang Tổng quan về mô hình.
- Khám phá tính năng điều phối nhiều tác nhân trong trang Tổng quan về Interactions API.
- Kiểm thử và tinh chỉnh câu lệnh trong Google AI Studio.