Gemini API

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

Interactions API เป็นวิธีที่ดีที่สุดในการสร้างด้วย Gemini API และโมเดลและเอเจนต์ Gemini ดูข้อมูลเพิ่มเติมได้ในภาพรวมของ Interactions API

Python

from google import genai

client = genai.Client()

interaction = client.interactions.create(
    model="gemini-3.5-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.5-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.5-flash",
    "input": "Explain how AI works in a few words"
  }'
เริ่มสร้าง

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


พบกับโมเดล

ดูทั้งหมด

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