Gemini API
เส้นทางที่เร็วที่สุดตั้งแต่พรอมต์ไปจนถึงการใช้งานจริงด้วย Gemini, Veo, Nano Banana และอื่นๆ
Python
from google import genai
client = genai.Client()
response = client.models.generate_content(
model="gemini-3-flash-preview",
contents="Explain how AI works in a few words",
)
print(response.text)
JavaScript
import { GoogleGenAI } from "@google/genai";
const ai = new GoogleGenAI({});
async function main() {
const response = await ai.models.generateContent({
model: "gemini-3-flash-preview",
contents: "Explain how AI works in a few words",
});
console.log(response.text);
}
await main();
Go
package main
import (
"context"
"fmt"
"log"
"google.golang.org/genai"
)
func main() {
ctx := context.Background()
client, err := genai.NewClient(ctx, nil)
if err != nil {
log.Fatal(err)
}
result, err := client.Models.GenerateContent(
ctx,
"gemini-3-flash-preview",
genai.Text("Explain how AI works in a few words"),
nil,
)
if err != nil {
log.Fatal(err)
}
fmt.Println(result.Text())
}
Java
package com.example;
import com.google.genai.Client;
import com.google.genai.types.GenerateContentResponse;
public class GenerateTextFromTextInput {
public static void main(String[] args) {
Client client = new Client();
GenerateContentResponse response =
client.models.generateContent(
"gemini-3-flash-preview",
"Explain how AI works in a few words",
null);
System.out.println(response.text());
}
}
C#
using System.Threading.Tasks;
using Google.GenAI;
using Google.GenAI.Types;
public class GenerateContentSimpleText {
public static async Task main() {
var client = new Client();
var response = await client.Models.GenerateContentAsync(
model: "gemini-3-flash-preview", contents: "Explain how AI works in a few words"
);
Console.WriteLine(response.Candidates[0].Content.Parts[0].Text);
}
}
REST
curl "https://generativelanguage.googleapis.com/v1beta/models/gemini-3-flash-preview:generateContent" \
-H "x-goog-api-key: $GEMINI_API_KEY" \
-H 'Content-Type: application/json' \
-X POST \
-d '{
"contents": [
{
"parts": [
{
"text": "Explain how AI works in a few words"
}
]
}
]
}'
ทำตามคำแนะนำในการเริ่มต้นใช้งานอย่างรวดเร็วเพื่อรับคีย์ API และทำการเรียก API ครั้งแรกภายในไม่กี่นาที
พบกับโมเดล
ดูทั้งหมดGemini 3.1 Pro ใหม่
โมเดลที่ชาญฉลาดที่สุดของเรา ซึ่งเป็นโมเดลที่ดีที่สุดในโลกสำหรับการทำความเข้าใจข้อมูลหลายรูปแบบ โดยสร้างขึ้นจากความสามารถในการให้เหตุผลที่ล้ำสมัย
Gemini 3 Flash ใหม่
ประสิทธิภาพระดับแนวหน้าเทียบเท่าโมเดลขนาดใหญ่กว่าในราคาที่ถูกกว่ามาก
Gemini 3.1 Flash-Lite ใหม่
โมเดลที่เหมาะกับงานปริมาณมากและคำนึงถึงต้นทุน โดยมีประสิทธิภาพและคุณภาพเทียบเท่ากับ Gemini 3 Series
🍌 Nano Banana 2 และ Nano Banana Pro
โมเดลการสร้างและแก้ไขรูปภาพที่ล้ำสมัย
Veo 3.1
โมเดลการสร้างวิดีโอที่ล้ำสมัยของเราพร้อมเสียงในตัว
Gemini Robotics
โมเดลวิสัยทัศน์และภาษา (VLM) ที่นำความสามารถด้าน Agentic AI ของ Gemini มาใช้กับหุ่นยนต์ และช่วยให้สามารถให้เหตุผลขั้นสูงในโลกทางกายภาพได้
สำรวจความสามารถ
การสร้างรูปภาพในตัว (Nano Banana)
สร้างและแก้ไขรูปภาพที่มีบริบทสูงในตัวด้วย Gemini 2.5 Flash Image
บริบทแบบยาว
ป้อนโทเค็นหลายล้านรายการลงในโมเดล Gemini และรับข้อมูลเชิงลึกจากรูปภาพ วิดีโอ และเอกสารที่ไม่มีโครงสร้าง
เอาต์พุตที่มีโครงสร้าง
จำกัดให้ Gemini ตอบกลับด้วย JSON ซึ่งเป็นรูปแบบข้อมูลที่มี Structured Data ที่เหมาะสำหรับการประมวลผลอัตโนมัติ
การเรียกใช้ฟังก์ชัน
สร้างเวิร์กโฟลว์แบบเป็น Agent โดยเชื่อมต่อ Gemini กับ API และเครื่องมือภายนอก
การสร้างวิดีโอด้วย Veo 3.1
สร้างเนื้อหาวิดีโอคุณภาพสูงจากพรอมต์ข้อความหรือรูปภาพด้วยโมเดลที่ล้ำสมัยของเรา
ตัวแทนเสียงที่มี Live API
สร้างแอปพลิเคชันและตัวแทนเสียงแบบเรียลไทม์ด้วย Live API
เครื่องมือ
เชื่อมต่อ Gemini กับโลกภายนอกผ่านเครื่องมือในตัว เช่น Google Search, บริบท URL, Google Maps, การดำเนินการโค้ด และการใช้คอมพิวเตอร์
การทำความเข้าใจเอกสาร
ประมวลผลไฟล์ PDF ได้สูงสุด 1,000 หน้าด้วยความสามารถในการทำความเข้าใจข้อมูลหลายรูปแบบอย่างเต็มที่หรือไฟล์ประเภทอื่นๆ ที่อิงตามข้อความ
กำลังคิด
ดูว่าความสามารถในการคิดช่วยปรับปรุงการให้เหตุผลสำหรับงานและตัวแทนที่ซับซ้อนได้อย่างไร