Gemini API

Gemini API เป็นเส้นทางที่เร็วที่สุดจากพรอมต์ไปสู่การใช้งานจริงด้วย Gemini, Veo, Nano Banana และอื่นๆ โดยช่วยให้คุณผสานรวมโมเดล Generative เหล่านี้เข้ากับแอปพลิเคชันเพื่อสร้างข้อความและรูปภาพ วิเคราะห์อินพุตแบบหลายรูปแบบ และสร้าง Agent ที่ใช้สนทนา

Python

from google import genai

client = genai.Client()

interaction = client.interactions.create(
    model="gemini-3.7-flash",
    input="Explain how AI works in a few words"
)

print(interaction.output_text)

JavaScript

import { GoogleGenAI } from "@google/genai";

const ai = new GoogleGenAI({});

const interaction = await ai.interactions.create({
  model: "gemini-3.7-flash",
  input: "Explain how AI works in a few words",
});

console.log(interaction.output_text);

REST

curl -X POST "https://generativelanguage.googleapis.com/v1beta/interactions" \
  -H "x-goog-api-key: $GEMINI_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
    "model": "gemini-3.7-flash",
    "input": "Explain how AI works in a few words"
  }'
เริ่มสร้าง

ทำตามคู่มือเริ่มต้นใช้งานเพื่อรับคีย์ API และทำการเรียก API ครั้งแรกภายในไม่กี่นาที


พบกับโมเดล

ดูทั้งหมด

สำรวจความสามารถ

Interactions API

Interactions API ได้กลายเป็นอินเทอร์เฟซเริ่มต้นของเราตั้งแต่เดือนมิถุนายน 2026 และเป็นวิธีที่ดีที่สุดในการสร้างด้วยโมเดลและ Agent ของ Gemini ในอนาคต หากคุณกำลังเริ่มโปรเจ็กต์ใหม่ คุณควรใช้ Interactions API แม้ว่าเราจะยังคงให้การสนับสนุน แต่ตอนนี้ generateContent API ถือเป็น API รุ่นเก่า