Gemini API
เส้นทางที่เร็วที่สุดจากพรอมต์ไปสู่การใช้งานจริงด้วย Gemini, Veo, Nano Banana และอื่นๆ
Python
from google import genai
client = genai.Client()
response = client.models.generate_content(
model="gemini-3.5-flash",
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.5-flash",
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.5-flash",
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.5-flash",
"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.5-flash", 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.5-flash: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.5 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
สร้างเนื้อหาวิดีโอคุณภาพสูงจากพรอมต์ข้อความหรือรูปภาพด้วยโมเดลที่ล้ำสมัยของเรา
Agent เสียงพร้อม Live API
สร้างแอปพลิเคชันและ Agent เสียงแบบเรียลไทม์ด้วย Live API
เครื่องมือ
เชื่อมต่อ Gemini กับโลกภายนอกผ่านเครื่องมือในตัว เช่น Google Search, บริบท URL, Google Maps, การดำเนินการโค้ด และการใช้คอมพิวเตอร์
การทำความเข้าใจเอกสาร
ประมวลผลไฟล์ PDF ได้สูงสุด 1,000 หน้าด้วยความเข้าใจข้อมูลหลายรูปแบบแบบเต็มหรือไฟล์ประเภทอื่นๆ ที่อิงตามข้อความ
กำลังคิด
ดูว่าความสามารถในการคิดช่วยปรับปรุงการให้เหตุผลสำหรับงานและ Agent ที่ซับซ้อนได้อย่างไร