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