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 ใหม่
ประสิทธิภาพระดับฟรอนเทียร์เทียบเท่าโมเดลขนาดใหญ่กว่าในราคาที่ถูกกว่ามาก
Nano Banana และ Nano Banana Pro
โมเดลการสร้างและแก้ไขรูปภาพที่ล้ำสมัย
Veo 3.1
โมเดลการสร้างวิดีโอสุดล้ำของเราพร้อมเสียงแบบเนทีฟ
TTS ของ Gemini 2.5 Pro
โมเดล Gemini 2.5 ที่มีความสามารถในการอ่านออกเสียงข้อความ (TTS) แบบเนทีฟ
Gemini Robotics
โมเดลภาษาภาพ (VLM) ที่นำความสามารถแบบเป็น Agent ของ Gemini มาใช้กับหุ่นยนต์และช่วยให้การให้เหตุผลขั้นสูงในโลกกายภาพเป็นไปได้
สำรวจความสามารถ
การสร้างรูปภาพโดยตรง (Nano Banana)
สร้างและแก้ไขรูปภาพที่มีบริบทสูงได้โดยตรงด้วย Gemini 2.5 Flash Image
บริบทแบบยาว
ป้อนโทเค็นหลายล้านรายการลงในโมเดล Gemini และรับข้อมูลเชิงลึกจากรูปภาพ วิดีโอ และเอกสารที่ไม่มีโครงสร้าง
เอาต์พุตที่มีโครงสร้าง
จำกัดให้ Gemini ตอบกลับด้วย JSON ซึ่งเป็นรูปแบบข้อมูลที่มีโครงสร้างที่เหมาะสำหรับการประมวลผลอัตโนมัติ
การเรียกใช้ฟังก์ชัน
สร้างเวิร์กโฟลว์แบบเอเจนต์โดยเชื่อมต่อ Gemini กับ API และเครื่องมือภายนอก
การสร้างวิดีโอด้วย Veo 3.1
สร้างเนื้อหาวิดีโอคุณภาพสูงจากพรอมต์ข้อความหรือรูปภาพด้วยโมเดลสุดล้ำของเรา
ตัวแทนเสียงที่มี Live API
สร้างแอปพลิเคชันและเอเจนต์เสียงแบบเรียลไทม์ด้วย Live API
เครื่องมือ
เชื่อมต่อ Gemini กับโลกภายนอกผ่านเครื่องมือในตัว เช่น Google Search, บริบท URL, Google Maps, การเรียกใช้โค้ด และการใช้คอมพิวเตอร์
การทำความเข้าใจเอกสาร
ประมวลผลไฟล์ PDF ได้สูงสุด 1,000 หน้าโดยมีความเข้าใจแบบมัลติโมดัลอย่างเต็มรูปแบบหรือไฟล์ประเภทอื่นๆ ที่เป็นข้อความ
การคิด
ดูว่าความสามารถในการคิดช่วยปรับปรุงการให้เหตุผลสำหรับงานและเอเจนต์ที่ซับซ้อนได้อย่างไร