Gemini API

Interactions API là cách đơn giản và hiệu quả nhất để xây dựng bằng các mô hình và tác nhân Gemini. Tìm hiểu thêm trong bài viết Tổng quan về Interactions API.

Con đường nhanh nhất từ câu lệnh đến sản phẩm với Gemini, Veo, Nano Banana và nhiều công cụ khác.

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"
  }'
Bắt đầu xây dựng

Hãy làm theo hướng dẫn Bắt đầu nhanh của chúng tôi để lấy khoá API và thực hiện lệnh gọi API đầu tiên chỉ trong vài phút.


Làm quen với các mô hình

Xem tất cả

Khám phá các khả năng