Gemini API

เราขอแนะนำให้ใช้ Interactions API สำหรับโปรเจ็กต์ใหม่ทั้งหมด โดยได้รับการเพิ่มประสิทธิภาพสำหรับเวิร์กโฟลว์แบบเอเจนต์ การจัดการสถานะ และโมเดลล่าสุด ดูข้อมูลเพิ่มเติมได้ในภาพรวมของ Interactions API

เส้นทางที่เร็วที่สุดจากพรอมต์ไปสู่การผลิตด้วย Gemini, Veo, Nano Banana และอื่นๆ

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 ครั้งแรกได้ภายในไม่กี่นาที


พบกับโมเดล

ดูทั้งหมด

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